94 COMMON /maxcmp/ maxcmb,maxrow,maxcol,ncmsgs,ncsubs,ncbyts
96 CHARACTER*128 BORT_STR
112 LOGICAL FIRST,KMISS,EDGE4
116 SAVE first,ibyt,jbit,subset,edge4
126 CALL status(lunit,lun,il,im)
137 subset =
tag(inode(lun))
151 CALL cmsgini(lun,
mbay(1,lun),subset,idate(lun),ncol,kbyt)
158 DO WHILE ( (.NOT.edge4) .AND. (ii.LE.ns01v) )
159 IF( (cmnem(ii).EQ.
'BEN') .AND. (ivmnem(ii).GE.4) )
THEN
169 IF(lun.NE.lunc)
GOTO 900
176 IF(ncol.EQ.0)
GOTO 100
188 IF(ncol+1.GT.
mxcsb)
THEN
190 ELSEIF(nval(lun).NE.nrow)
THEN
194 ELSEIF(nval(lun).GT.
mxcdv)
THEN
213 IF(ityp(i).EQ.1.OR.ityp(i).EQ.2)
THEN
214 CALL up8(matx(i,ncol),
ibt(node),ibay,ibit)
215 ELSEIF(ityp(i).EQ.3)
THEN
216 CALL upc(catx(i,ncol),
ibt(node)/8,ibay,ibit,.true.)
228 IF(ncol.LE.0)
GOTO 902
230 IF(ityp(i).EQ.1 .OR. ityp(i).EQ.2)
THEN
244 IF(matx(i,j).LT.imiss)
THEN
245 kmin(i) = min(kmin(i),matx(i,j))
246 kmax(i) = max(kmax(i),matx(i,j))
251 kmiss = kmis(i).AND.kmin(i).LT.imiss
252 range = max(1,kmax(i)-kmin(i)+1)
253 IF(ityp(i).EQ.1.AND.range.GT.1)
THEN
268 ELSEIF(ityp(i).EQ.2.AND.(range.GT.1..OR.kmiss))
THEN
275 kbit(i) = nint(log(range)*rln2)
276 IF(2**kbit(i)-1.LE.range) kbit(i) = kbit(i)+1
282 IF(kbit(i).GT.iwid(i)) kbit(i) = iwid(i)
291 ldata = ldata + iwid(i) + 6 + ncol*kbit(i)
292 ELSEIF(ityp(i).EQ.3)
THEN
304 IF ( (.NOT.kmis(i)) .AND. (cstr(i).NE.catx(i,j)) )
THEN
322 ldata = ldata + iwid(i) + 6 + ncol*kbit(i)
329 ibyt = (ldata+8-mod(ldata,8))/8
334 IF( (.NOT.edge4) .AND. (mod(ibyt,2).NE.0) ) ibyt = ibyt+1
341 IF(msgfull(ibyt,kbyt,maxcmb))
THEN
354 ELSEIF(.NOT.writ1)
THEN
370 50
CALL cmsgini(lun,mgwa,subset,idate(lun),ncol,ibyt)
376 IF(ityp(i).EQ.1.OR.ityp(i).EQ.2)
THEN
377 CALL pkb8(kmin(i),iwid(i),mgwa,ibit)
378 CALL pkb(kbit(i), 6,mgwa,ibit)
379 IF(kbit(i).GT.0)
THEN
381 IF(matx(i,j).LT.2_8**iwid(i)-1)
THEN
382 incr = matx(i,j)-kmin(i)
384 incr = 2_8**kbit(i)-1
386 CALL pkb8(incr,kbit(i),mgwa,ibit)
389 ELSEIF(ityp(i).EQ.3)
THEN
391 IF(kbit(i).GT.0)
THEN
394 CALL pkc(czero,1,mgwa,ibit)
396 CALL pkb(nchr, 6,mgwa,ibit)
398 CALL pkc(catx(i,j),nchr,mgwa,ibit)
401 CALL pkc(cstr(i),nchr,mgwa,ibit)
402 CALL pkb( 0, 6,mgwa,ibit)
413 CALL pkb( 0,jbit,mgwa,ibit)
417 CALL pkc(
'7777', 4,mgwa,ibit)
422 IF(mod(ibit,8).NE.0)
GOTO 904
425 IF(nbyt.NE.lbyt)
GOTO 905
427 CALL msgwrt(lunit,mgwa,nbyt)
429 maxrow = max(maxrow,nrow)
430 maxcol = max(maxcol,ncol)
443 IF(.NOT.flush)
GOTO 1
449900
WRITE(bort_str,
'("BUFRLIB: WRCMPS - I/O STREAM INDEX FOR THIS '//
450 . .NE.
'CALL (",I3,") I/O STREAM INDEX FOR INITIAL CALL (",I3,")'//
451 .
' - UNIT NUMBER NOW IS",I4)') lun,lunc,lunix
453901
WRITE(bort_str,
'("BUFRLIB: WRCMPS - NO. OF ELEMENTS IN THE '//
454 . .GT.
'SUBSET (",I6,") THE NO. OF ROWS ALLOCATED FOR THE '//
455 .
'COMPRESSION MATRIX (",I6,")")') nval(lun),
mxcdv
457902
WRITE(bort_str,
'("BUFRLIB: WRCMPS - NO. OF COLUMNS CALCULATED '//
458 . .LE.
'FOR COMPRESSION MAXRIX IS 0 (=",I6,")")') ncol
460903
CALL bort(
'BUFRLIB: WRCMPS - MISSING DELAYED REPLICATION FACTOR')
461904
CALL bort(
'BUFRLIB: WRCMPS - THE NUMBER OF BITS IN THE '//
462 .
'COMPRESSED BUFR MSG IS NOT A MULTIPLE OF 8 - MSG MUST END ON '//
463 .
' A BYTE BOUNDARY')
464905
WRITE(bort_str,
'("BUFRLIB: WRCMPS - OUTPUT MESSAGE LENGTH FROM '//
465 .
'SECTION 0",I6," DOES NOT EQUAL FINAL PACKED MESSAGE LENGTH ("'//
466 .
',I6,")")') lbyt,nbyt
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
subroutine cmsgini(LUN, MESG, SUBSET, IDATE, NSUB, NBYT)
THIS SUBROUTINE INITIALIZES A NEW BUFR MESSAGE FOR OUTPUT IN COMPRESSED BUFR.
subroutine ipkm(CBAY, NBYT, N)
This subroutine encodes an integer value within a specified number of bytes of a character string,...
function iupbs01(MBAY, S01MNEM)
This function returns a specified value from within Section 0 or Section 1 of a BUFR message.
subroutine msgwrt(LUNIT, MESG, MGBYT)
This subroutine performs final checks and updates on a BUFR message before writing it to a specified ...
This module contains array and variable declarations used to store BUFR messages internally for multi...
integer, dimension(:,:), allocatable mbay
Current BUFR message for each internal I/O stream.
This module contains array and variable declarations used to store the internal jump/link table.
integer, dimension(:), allocatable itp
Integer type values corresponding to typ:
integer, dimension(:), allocatable ibt
Bit widths corresponding to tag and typ:
character *10, dimension(:), allocatable tag
Mnemonics in the jump/link table.
This module declares and initializes the MXCDV variable.
integer mxcdv
Maximum number of data values that can be written into a data subset of a compressed BUFR message by ...
This module declares and initializes the MXCSB variable.
integer mxcsb
Maximum number of data subsets that can be written into a compressed BUFR message by the BUFRLIB soft...
subroutine pkb8(nval, nbits, ibay, ibit)
This subroutine encodes an 8-byte integer value within a specified number of bits of an integer array...
subroutine pkb(NVAL, NBITS, IBAY, IBIT)
This subroutine encodes an integer value within a specified number of bits of an integer array,...
subroutine pkc(CHR, NCHR, IBAY, IBIT)
This subroutine encodes a character string within a specified number of bits of an integer array,...
subroutine status(LUNIT, LUN, IL, IM)
This subroutine checks whether a specified Fortran logical unit number is currently connected to the ...
subroutine up8(nval, nbits, ibay, ibit)
THIS SUBROUTINE UNPACKS AND RETURNS AN 8-BYTE INTEGER CONTAINED WITHIN NBITS BITS OF IBAY,...
subroutine upc(CHR, NCHR, IBAY, IBIT, CNVNULL)
THIS SUBROUTINE UNPACKS AND RETURNS A CHARACTER STRING OF LENGTH NCHR CONTAINED WITHIN NCHR BYTES OF ...
subroutine usrtpl(LUN, INVN, NBMP)
THIS SUBROUTINE STORES THE SUBSET TEMPLATE INTO INTERNAL SUBSET ARRAYS IN MODULE USRINT FOR CASES OF ...
subroutine wrcmps(LUNIX)
THIS SUBROUTINE PACKS UP THE CURRENT SUBSET WITHIN MEMORY (ARRAY IBAY IN MODULE BITBUF),...