NCEPLIBS-bufr  12.1.0
blocks.F90 File Reference

Block BUFR messages with IEEE Fortran control words. More...

Go to the source code of this file.

Functions/Subroutines

subroutine blocks (mbay, mwrd)
 Encapsulate a BUFR message with IEEE Fortran control words as specified via the most recent call to subroutine setblock(). More...
 
recursive subroutine setblock (iblk)
 Specify whether BUFR messages output by future calls to message-writing subroutines should be encapsulated with IEEE Fortran control words when being written to output files. More...
 

Detailed Description

Block BUFR messages with IEEE Fortran control words.

Author
J. Woollen
Date
2012-09-15

Definition in file blocks.F90.

Function/Subroutine Documentation

◆ blocks()

subroutine blocks ( integer, dimension(*), intent(inout)  mbay,
integer, intent(inout)  mwrd 
)

Encapsulate a BUFR message with IEEE Fortran control words as specified via the most recent call to subroutine setblock().

A previous call to subroutine setblock() is required in order to activate encapsulation with control words, and to specify whether the control words should be encoded using big-endian or little-endian byte ordering. In such cases, the input parameter mbay is then modified to add the specified control words to the existing BUFR message whenever this subroutine is called, and mwrd is also modified accordingly.

Alternatively, if subroutine setblock() was never previously called, or if no encapsulation was specified during the most recent call to subroutine setblock(), then this subroutine simply returns without modifying either of its input parameters.

Parameters
mbay- BUFR message, possibly with added control words on output
mwrd- Size (in integers) of contents of mbay
Remarks
  • For more information about IEEE Fortran control words, as well as their historical use within the NCEPLIBS-bufr software, see the documentation for subroutine setblock().
  • Whenever a BUFR message in mbay is to be encapsulated with control words, the user must ensure the availability of sufficient extra space when allocating mbay within the application program.
Author
J. Woollen
Date
2012-09-15

Definition at line 36 of file blocks.F90.

Referenced by msgwrt().

◆ setblock()

recursive subroutine setblock ( integer, intent(in)  iblk)

Specify whether BUFR messages output by future calls to message-writing subroutines should be encapsulated with IEEE Fortran control words when being written to output files.

If control words are requested, then one 4-byte control word is written to the output file prior to the start of each BUFR message, and a second 4-byte control word is written to the output file after the end of each BUFR message. Each of these control words contains the byte count for the enclosed BUFR message, and they can be written using either big-endian or little-endian byte ordering, regardless of the native endianness of the local machine.

This subroutine can be called at any time after the first call to subroutine openbf(), and the specified value for iblk will remain in effect for all future calls to message-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 iblk again. If this subroutine is never called, a default value of 0 is used for iblk, as set within subroutine bfrini().

Remarks
  • This subroutine can be used to generate BUFR files consistent with historical archives, dating back to older versions of the NCEPLIBS-bufr software which used Fortran to directly read/write BUFR messages from/to files. Standard Fortran historically didn't have a way to read/write binary data streams without control words, so as a result many historical archives contain these by default. However, newer versions of the NCEPLIBS-bufr software use C to directly read/write BUFR messages from/to files (including historical archives), so control words are no longer necessary and are therefore now disabled by default when writing BUFR messages to output files.
Parameters
iblk- Flag indicating whether future BUFR output messages should be encapsulated with control words:
  • -1 = Yes, using little-endian control words
  • 0 = No (the default)
  • 1 = Yes, using big-endian control words
Author
J. Woollen
Date
2012-09-15

Definition at line 129 of file blocks.F90.

References x84().