NCEPLIBS-g2  3.4.5
gf_unpack1.f
Go to the documentation of this file.
1 
6 
41 
42  subroutine gf_unpack1(cgrib,lcgrib,iofst,ids,idslen,ierr)
43 
44  character(len=1),intent(in) :: cgrib(lcgrib)
45  integer,intent(in) :: lcgrib
46  integer,intent(inout) :: iofst
47  integer,pointer,dimension(:) :: ids
48  integer,intent(out) :: ierr,idslen
49 
50  integer,dimension(:) :: mapid(13)
51 
52  data mapid /2,2,1,1,1,2,1,1,1,1,1,1,1/
53 
54  ierr=0
55  idslen=13
56  nullify(ids)
57 
58  call g2_gbytec(cgrib,lensec,iofst,32) ! Get Length of Section
59  iofst=iofst+32
60  iofst=iofst+8 ! skip section number
61  !
62  ! Unpack each value into array ids from the
63  ! the appropriate number of octets, which are specified in
64  ! corresponding entries in array mapid.
65  !
66  istat=0
67  allocate(ids(idslen),stat=istat)
68  if (istat.ne.0) then
69  ierr=6
70  nullify(ids)
71  return
72  endif
73 
74  do i=1,idslen
75  nbits=mapid(i)*8
76  call g2_gbytec(cgrib,ids(i),iofst,nbits)
77  iofst=iofst+nbits
78  enddo
79 
80  return ! End of Section 1 processing
81  end
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
gf_unpack1
subroutine gf_unpack1(cgrib, lcgrib, iofst, ids, idslen, ierr)
This subroutine unpacks Section 1 (Identification Section) starting at octet 6 of that Section.
Definition: gf_unpack1.f:43