35 subroutine getlocal(cgrib,lcgrib,localnum,csec2,lcsec2,ierr)
37 character(len=1),
intent(in) :: cgrib(lcgrib)
38 integer,
intent(in) :: lcgrib,localnum
39 character(len=1),
intent(out) :: csec2(*)
40 integer,
intent(out) :: lcsec2,ierr
42 character(len=4),
parameter :: grib=
'GRIB',c7777=
'7777'
43 character(len=4) :: ctemp
44 integer :: listsec0(2)
45 integer iofst,ibeg,istart,numlocal
52 if (localnum.le.0)
then
53 print *,
'getlocal: Request for local section must be positive.'
62 ctemp=cgrib(j)//cgrib(j+1)//cgrib(j+2)//cgrib(j+3)
63 if (ctemp.eq.grib )
then
69 print *,
'getlocal: Beginning characters GRIB not found.'
89 if (listsec0(2).ne.2)
then
90 print *,
'getlocal: can only decode GRIB edition 2.'
101 ctemp=cgrib(ipos)//cgrib(ipos+1)//cgrib(ipos+2)//cgrib(ipos+3)
102 if (ctemp.eq.c7777 )
then
105 if (ipos.ne.(istart+lengrib))
then
106 print *,
'getlocal: "7777" found, but not where expected.'
120 if (isecnum.eq.2)
then
122 if (numlocal.eq.localnum)
then
124 csec2(1:lcsec2)=cgrib(ipos+5:ipos+lensec-1)
131 if (ipos.gt.(istart+lengrib))
then
132 print *,
'getlocal: "7777" not found at end of GRIB message.'
143 print *,
'getlocal: GRIB message contained ',numlocal,
145 print *,
'getlocal: The request was for the ',localnum,