NCEPLIBS-g2  3.4.5
gf_unpack6.f
Go to the documentation of this file.
1 
6 
35 
36  subroutine gf_unpack6(cgrib,lcgrib,iofst,ngpts,ibmap,bmap,ierr)
37 
38  character(len=1),intent(in) :: cgrib(lcgrib)
39  integer,intent(in) :: lcgrib,ngpts
40  integer,intent(inout) :: iofst
41  integer,intent(out) :: ibmap
42  integer,intent(out) :: ierr
43  logical*1,pointer,dimension(:) :: bmap
44 
45  integer :: intbmap(ngpts)
46 
47  ierr=0
48  nullify(bmap)
49 
50  iofst=iofst+32 ! skip Length of Section
51  iofst=iofst+8 ! skip section number
52 
53  call g2_gbytec(cgrib,ibmap,iofst,8) ! Get bit-map indicator
54  iofst=iofst+8
55 
56  if (ibmap.eq.0) then ! Unpack bitmap
57  istat=0
58  if (ngpts.gt.0) allocate(bmap(ngpts),stat=istat)
59  if (istat.ne.0) then
60  ierr=6
61  nullify(bmap)
62  return
63  endif
64  call g2_gbytesc(cgrib,intbmap,iofst,1,0,ngpts)
65  iofst=iofst+ngpts
66  do j=1,ngpts
67  bmap(j)=.true.
68  if (intbmap(j).eq.0) bmap(j)=.false.
69  enddo
70 ! elseif (ibmap.eq.254) then ! Use previous bitmap
71 ! return
72 ! elseif (ibmap.eq.255) then ! No bitmap in message
73 ! bmap(1:ngpts)=.true.
74 ! else
75 ! print *,'gf_unpack6: Predefined bitmap ',ibmap,' not recognized.'
76 ! ierr=4
77  endif
78 
79  return ! End of Section 6 processing
80  end
81 
gf_unpack6
subroutine gf_unpack6(cgrib, lcgrib, iofst, ngpts, ibmap, bmap, ierr)
This subroutine unpacks Section 6 (Bit-Map Section) starting at octet 6 of that Section.
Definition: gf_unpack6.f:37
g2_gbytec
subroutine g2_gbytec(IN, IOUT, ISKIP, NBYTE)
This subrountine is to extract arbitrary size values from a packed bit string, right justifying each ...
Definition: g2_gbytesc.f:20
g2_gbytesc
subroutine g2_gbytesc(IN, IOUT, ISKIP, NBYTE, NSKIP, N)
This subrountine is to extract arbitrary size values from a packed bit string, right justifying each ...
Definition: g2_gbytesc.f:60