NCEPLIBS-g2  3.4.5
gf_unpack2.f
Go to the documentation of this file.
1 
5 
20 
21  subroutine gf_unpack2(cgrib,lcgrib,iofst,lencsec2,csec2,ierr)
22 
23  character(len=1),intent(in) :: cgrib(lcgrib)
24  integer,intent(in) :: lcgrib
25  integer,intent(inout) :: iofst
26  integer,intent(out) :: lencsec2
27  integer,intent(out) :: ierr
28  character(len=1),pointer,dimension(:) :: csec2
29 
30  ierr=0
31  lencsec2=0
32  nullify(csec2)
33 
34  call g2_gbytec(cgrib,lensec,iofst,32) ! Get Length of Section
35  iofst=iofst+32
36  lencsec2=lensec-5
37  call g2_gbytec(cgrib,isecnum,iofst,8) ! Get Section Number
38  iofst=iofst+8
39  ipos=(iofst/8)+1
40 
41  if ( isecnum.ne.2 ) then
42  ierr=6
43  print *,'gf_unpack2: Not Section 2 data. '
44  return
45  endif
46 
47  allocate(csec2(lencsec2),stat=istat)
48  if (istat.ne.0) then
49  ierr=6
50  nullify(csec2)
51  return
52  endif
53 
54  csec2(1:lencsec2)=cgrib(ipos:ipos+lencsec2-1)
55  iofst=iofst+(lencsec2*8)
56 
57  return ! End of Section 2 processing
58  end
59 
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_unpack2
subroutine gf_unpack2(cgrib, lcgrib, iofst, lencsec2, csec2, ierr)
This subroutine unpacks Section 2 (Local Use Section) as defined in GRIB Edition 2.
Definition: gf_unpack2.f:22