36 COMMON /maxcmp/ maxcmb,maxrow,maxcol,ncmsgs,ncsubs,ncbyts
38 CHARACTER*128 BORT_STR
54 LOGICAL FIRST,KMISS,EDGE4
58 SAVE first,ibyt,jbit,subset,edge4
68 CALL status(lunit,lun,il,im)
100 DO WHILE ( (.NOT.edge4) .AND. (ii.LE.
ns01v) )
101 IF( (
cmnem(ii).EQ.
'BEN') .AND. (
ivmnem(ii).GE.4) )
THEN
111 IF(lun.NE.
lunc)
GOTO 900
118 IF(
ncol.EQ.0)
GOTO 100
155 IF(
ityp(i).EQ.1.OR.
ityp(i).EQ.2)
THEN
157 ELSEIF(
ityp(i).EQ.3)
THEN
170 IF(
ncol.LE.0)
GOTO 902
172 IF(
ityp(i).EQ.1 .OR.
ityp(i).EQ.2)
THEN
186 IF(
matx(i,j).LT.imiss)
THEN
193 kmiss =
kmis(i).AND.
kmin(i).LT.imiss
194 range = real(max(1,
kmax(i)-
kmin(i)+1))
195 IF(
ityp(i).EQ.1.AND.range.GT.1)
THEN
210 ELSEIF(
ityp(i).EQ.2.AND.(range.GT.1..OR.kmiss))
THEN
217 kbit(i) = nint(log(range)*rln2)
234 ELSEIF(
ityp(i).EQ.3)
THEN
271 ibyt = (ldata+8-mod(ldata,8))/8
276 IF( (.NOT.edge4) .AND. (mod(ibyt,2).NE.0) ) ibyt = ibyt+1
283 IF(msgfull(ibyt,
kbyt,maxcmb))
THEN
296 ELSEIF(.NOT.
writ1)
THEN
318 IF(
ityp(i).EQ.1.OR.
ityp(i).EQ.2)
THEN
321 IF(
kbit(i).GT.0)
THEN
323 IF(
matx(i,j).LT.2_8**
iwid(i)-1)
THEN
331 ELSEIF(
ityp(i).EQ.3)
THEN
333 IF(
kbit(i).GT.0)
THEN
364 IF(mod(
ibit,8).NE.0)
GOTO 904
367 IF(nbyt.NE.lbyt)
GOTO 905
371 maxrow = max(maxrow,
nrow)
372 maxcol = max(maxcol,
ncol)
385 IF(.NOT.
flush)
GOTO 1
391 900
WRITE(bort_str,
'("BUFRLIB: WRCMPS - I/O STREAM INDEX FOR THIS '//
392 . .NE.
'CALL (",I3,") I/O STREAM INDEX FOR INITIAL CALL (",I3,")'//
393 .
' - UNIT NUMBER NOW IS",I4)') lun,
lunc,lunix
395 901
WRITE(bort_str,
'("BUFRLIB: WRCMPS - NO. OF ELEMENTS IN THE '//
396 . .GT.
'SUBSET (",I6,") THE NO. OF ROWS ALLOCATED FOR THE '//
397 .
'COMPRESSION MATRIX (",I6,")")')
nval(lun),
mxcdv
399 902
WRITE(bort_str,
'("BUFRLIB: WRCMPS - NO. OF COLUMNS CALCULATED '//
400 . .LE.
'FOR COMPRESSION MAXRIX IS 0 (=",I6,")")')
ncol
402 903
CALL bort(
'BUFRLIB: WRCMPS - MISSING DELAYED REPLICATION FACTOR')
403 904
CALL bort(
'BUFRLIB: WRCMPS - THE NUMBER OF BITS IN THE '//
404 .
'COMPRESSED BUFR MSG IS NOT A MULTIPLE OF 8 - MSG MUST END ON '//
405 .
' A BYTE BOUNDARY')
406 905
WRITE(bort_str,
'("BUFRLIB: WRCMPS - OUTPUT MESSAGE LENGTH FROM '//
407 .
'SECTION 0",I6," DOES NOT EQUAL FINAL PACKED MESSAGE LENGTH ("'//
408 .
',I6,")")') lbyt,nbyt
subroutine bort(STR)
Log one error message and abort application program.
subroutine cmsgini(LUN, MESG, SUBSET, IDATE, NSUB, NBYT)
This subroutine initializes a new BUFR message for output in compressed format.
recursive subroutine ipkm(CBAY, NBYT, N)
Encode an integer value within a character string.
recursive function iupbs01(MBAY, S01MNEM)
Read a data value from Section 0 or Section 1 of a BUFR message.
subroutine msgwrt(LUNIT, MESG, MGBYT)
Perform final checks and updates on a BUFR message before writing it to a specified Fortran logical u...
This module contains array and variable declarations used to store BUFR messages internally for multi...
integer, dimension(:), allocatable ibay
Current data subset.
integer ibit
Bit pointer within IBAY.
integer, dimension(:,:), allocatable mbay
Current BUFR message for each internal I/O stream.
This module contains arrays and variable declarations for the storage of data values needed when writ...
integer ncol
Number of data subsets in message.
integer(8) incr
Increment used when compressing non-character data values.
integer(8), dimension(:,:), allocatable matx
Non-character data values for all data subsets in message.
character *(:), dimension(:,:), allocatable catx
Character data values for all data subsets in message.
This module contains arrays and variable declarations for the storage of data values needed when writ...
character *(:), dimension(:), allocatable cstr
Character data value, if corresponding ityp value is set to 3.
integer(8), dimension(:), allocatable kmax
Maximum of each data value across all data subsets in message.
integer kbyt
Number of bytes required to store Sections 0, 1, 2, and 3 of message.
integer nrow
Number of data values for each data subset in message.
logical writ1
Write-out flag.
integer, dimension(:), allocatable ityp
Type of each data value:
integer, dimension(:), allocatable iwid
Bit width of underlying data descriptor as defined within Table B for each data value.
integer lunc
I/O stream index into internal arrays for output file.
integer(8), dimension(:), allocatable kmin
Minimum of each data value across all data subsets in message.
integer, dimension(:), allocatable kbit
Number of bits needed to hold the increments for this data value within each data subset of the messa...
logical, dimension(:), allocatable kmis
"Missing" values flag.
This module contains a declaration for an array used by various subroutines and functions to hold a t...
integer, dimension(:), allocatable mgwa
Temporary working copy of BUFR message.
This module contains declarations for arrays used to store information about the current BUFR message...
integer, dimension(:), allocatable inode
Table A mnemonic for type of BUFR message.
integer, dimension(:), allocatable idate
Section 1 date-time of message.
integer, dimension(:), allocatable nsub
Current subset pointer within message.
This module contains array and variable declarations used to store custom values for certain mnemonic...
integer, dimension(:), allocatable ivmnem
Custom values for use within Sections 0 and 1 of all future output BUFR messages written to all Fortr...
integer ns01v
Number of custom values stored.
character *8, dimension(:), allocatable cmnem
Section 0 and 1 mnemonics corresponding to ivmnem.
This module contains array and variable declarations used to store the internal jump/link table.
integer, dimension(:), allocatable ibt
Bit widths corresponding to tag and typ:
character *10, dimension(:), allocatable tag
Mnemonics in the jump/link table.
integer, dimension(:), allocatable itp
Integer type values corresponding to typ:
This module contains declarations for arrays used to store data values and associated metadata for th...
integer, dimension(:), allocatable nval
Number of data values in BUFR data subset.
integer, dimension(:,:), allocatable, target inv
Inventory pointer which links each data value to its corresponding node in the internal jump/link tab...
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)
Encode a character string within an integer array.
recursive subroutine status(LUNIT, LUN, IL, IM)
Check whether a specified Fortran logical unit number is currently connected to the NCEPLIBS-bufr sof...
subroutine up8(nval, nbits, ibay, ibit)
This subroutine decodes an 8-byte integer value from within a specified number of bits of an integer ...
subroutine upc(CHR, NCHR, IBAY, IBIT, CNVNULL)
Decode a character string from an integer array.
subroutine usrtpl(LUN, INVN, NBMP)
Store the subset template into internal arrays.
subroutine wrcmps(LUNIX)
This subroutine packs up the current subset within memory (array ibay in module moda_bitbuf),...