gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
gtvaropen.f90 File Reference

Open gtool4 data. More...

Go to the source code of this file.

Functions/Subroutines

subroutine gtvaropen (var, url, writable, err)

Detailed Description

Open gtool4 data.

Author
Yasuhiro MORIKAWA, Eizi TOYODA

This subroutine is provided through gtdata_generic.

Definition in file gtvaropen.f90.

Function/Subroutine Documentation

◆ gtvaropen()

subroutine gtvaropen ( type(gt_variable), intent(out) var,
character(*), intent(in) url,
logical, intent(in), optional writable,
logical, intent(out), optional err )

Open gtool4 variable

Opens the gtool variable identified by url and stores it in var. If writable is set to .true., attempts to open for writing. The default is to open read-only. (Note: writable behavior is not yet guaranteed.)

Variables opened with Open must always be closed with Close.

If an error occurs and err is provided, err returns .true.. If err is not provided, the program terminates.

Open is a generic name for 2 subroutines; it is also possible to open by specifying a dimension of a variable.

Parameters
[out]varVariable handle
[in]urlVariable URL
[in]writableOpen for writing (optional)
[out]errError flag (optional)

Definition at line 64 of file gtvaropen.f90.

65 use dc_string, only: strhead
66 use dc_types, only: string
67 use gtdata_types, only: gt_variable
68 use gtdata_generic, only: limit
69 use gtdata_internal_map, only: map_create, vtb_class_netcdf, gtvar_dump
72 use dc_url, only: url_chop_iorange
74 use dc_trace, only: beginsub, endsub
76 implicit none
77 type(GT_VARIABLE), intent(out):: var
78 character(*), intent(in):: url
79 logical, intent(in), optional:: writable
80 logical, intent(out), optional:: err
81 integer:: ndims, stat, cause_i
82 character(STRING):: cause_c
83 integer, allocatable:: dimlen(:)
84 type(GD_NC_VARIABLE):: gdnc
85 character(STRING):: filevar, iorange
86 character(*), parameter:: subname = "GTVarOpen"
87 character(*), parameter:: version = &
88 & '$Name: $' // &
89 & '$Id: gtvaropen.f90,v 1.4 2009-05-25 09:55:57 morikawa Exp $'
90continue
91 call beginsub(subname, fmt='<%c>', c1=trim(url), version=version)
92 stat = dc_noerr
93 cause_i = 0
94 cause_c = ''
95 var = gt_variable(-1)
96 call url_chop_iorange(url, iorange=iorange, remainder=filevar)
97 call open(gdnc, filevar, writable, err)
98 if ( present_and_true(err) ) then
99 stat = gt_enotvar
100 goto 999
101 end if
102 call inquire(gdnc, ndims=ndims)
103 allocate(dimlen(max(1, ndims)))
104 call inquire(gdnc, dimlen=dimlen)
105 call map_create(var, vtb_class_netcdf, gdnc%id, ndims, dimlen, stat)
106 if (stat /= dc_noerr) then
107 cause_i = ndims
108 goto 999
109 end if
110 deallocate(dimlen)
111 call limit(var, trim(iorange))
112 call gtvar_dump(var)
113999 continue
114 call storeerror(stat, subname, err, cause_c = cause_c, cause_i = cause_i)
115 call endsub(subname, 'mapid=%d', i=(/var%mapid/))
Error handling module.
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public dc_noerr
Error storage variables
Definition dc_error.f90:468
integer, parameter, public gt_enotvar
Definition dc_error.f90:512
Judge optional control parameters.
logical function, public present_and_true(arg)
Handling character types.
Definition dc_string.f90:83
Debug tracing module.
Definition dc_trace.f90:150
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:457
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:580
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public string
Character length for string
Definition dc_types.f90:137
Variable URL string parser.
Definition dc_url.f90:61
subroutine, public url_chop_iorange(fullname, iorange, remainder)
Definition dc_url.f90:301
subroutine, public map_create(var, class, cid, ndims, allcount, stat)

References dc_trace::beginsub(), dc_error::dc_noerr, dc_trace::endsub(), dc_error::gt_enotvar, gtdata_internal_map::gtvar_dump(), gtdata_internal_map::map_create(), dc_present::present_and_true(), dc_error::storeerror(), dc_types::string, and dc_url::url_chop_iorange().

Here is the call graph for this function: