29 subroutine addlocal(cgrib, lcgrib, csec2, lcsec2, ierr)
32 character(len = 1),
intent(inout) :: cgrib(lcgrib)
33 character(len = 1),
intent(in) :: csec2(lcsec2)
34 integer,
intent(in) :: lcgrib, lcsec2
35 integer,
intent(out) :: ierr
37 character(len = 4),
parameter :: grib =
'GRIB', c7777 =
'7777'
38 character(len = 4):: ctemp
39 integer,
parameter :: two = 2
40 integer :: lensec2, iofst, ibeg, lencurr, len
41 integer :: ilen, isecnum, istart
46 ctemp = cgrib(1) // cgrib(2) // cgrib(3) // cgrib(4)
47 if (ctemp .ne. grib)
then
48 print *,
'addlocal: GRIB not found in given message.'
49 print *,
'addlocal: Call to routine gribcreate required', &
50 ' to initialize GRIB messge.'
59 ctemp = cgrib(lencurr - 3) // cgrib(lencurr - 2) // cgrib(lencurr - 1) // cgrib(lencurr)
60 if (ctemp .eq. c7777)
then
61 print *,
'addlocal: GRIB message already complete. Cannot add new section.'
77 if (len .eq. lencurr)
exit
81 if (len .gt. lencurr)
then
82 print *,
'addlocal: Section byte counts don''t add to total.'
83 print *,
'addlocal: Sum of section byte counts = ', len
84 print *,
'addlocal: Total byte count in Section 0 = ', lencurr
91 if ((isecnum .ne. 1) .and. (isecnum .ne. 7))
then
92 print *,
'addlocal: Section 2 can only be added after Section 1 or Section 7.'
93 print *,
'addlocal: Section ', isecnum,
' was the last found in given GRIB message.'
103 cgrib(istart + 1:istart + lcsec2) = csec2(1:lcsec2)
111 call g2_sbytec(cgrib, lencurr+lensec2, 96, 32)
subroutine addlocal(cgrib, lcgrib, csec2, lcsec2, ierr)
Add a Local Use Section (Section 2) to a GRIB2 message.
subroutine g2_gbytec(in, iout, iskip, nbits)
Extract arbitrary size values from a packed bit string, right justifying each value in the unpacked a...
subroutine g2_sbytec(out, in, iskip, nbits)
Put arbitrary size values into a packed bit string, taking the low order bits from each value in the ...