69 subroutine gribinfo(cgrib,lcgrib,listsec0,listsec1,
70 & numlocal,numfields,maxvals,ierr)
72 character(len=1),
intent(in) :: cgrib(lcgrib)
73 integer,
intent(in) :: lcgrib
74 integer,
intent(out) :: listsec0(3),listsec1(13),maxvals(7)
75 integer,
intent(out) :: numlocal,numfields,ierr
77 character(len=4),
parameter :: grib=
'GRIB',c7777=
'7777'
78 character(len=4) :: ctemp
79 integer,
parameter :: zero=0,one=1
80 integer,
parameter :: mapsec1len=13
82 & mapsec1(mapsec1len)=(/ 2,2,1,1,1,2,1,1,1,1,1,1,1 /)
83 integer iofst,ibeg,istart
100 ctemp=cgrib(j)//cgrib(j+1)//cgrib(j+2)//cgrib(j+3)
101 if (ctemp.eq.grib )
then
106 if (istart.eq.0)
then
107 print *,
'gribinfo: Beginning characters GRIB not found.'
115 call g2_gbytec(cgrib,listsec0(1),iofst,8)
117 call g2_gbytec(cgrib,listsec0(2),iofst,8)
128 if (listsec0(2).ne.2)
then
129 print *,
'gribinfo: can only decode GRIB edition 2.'
140 if (isecnum.ne.1)
then
141 print *,
'gribinfo: Could not find section 1.'
152 call g2_gbytec(cgrib,listsec1(i),iofst,nbits)
162 ctemp=cgrib(ipos)//cgrib(ipos+1)//cgrib(ipos+2)//cgrib(ipos+3)
163 if (ctemp.eq.c7777 )
then
165 if (ipos.ne.(istart+lengrib))
then
166 print *,
'gribinfo: "7777" found, but not where expected.'
178 if (ipos.gt.(istart+lengrib))
then
179 print *,
'gribinfo: "7777" not found at end of GRIB message.'
183 if (isecnum.eq.2)
then
188 if ( lenposs.gt.maxsec2len ) maxsec2len=lenposs
189 elseif (isecnum.eq.3)
then
195 if (ngdpts.gt.maxgridpts) maxgridpts=ngdpts
197 if ( lenposs.gt.maxgdstmpl ) maxgdstmpl=lenposs
199 lenposs=lenposs/nbyte
200 if ( lenposs.gt.maxdeflist ) maxdeflist=lenposs
202 elseif (isecnum.eq.4)
then
203 numfields=numfields+1
206 if (numcoord.ne.0)
then
207 if (numcoord.gt.maxcoordlist) maxcoordlist=numcoord
210 if ( lenposs.gt.maxpdstmpl ) maxpdstmpl=lenposs
211 elseif (isecnum.eq.5)
then
213 if ( lenposs.gt.maxdrstmpl ) maxdrstmpl=lenposs
218 maxvals(1)=maxsec2len
219 maxvals(2)=maxgdstmpl
220 maxvals(3)=maxdeflist
221 maxvals(4)=maxpdstmpl
222 maxvals(5)=maxcoordlist
223 maxvals(6)=maxdrstmpl
224 maxvals(7)=maxgridpts