37 type,
private :: g2grid
41 integer,
dimension(MAXTEMP) :: gridtmpl
42 character(len = 8) :: cdesc
43 type(g2grid),
pointer :: next
46 type(g2grid),
pointer,
private :: gridlist
61 integer,
intent(in) :: lunit
63 integer,
parameter :: linelen = 1280
64 character(len = 8) :: desc
65 character(len = linelen) :: cline
66 integer :: ient, igdtn, igdtmpl(200), igdtlen
67 integer :: pos1, pos2, pos3, pos4
68 type(g2grid),
pointer :: gtemp
69 type(g2grid),
pointer :: prev => null()
79 cline(1 : linelen) =
' '
80 read(lunit,
end = 999, fmt =
'(a)') cline
83 if (cline(1 : 1) .eq.
'#') cycle
86 pos1 = index(cline,
':')
87 cline(pos1 : pos1) =
';'
88 pos2 = index(cline,
':')
89 cline(pos2 : pos2) =
';'
90 pos3 = index(cline,
':')
91 cline(pos3 : pos3) =
';'
92 pos4 = index(cline,
':')
93 if ( pos1 .eq. 0 .or. pos2 .eq. 0 .or. pos3 .eq. 0 .or. &
97 read(cline(1 : pos1 - 1), *) ient
98 read(cline(pos1 + 1 : pos2 - 1), *) desc
99 read(cline(pos2 + 1 : pos3 - 1), *) igdtn
100 read(cline(pos3 + 1 : pos4 - 1), *) igdtlen
101 read(cline(pos4 + 1 : linelen), *) (igdtmpl(j), j = 1, igdtlen)
106 gtemp%grid_num = ient
107 gtemp%gdt_num = igdtn
108 gtemp%gdt_len = igdtlen
109 gtemp%gridtmpl = igdtmpl
112 if ( count .eq. 1 )
then
146 integer,
intent(in) :: lunit, number
147 integer,
intent(out) :: igdtn, igdtmpl(*), iret
148 type(g2grid),
pointer :: tempgrid
166 do while (
associated(tempgrid))
167 if (number .eq. tempgrid%grid_num)
then
168 igdtn = tempgrid%gdt_num
169 igdtmpl(1 : tempgrid%gdt_len) = tempgrid%gridtmpl(1 : tempgrid%gdt_len)
172 tempgrid => tempgrid%next
202 integer,
intent(in) :: lunit
203 character(len = 8),
intent(in) :: name
204 integer,
intent(out) :: igdtn, igdtmpl(*), iret
205 type(g2grid),
pointer :: tempgrid
223 do while (
associated(tempgrid))
224 if (name .eq. tempgrid%cdesc)
then
225 igdtn = tempgrid%gdt_num
226 igdtmpl(1:tempgrid%gdt_len) = tempgrid%gridtmpl(1:tempgrid%gdt_len)
229 tempgrid => tempgrid%next
244 type(g2grid),
pointer :: gridnext
247 gridnext => gridlist%next
Allow access to predefined GRIB2 Grid Definition Templates (GDT) stored in a file.
subroutine freegridlist()
This subroutine frees the memory allocated for the linked list of grid templates stored in module var...
integer, parameter maxtemp
maximum template number for grid definition.
integer function readgrids(lunit)
This function reads the list of GDT entries in the file associated with fortran unit,...
integer num_grids
the number of grids.
subroutine getgridbynum(lunit, number, igdtn, igdtmpl, iret)
This subroutine searches a file referenced by fortran unit lunit for a Grid Definition Template assig...
subroutine getgridbyname(lunit, name, igdtn, igdtmpl, iret)
This subroutine searches a file referenced by fortran unit lunit for a Grid Definition Template assig...