24 use netcdf
, only: nf90_noerr, nf90_max_name, &
25 & nf90_inquire_variable, nf90_inquire_dimension, nf90_inquire
28 integer,
intent(out),
optional:: ndims
30 integer,
intent(out),
optional:: dimlen
32 logical,
intent(out),
optional:: growable
34 character(*),
intent(out),
optional:: name
36 character(*),
intent(out),
optional:: url
38 character(*),
intent(out),
optional:: xtype
43 integer:: stat, length, i, i_xtype, idim_growable
44 character(len = *),
parameter:: subname =
'GDNcVarInquire' 45 character(len = NF90_MAX_NAME):: buffer
46 character(len = NF90_MAX_NAME):: fbuffer
48 call beginsub(subname,
'var.id=%d', i=(/var%id/))
51 if (
present(ndims)) ndims = -1
52 if (
present(dimlen)) dimlen = -1
56 if (stat /= nf90_noerr)
then 57 call endsub(subname,
'var not found')
63 if (
present(ndims))
then 64 if (
associated(ent%dimids))
then 65 ndims =
size(ent%dimids)
71 if (
present(dimlen))
then 73 if (ent%dimid > 0)
then 75 stat = nf90_inquire_dimension(ent%fileid, ent%dimid, len = dimlen)
76 if (stat /= nf90_noerr)
then 78 call endsub(subname,
'dimlen err')
83 if (
associated(ent%dimids))
then 84 do, i = 1,
size(ent%dimids)
85 stat = nf90_inquire_dimension(ent%fileid, ent%dimids(i), len = length)
86 if (stat /= nf90_noerr)
then 90 dimlen = dimlen * length
96 if (
present(xtype))
then 97 stat = nf90_inquire_variable(ent%fileid, ent%varid, xtype=i_xtype)
98 if (stat /= nf90_noerr) i_xtype = 0
102 if (
present(name))
then 107 if (
present(url))
then 109 call dbgmessage(
'ent%%fileid=%d', i=(/ent%fileid/))
111 url = trim(fbuffer) //
'?' // buffer
114 if (
present(growable))
then 117 if (stat /= nf90_noerr)
return 118 stat = nf90_inquire(ent%fileid, unlimiteddimid = idim_growable)
119 if (stat /= nf90_noerr)
return 121 if (ent%varid > 0)
then 122 if (.not.
associated(ent%dimids))
return 123 do, i = 1,
size(ent%dimids)
124 if (ent%dimids(i) == idim_growable) growable = .true.
127 growable = (ent%dimid == idim_growable)
132 call endsub(subname,
'ok')
139 & nf90_inquire_dimension, nf90_inquire_variable, nf90_noerr
141 character(len = *),
intent(out):: varname
142 if (ent%dimid > 0)
then 143 stat = nf90_inquire_dimension(ent%fileid, ent%dimid, name = varname)
145 stat = nf90_inquire_variable(ent%fileid, ent%varid, name = varname)
147 if (stat /= nf90_noerr) varname =
""
integer function, public vtable_lookup(var, entry)
subroutine gdncxtypename(ixtype, xtype)
subroutine, public dbgmessage(fmt, i, r, d, L, n, c1, c2, c3, ca)
subroutine, public beginsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca, version)
subroutine local_getname(ent, varname)
subroutine, public endsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca)