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

Inquire attribute information . More...

Go to the source code of this file.

Functions/Subroutines

subroutine gdncattrinquire (var, attrname, xtype)
subroutine gdncattrinquireplus (var, attrname, varid, nf_attrname)

Detailed Description

Inquire attribute information

.

Author
GFD Dennou Club

Definition in file gdncattrinquire.f90.

Function/Subroutine Documentation

◆ gdncattrinquire()

subroutine gdncattrinquire ( type(gd_nc_variable), intent(in) var,
character(len=*), intent(in) attrname,
character(len=*), intent(out), optional xtype )

Get attribute type information

Returns the type name of the specified attribute.

Parameters
[in]varVariable handle
[in]attrnameAttribute name
[out]xtypeType name (optional)

Definition at line 34 of file gdncattrinquire.f90.

38 use netcdf, only: nf90_max_name, nf90_noerr, nf90_inquire_attribute
39 implicit none
40 type(GD_NC_VARIABLE), intent(in):: var
41 character(len=*), intent(in):: attrname
42 character(len=*), intent(out), optional:: xtype
43 type(GD_NC_VARIABLE_ENTRY):: ent
44 integer:: varid, i_xtype, stat
45 character(len=NF90_MAX_NAME):: anam
46 stat = vtable_lookup(var, ent)
47 if (stat /= nf90_noerr) return
48 if (present(xtype)) then
49 call inquireplus(var, attrname, varid, anam)
50 stat = nf90_inquire_attribute(ent%fileid, varid, anam, xtype=i_xtype)
51 if (stat /= nf90_noerr) i_xtype = 0
52 call gdncxtypename(i_xtype, xtype)
53 endif
integer function, public vtable_lookup(var, entry)

References gtdata_netcdf_internal::vtable_lookup().

Here is the call graph for this function:

◆ gdncattrinquireplus()

subroutine gdncattrinquireplus ( type(gd_nc_variable), intent(in) var,
character(len=*), intent(in) attrname,
integer, intent(out) varid,
character(len=*), intent(out) nf_attrname )

Get actual varid and attribute name for netCDF access

Determines the actual varid and attribute name to use for netCDF access:

  • If attrname starts with '+': Force global attribute
  • If attrname starts with '-': Search variable attribute, then global
Parameters
[in]varVariable handle
[in]attrnameAttribute name (may have prefix)
[out]varidnetCDF variable ID
[out]nf_attrnamenetCDF attribute name

Definition at line 78 of file gdncattrinquire.f90.

81 use dc_url, only: gt_plus
82 use netcdf, only: nf90_global, nf90_noerr, nf90_inquire_attribute
83 type(GD_NC_VARIABLE), intent(in):: var
84 character(len=*), intent(in):: attrname
85 integer, intent(out):: varid
86 type(GD_NC_VARIABLE_ENTRY):: ent
87 character(len=*), intent(out):: nf_attrname
88 integer:: stat, n
89 stat = vtable_lookup(var, ent)
90 if (stat /= nf90_noerr) return
91 if (attrname(1:1) == gt_plus) then
92 varid = nf90_global
93 nf_attrname = attrname(2: )
94 else if (attrname(1:1) == '-') then
95 varid = ent%varid
96 nf_attrname = attrname(2: )
97 stat = nf90_inquire_attribute(ent%fileid, varid, nf_attrname, len = n)
98 if (stat == nf90_noerr) return
99 varid = nf90_global
100 else
101 varid = ent%varid
102 nf_attrname = attrname
103 endif
Variable URL string parser.
Definition dc_url.f90:61
character, parameter, public gt_plus
Definition dc_url.f90:109

References dc_url::gt_plus, and gtdata_netcdf_internal::vtable_lookup().

Here is the call graph for this function: