NCEPLIBS-g2  3.4.8
gf_unpack1.F90
Go to the documentation of this file.
1 
5 
42 subroutine gf_unpack1(cgrib, lcgrib, iofst, ids, idslen, ierr)
43  implicit none
44 
45  character(len=1), intent(in) :: cgrib(lcgrib)
46  integer, intent(in) :: lcgrib
47  integer, intent(inout) :: iofst
48  integer, pointer, dimension(:) :: ids
49  integer, intent(out) :: ierr, idslen
50  integer, dimension(:) :: mapid(13)
51  integer :: i, istat, lensec, nbits
52 
53  data mapid /2, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1/
54 
55  ierr = 0
56  idslen = 13
57  nullify(ids)
58 
59  call g2_gbytec(cgrib, lensec, iofst, 32) ! Get Length of Section
60  iofst = iofst + 32
61  iofst = iofst + 8 ! skip section number
62 
63  ! Unpack each value into array ids from the the appropriate number
64  ! of octets, which are specified in corresponding entries in array
65  ! mapid.
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 end subroutine gf_unpack1
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_unpack1(cgrib, lcgrib, iofst, ids, idslen, ierr)
Unpack Section 1 (Identification Section) of a GRIB2 message, starting at octet 6 of that Section.
Definition: gf_unpack1.F90:43