Loading...
Searching...
No Matches
Functions/Subroutines
gdncvarattr.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine gdncvarattrrewind (var)
 
subroutine gdncvarattrnext (var, name, vend)
 

Function/Subroutine Documentation

◆ gdncvarattrnext()

subroutine gdncvarattrnext ( type(gd_nc_variable), intent(in)  var,
character(len = *), intent(out)  name,
logical, intent(out), optional  vend 
)

Definition at line 29 of file gdncvarattr.f90.

32 use netcdf, only: nf90_noerr, nf90_max_name, nf90_inq_attname, nf90_global
33 use dc_url, only: gt_plus
34 implicit none
35 type(GD_NC_VARIABLE), intent(in):: var
36 character(len = *), intent(out):: name
37 type(GD_NC_VARIABLE_ENTRY):: ent
38 logical, intent(out), optional:: vend
39 character(len = NF90_MAX_NAME):: attrname
40 integer:: stat
41 integer:: new_attrid
42
43 stat = vtable_lookup(var, ent)
44 if (stat /= nf90_noerr) goto 999
45
46 new_attrid = ent%attrid
47 ! 最初は変数属性の検索
48 if (ent%attrid >= 0) then
49 new_attrid = ent%attrid + 1
50 stat = nf90_inq_attname(ent%fileid, ent%varid, new_attrid, attrname)
51 if (stat == nf90_noerr) then
52 name = attrname
53 stat = vtable_set_attrid(var, new_attrid)
54 vend = .false.
55 return
56 end if
57 new_attrid = -1
58 endif
59
60 ! 次は大域属性の検索
61 stat = nf90_inq_attname(ent%fileid, nf90_global, -new_attrid, attrname)
62 if (stat == nf90_noerr) then
63 new_attrid = new_attrid - 1
64 name = gt_plus // attrname
65 stat = vtable_set_attrid(var, new_attrid)
66 vend = .false.
67 return
68 endif
69
70999 continue
71 ! ここでは attrid の再設定はしない。次呼んでもエラーになるのが適当。
72 vend = .true.
73 name = ""
74 return
character, parameter, public gt_plus
Definition dc_url.f90:92
integer function, public vtable_set_attrid(var, attrid)
integer function, public vtable_lookup(var, entry)

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

Here is the call graph for this function:

◆ gdncvarattrrewind()

subroutine gdncvarattrrewind ( type(gd_nc_variable), intent(in)  var)

Definition at line 15 of file gdncvarattr.f90.

18 use netcdf, only: nf90_noerr
19 use dc_trace, only: dbgmessage
20 implicit none
21 type(GD_NC_VARIABLE), intent(in):: var
22 integer:: stat
23 character(len = *), parameter:: subname = 'GDNcVarAttrRewind'
24
25 stat = vtable_set_attrid(var, 0)
26 call dbgmessage("%c %d", c1=subname, i=(/stat/))

References gtdata_netcdf_internal::vtable_set_attrid().

Here is the call graph for this function: