35 subroutine gf_unpack4(cgrib, lcgrib, iofst, ipdsnum, ipdstmpl, &
36 mappdslen, coordlist, numcoord, ierr)
41 character(len = 1),
intent(in) :: cgrib(lcgrib)
42 integer,
intent(in) :: lcgrib
43 integer,
intent(inout) :: iofst
44 real,
pointer,
dimension(:) :: coordlist
45 integer,
pointer,
dimension(:) :: ipdstmpl
46 integer,
intent(out) :: ipdsnum
47 integer,
intent(out) :: ierr, numcoord
49 real(4),
allocatable :: coordieee(:)
50 integer,
allocatable :: mappds(:)
53 integer :: lensec, nbits, newmappdslen
54 integer :: istat1, istat, isign, iret, i
57 nullify(ipdstmpl, coordlist)
63 allocate(mappds(lensec))
66 call g2_gbytec(cgrib, numcoord, iofst, 16)
75 if (
allocated(mappds))
deallocate(mappds)
83 if (mappdslen.gt.0)
allocate(ipdstmpl(mappdslen), stat = istat)
87 if (
allocated(mappds))
deallocate(mappds)
91 nbits = iabs(mappds(i))*8
92 if (mappds(i).ge.0)
then
93 call g2_gbytec(cgrib, ipdstmpl(i), iofst, nbits)
96 call g2_gbytec(cgrib, ipdstmpl(i), iofst + 1, nbits-1)
97 if (isign.eq.1) ipdstmpl(i) = -ipdstmpl(i)
107 call realloc(ipdstmpl, mappdslen, newmappdslen, istat)
109 do i = mappdslen + 1, newmappdslen
110 nbits = iabs(mappds(i))*8
111 if (mappds(i).ge.0)
then
112 call g2_gbytec(cgrib, ipdstmpl(i), iofst, nbits)
115 call g2_gbytec(cgrib, ipdstmpl(i), iofst + 1, nbits-1)
116 if (isign.eq.1) ipdstmpl(i) = -ipdstmpl(i)
118 iofst = iofst + nbits
120 mappdslen = newmappdslen
122 if (
allocated(mappds))
deallocate(mappds)
127 if (numcoord .ne. 0)
then
128 allocate (coordieee(numcoord), stat = istat1)
129 allocate(coordlist(numcoord), stat = istat)
130 if ((istat1 + istat).ne.0)
then
133 if (
allocated(coordieee))
deallocate(coordieee)
136 call g2_gbytesc(cgrib, coordieee, iofst, 32, 0, numcoord)
137 call rdieee(coordieee, coordlist, numcoord)
138 deallocate (coordieee)
139 iofst = iofst + (32 * numcoord)
subroutine g2_gbytesc(in, iout, iskip, nbits, nskip, n)
Extract arbitrary size values from a packed bit string, right justifying each value in the unpacked a...
subroutine g2_gbytec(in, iout, iskip, nbits)
Extract arbitrary size values from a packed bit string, right justifying each value in the unpacked a...
subroutine gf_unpack4(cgrib, lcgrib, iofst, ipdsnum, ipdstmpl, mappdslen, coordlist, numcoord, ierr)
Unpack Section 4 (Product Definition Section) of a GRIB2 message, starting at octet 6 of that Section...
Information on all GRIB2 Product Definition Templates used in Section 4 - the Product Definition Sect...
subroutine extpdstemplate(number, list, nummap, map)
This subroutine generates the remaining octet map for a given Product Definition Template,...
subroutine getpdstemplate(number, nummap, map, needext, iret)
This subroutine returns PDS template information for a specified Product Definition Template.
Reallocate memory, preserving contents.
subroutine rdieee(rieee, a, num)
Copy array of 32-bit IEEE floating point values to local floating point representation.