NCEPLIBS-bufr  12.1.0
compress.F90 File Reference

Read or write compressed BUFR messages. More...

Go to the source code of this file.

Functions/Subroutines

subroutine cmpmsg (cf)
 Specify whether BUFR messages output by future calls to message-writing subroutines and subset-writing subroutines are to be compressed. More...
 
subroutine cmsgini (lun, mesg, subset, idate, nsub, nbyt)
 Initialize a new BUFR message for output in compressed format. More...
 
subroutine rdcmps (lun)
 Read the next compressed BUFR data subset into internal arrays. More...
 
subroutine wrcmps (lunix)
 Write a compressed BUFR data subset. More...
 
recursive subroutine writcp (lunit)
 Write a data subset into a BUFR message using compression. More...
 

Detailed Description

Read or write compressed BUFR messages.

Author
J. Ator J. Woollen
Date
2005-03-09

Definition in file compress.F90.

Function/Subroutine Documentation

◆ cmpmsg()

subroutine cmpmsg ( character, intent(in)  cf)

Specify whether BUFR messages output by future calls to message-writing subroutines and subset-writing subroutines are to be compressed.

The specified value for cf will remain in effect for all future calls to message-writing subroutines and subset-writing subroutines for all Fortran logical units that are open for output within the application program, unless a subsequent call is made to this subroutine to reset the value of cf again. If this subroutine is never called, a default value of 'N' is used for cf.

When compression is activated, it is implemented using the algorithm for data subset compression prescribed within the official WMO BUFR regulations. Compression is most useful when the data subsets to be compressed are devoid of any delayed replication, and when there is minimal variation of corresponding data values among different data subsets within the same BUFR message. Otherwise, compression may provide little to no benefit, and which is why it is not activated by default.

Parameters
cf- Flag indicating whether future BUFR output messages are to be compressed:
  • 'N' = No (the default)
  • 'Y' = Yes
Author
J. Ator
Date
2005-03-09

Definition at line 32 of file compress.F90.

References bort(), capit(), and moda_msgcmp::ccmf.

Referenced by bufr_c2f_interface::bvers_c(), copysb(), and writcp().

◆ cmsgini()

subroutine cmsgini ( integer, intent(in)  lun,
integer, dimension(*), intent(out)  mesg,
character*8, intent(in)  subset,
integer, intent(in)  idate,
integer, intent(in)  nsub,
integer, intent(inout)  nbyt 
)

Initialize a new BUFR message for output in compressed format.

Parameters
lun- File ID
mesg- BUFR message
subset- Table A mnemonic for type of BUFR message being written
idate- Date-time stored within Section 1 of BUFR message being written, in format of either YYMMDDHH or YYYYMMDDHH, depending on datelen() value
nsub- Number of subsets in mesg
nbyt- Message length:
  • On input, contains the length (in bytes) of Section 4, except for the first 4 bytes
  • On output, contains the length (in bytes) of the entire BUFR message, up to the point in Section 4 where compressed data are to be written
Author
Woollen
Date
2002-05-14

Definition at line 258 of file compress.F90.

References bort(), nemtab(), nemtba(), pkb(), and pkc().

Referenced by wrcmps().

◆ rdcmps()

subroutine rdcmps ( integer, intent(in)  lun)

Read the next compressed BUFR data subset into internal arrays.

Uncompress and unpack the next subset from the internal compressed message buffer (array mbay in module moda_bitbuf) and store the result within the internal array val(*,lun) in module moda_usrint.

Parameters
lun- File ID
Author
Woollen
Date
2000-09-19

Definition at line 109 of file compress.F90.

References bort(), moda_rlccmn::crtag, moda_bitbuf::ibit, moda_tables::ibt, moda_usrint::inv, moda_rlccmn::irbit, moda_rlccmn::irnch, moda_stcode::iscodes, moda_tables::itp, moda_bitbuf::mbay, moda_bitbuf::mbyt, moda_msgcwd::msub, moda_usrint::nrfelm, moda_rlccmn::nrst, moda_msgcwd::nsub, moda_usrint::nval, strbtm(), moda_tables::tag, up8(), upb(), upc(), ups(), usrtpl(), and moda_usrint::val.

Referenced by readsb().

◆ wrcmps()

subroutine wrcmps ( integer, intent(in)  lunix)

Write a compressed BUFR data subset.

Pack up the current subset within memory (array ibay in module moda_bitbuf), storing it for compression. Then, try to add it to the compressed BUFR message that is currently open within memory for abs(lunix). If the subset will not fit into the currently open message, then that compressed message is flushed to lunix and a new one is created in order to hold the current subset (still stored for compression).

This subroutine performs functions similar to NCEPLIBS-bufr subroutine msgupd() except that it acts on compressed bufr messages.

Parameters
lunix- Absolute value is Fortran logical unit number for BUFR file
  • if lunix is less than zero, then this is a "flush" call and the buffer must be cleared out
Author
Woollen
Date
2002-05-14

Definition at line 386 of file compress.F90.

References bort(), moda_comprs::catx, moda_s01cm::cmnem, cmsgini(), moda_comprx::cstr, moda_comprx::flush, moda_bitbuf::ibay, moda_bitbuf::ibit, moda_tables::ibt, moda_msgcwd::idate, moda_comprx::imiss, moda_comprs::incr, moda_msgcwd::inode, moda_usrint::inv, ipkm(), moda_tables::itp, moda_comprx::ityp, moda_s01cm::ivmnem, moda_comprx::iwid, moda_comprx::jlnode, moda_comprx::kbit, moda_comprx::kbyt, moda_comprx::kmax, moda_comprx::kmin, moda_comprx::kmis, moda_comprx::lunc, moda_comprs::matx, moda_bitbuf::maxbyt, moda_bitbuf::mbay, moda_mgwa::mgwa, msgwrt(), moda_comprs::ncol, moda_comprx::nrow, moda_s01cm::ns01v, moda_msgcwd::nsub, moda_usrint::nval, pkb(), pkb8(), pkc(), status(), moda_tables::tag, up8(), upc(), usrtpl(), and moda_comprx::writ1.

Referenced by closmg(), writsa(), and writsb().

◆ writcp()

recursive subroutine writcp ( integer, intent(in)  lunit)

Write a data subset into a BUFR message using compression.

This subroutine is similar to subroutine writsb(), except that when the subset is encoded and packed into the current message for the BUFR file associated with logical unit lunit, it is packed using compression as prescribed within the official WMO BUFR regulations.

This subroutine activates compression via an internal call to subroutine cmpmsg(), followed by an internal call to subroutine writsb(), followed by a second internal call to subroutine cmpmsg() to deactivate compression. For this reason, most application programs which write compressed BUFR messages now call subroutines cmpmsg() and writsb() directly; however, this subroutine is still supported within the NCEPLIBS-bufr software for backwards-compatibility with certain legacy application programs.

Parameters
lunit- Fortran logical unit number for BUFR file
Author
J. Woollen
Date
2002-05-14

Definition at line 71 of file compress.F90.

References cmpmsg(), writsb(), and x84().