39 SUBROUTINE getgb2r(LUGB, CINDEX, GFLD, IRET)
43 INTEGER,
INTENT(IN) :: LUGB
44 CHARACTER(LEN=1),
INTENT(IN) :: CINDEX(*)
46 INTEGER,
INTENT(OUT) :: IRET
48 INTEGER :: LSKIP, SKIP6, SKIP7
49 CHARACTER(LEN=1):: CSIZE(4)
50 CHARACTER(LEN=1),
ALLOCATABLE :: CTEMP(:)
51 real,
pointer,
dimension(:) :: newfld
52 integer :: n, lread, j, iskip, iofst, ilen, ierr, idum
55 subroutine gf_unpack6(cgrib, lcgrib, iofst, ngpts, ibmap, bmap, ierr)
56 character(len=1),
intent(in) :: cgrib(lcgrib)
57 integer,
intent(in) :: lcgrib, ngpts
58 integer,
intent(inout) :: iofst
59 integer,
intent(out) :: ibmap
60 integer,
intent(out) :: ierr
61 logical*1,
pointer,
dimension(:) :: bmap
63 subroutine gf_unpack7(cgrib, lcgrib, iofst, igdsnum, igdstmpl, &
64 idrsnum, idrstmpl, ndpts, fld, ierr)
65 character(len=1),
intent(in) :: cgrib(lcgrib)
66 integer,
intent(in) :: lcgrib, ndpts, idrsnum, igdsnum
67 integer,
intent(inout) :: iofst
68 integer,
pointer,
dimension(:) :: idrstmpl, igdstmpl
69 integer,
intent(out) :: ierr
70 real,
pointer,
dimension(:) :: fld
75 NULLIFY(gfld%bmap, gfld%fld)
82 IF (gfld%ibmap .eq. 0 .OR. gfld%ibmap .eq. 254)
THEN
86 CALL baread(lugb, iskip, 4, lread, csize)
91 CALL baread(lugb, iskip, ilen, lread, ctemp)
92 IF (ilen .NE. lread)
THEN
98 CALL gf_unpack6(ctemp, ilen, iofst, gfld%ngrdpts, idum, gfld%bmap, ierr)
108 iskip = lskip + skip7
111 CALL baread(lugb, iskip, 4, lread, csize)
113 if (ilen .lt. 6) ilen = 6
114 ALLOCATE(ctemp(ilen))
117 CALL baread(lugb, iskip, ilen, lread, ctemp)
118 IF (ilen .NE. lread)
THEN
124 CALL gf_unpack7(ctemp, ilen, iofst, gfld%igdtnum, gfld%igdtmpl, &
125 gfld%idrtnum, gfld%idrtmpl, gfld%ndpts, gfld%fld, ierr)
126 IF (ierr .NE. 0)
THEN
135 if (gfld%ibmap .ne. 255 .AND.
associated(gfld%bmap))
then
136 allocate(newfld(gfld%ngrdpts))
138 do j = 1, gfld%ngrdpts
139 if (gfld%bmap(j))
then
140 newfld(j) = gfld%fld(n)
146 deallocate(gfld%fld);
148 gfld%expanded = .true.
150 gfld%expanded = .true.
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 getgb2r(LUGB, CINDEX, GFLD, IRET)
Read and unpack sections 6 and 7 from a GRIB2 message.
subroutine gf_unpack6(cgrib, lcgrib, iofst, ngpts, ibmap, bmap, ierr)
Unpack Section 6 (Bit-Map Section) of a GRIB2 message, starting at octet 6 of that Section.
subroutine gf_unpack7(cgrib, lcgrib, iofst, igdsnum, igdstmpl, idrsnum, idrstmpl, ndpts, fld, ierr)
Unpack Section 7 (Data Section) of a GRIB2 message.
This Fortran module contains the declaration of derived type gribfield.