gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
gdncvarattr.f90
Go to the documentation of this file.
1
31
43subroutine gdncvarattrrewind(var)
46 use dc_trace, only: dbgmessage
47 implicit none
48 type(gd_nc_variable), intent(in):: var
49 integer:: stat
50 character(len = *), parameter:: subname = 'GDNcVarAttrRewind'
51
52 stat = vtable_set_attrid(var, 0)
53 call dbgmessage("%c %d", c1=subname, i=(/stat/))
54end subroutine gdncvarattrrewind
55
77subroutine gdncvarattrnext(var, name, vend)
80 use netcdf, only: nf90_noerr, nf90_max_name, nf90_inq_attname, nf90_global
81 use dc_url, only: gt_plus
82 implicit none
83 type(gd_nc_variable), intent(in):: var
84 character(len = *), intent(out):: name
85 type(gd_nc_variable_entry):: ent
86 logical, intent(out), optional:: vend
87 character(len = NF90_MAX_NAME):: attrname
88 integer:: stat
89 integer:: new_attrid
90
91 stat = vtable_lookup(var, ent)
92 if (stat /= nf90_noerr) goto 999
93
94 new_attrid = ent%attrid
95 ! 最初は変数属性の検索
96 if (ent%attrid >= 0) then
97 new_attrid = ent%attrid + 1
98 stat = nf90_inq_attname(ent%fileid, ent%varid, new_attrid, attrname)
99 if (stat == nf90_noerr) then
100 name = attrname
101 stat = vtable_set_attrid(var, new_attrid)
102 vend = .false.
103 return
104 end if
105 new_attrid = -1
106 endif
107
108 ! 次は大域属性の検索
109 stat = nf90_inq_attname(ent%fileid, nf90_global, -new_attrid, attrname)
110 if (stat == nf90_noerr) then
111 new_attrid = new_attrid - 1
112 name = gt_plus // attrname
113 stat = vtable_set_attrid(var, new_attrid)
114 vend = .false.
115 return
116 endif
117
118999 continue
119 ! ここでは attrid の再設定はしない。次呼んでもエラーになるのが適当。
120 vend = .true.
121 name = ""
122 return
123end subroutine gdncvarattrnext
subroutine gdncvarattrnext(var, name, vend)
subroutine gdncvarattrrewind(var)
Debug tracing module.
Definition dc_trace.f90:150
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:661
Variable URL string parser.
Definition dc_url.f90:61
character, parameter, public gt_plus
Definition dc_url.f90:109
integer function, public vtable_set_attrid(var, attrid)
integer function, public vtable_lookup(var, entry)