NCEPLIBS-g2  3.4.5
gf_unpack7.f
Go to the documentation of this file.
1 
5 
41 
42  subroutine gf_unpack7(cgrib,lcgrib,iofst,igdsnum,igdstmpl,
43  & idrsnum,idrstmpl,ndpts,fld,ierr)
44 
45  character(len=1),intent(in) :: cgrib(lcgrib)
46  integer,intent(in) :: lcgrib,ndpts,igdsnum,idrsnum
47  integer,intent(inout) :: iofst
48  integer,pointer,dimension(:) :: igdstmpl,idrstmpl
49  integer,intent(out) :: ierr
50  real,pointer,dimension(:) :: fld
51 
52 
53  ierr=0
54  nullify(fld)
55 
56  call g2_gbytec(cgrib,lensec,iofst,32) ! Get Length of Section
57  iofst=iofst+32
58  iofst=iofst+8 ! skip section number
59 
60  ipos=(iofst/8)+1
61  istat=0
62  allocate(fld(ndpts),stat=istat)
63  if (istat.ne.0) then
64  ierr=6
65  return
66  endif
67 
68  if (idrsnum.eq.0) then
69  call simunpack(cgrib(ipos),lensec-5,idrstmpl,ndpts,fld)
70  elseif (idrsnum.eq.2.or.idrsnum.eq.3) then
71  call comunpack(cgrib(ipos),lensec-5,lensec,idrsnum,idrstmpl,
72  & ndpts,fld,ier)
73  if ( ier .NE. 0 ) then
74  ierr=7
75  return
76  endif
77  elseif (idrsnum.eq.50) then ! Spectral simple
78  call simunpack(cgrib(ipos),lensec-5,idrstmpl,ndpts-1,
79  & fld(2))
80  ieee=idrstmpl(5)
81  call rdieee(ieee,fld(1),1)
82  elseif (idrsnum.eq.51) then ! Spectral complex
83  if (igdsnum.ge.50.AND.igdsnum.le.53) then
84  call specunpack(cgrib(ipos),lensec-5,idrstmpl,ndpts,
85  & igdstmpl(1),igdstmpl(2),igdstmpl(3),fld)
86  else
87  print *,'gf_unpack7: Cannot use GDT 3.',igdsnum,
88  & ' to unpack Data Section 5.51.'
89  ierr=5
90  nullify(fld)
91  return
92  endif
93 
94  elseif (idrsnum.eq.40 .OR. idrsnum.eq.40000) then
95  call jpcunpack(cgrib(ipos),lensec-5,idrstmpl,ndpts,fld)
96 
97 
98  elseif (idrsnum.eq.41 .OR. idrsnum.eq.40010) then
99  call pngunpack(cgrib(ipos),lensec-5,idrstmpl,ndpts,fld)
100 
101  else
102  print *,'gf_unpack7: Data Representation Template ',idrsnum,
103  & ' not yet implemented.'
104  ierr=4
105  nullify(fld)
106  return
107  endif
108 
109  iofst=iofst+(8*lensec)
110 
111  return ! End of Section 7 processing
112  end
rdieee
subroutine rdieee(rieee, a, num)
This subroutine reads a list of real values in 32-bit IEEE floating point format.
Definition: rdieee.f:16
gf_unpack7
subroutine gf_unpack7(cgrib, lcgrib, iofst, igdsnum, igdstmpl, idrsnum, idrstmpl, ndpts, fld, ierr)
This subroutine unpacks Section 7 (Data Section).
Definition: gf_unpack7.f:44
specunpack
subroutine specunpack(cpack, len, idrstmpl, ndpts, JJ, KK, MM, fld)
This subroutine unpacks a spectral data field that was packed using the complex packing algorithm for...
Definition: specunpack.f:24
jpcunpack
subroutine jpcunpack(cpack, len, idrstmpl, ndpts, fld)
This subroutine unpacks a data field that was packed into a JPEG2000 code stream using info from the ...
Definition: jpcunpack.f:21
comunpack
subroutine comunpack(cpack, len, lensec, idrsnum, idrstmpl, ndpts, fld, ier)
This subroutine unpacks a data field that was packed using a complex packing algorithm as defined in ...
Definition: comunpack.f:37
pngunpack
subroutine pngunpack(cpack, len, idrstmpl, ndpts, fld)
This subroutine unpacks a data field that was packed into a PNG image format using info from the GRIB...
Definition: pngunpack.f:22
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
simunpack
subroutine simunpack(cpack, len, idrstmpl, ndpts, fld)
This subroutine unpacks a data field that was packed using a simple packing algorithm as defined in t...
Definition: simunpack.f:21