NCEPLIBS-g2  3.4.8
gf_unpack6.F90
Go to the documentation of this file.
1 
6 
29 subroutine gf_unpack6(cgrib, lcgrib, iofst, ngpts, ibmap, bmap, ierr)
30  implicit none
31 
32  character(len = 1), intent(in) :: cgrib(lcgrib)
33  integer, intent(in) :: lcgrib, ngpts
34  integer, intent(inout) :: iofst
35  integer, intent(out) :: ibmap
36  integer, intent(out) :: ierr
37 
38  logical*1, pointer, dimension(:) :: bmap
39  integer :: intbmap(ngpts)
40  integer :: istat, j
41 
42  ierr = 0
43  nullify(bmap)
44 
45  iofst = iofst + 32 ! Skip Length of Section.
46  iofst = iofst + 8 ! Skip section number.
47 
48  call g2_gbytec(cgrib, ibmap, iofst, 8) ! Get bit-map indicator.
49  iofst = iofst + 8
50 
51  if (ibmap .eq. 0) then ! Unpack bitmap
52  istat = 0
53  if (ngpts .gt. 0) allocate(bmap(ngpts), stat = istat)
54  if (istat .ne. 0) then
55  ierr = 6
56  nullify(bmap)
57  return
58  endif
59  call g2_gbytesc(cgrib, intbmap, iofst, 1, 0, ngpts)
60  iofst = iofst + ngpts
61  do j = 1, ngpts
62  bmap(j) = .true.
63  if (intbmap(j) .eq. 0) bmap(j) = .false.
64  enddo
65  endif
66 
67 end subroutine gf_unpack6
68 
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...
Definition: g2_gbytesc.F90:63
subroutine g2_gbytec(in, iout, iskip, nbits)
Extract arbitrary size values from a packed bit string, right justifying each value in the unpacked a...
Definition: g2_gbytesc.F90:20
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.
Definition: gf_unpack6.F90:30