This subroutine performs final checks and updates on a BUFR message before writing it to a specified Fortran logical unit.
These final checks and updates include:
- Standardizing the BUFR message, if requested via a previous call subroutine stdmsg()
- Converting the BUFR message from edition 3 to edition 4, if requested via a previous call to subroutine pkvs01()
- Storing any customized values into Section 0 or Section 1 of the BUFR message, if requested via one or more previous calls to subroutine pkvs01()
- Storing a tank receipt time into Section 1 of the BUFR message, if requested via a previous call to subroutine strcpt()
- For edition 3 BUFR messages, ensuring each section of the message contains an even number of bytes
- Storing '7777' into the last four bytes of the BUFR message, and storing the final message length in Section 0
- Appending zeroed-out bytes after the end of the BUFR message, up to the next machine word boundary
- Encapsulating the BUFR message with IEEE Fortran control words, if requested via a previous call to subroutine setblock()
- Storing a copy of the final message into internal arrays for possible later retrival via subroutine writsa()
- Author
- J. Woollen
- Date
- 1994-01-06
- Parameters
-
[in] | LUNIT | - integer: Fortran logical unit number for BUFR file |
[in] | MESG | - integer(*): BUFR message |
[in] | MGBYT | - integer: Size (in bytes) of BUFR message |
Program history log:
- 1994-01-06 J. Woollen – Original author
- 1997-07-29 J. Woollen – Modified to update the current BUFR version written in Section 0 from 2 to 3
- 1998-07-08 J. Woollen – Replaced call to Cray library routine ABORT with call to new internal routine bort()
- 1998-11-24 J. Woollen – Modified to zero out the padding bytes written at the end of Section 4
- 2000-09-19 J. Woollen – Maximum message length increased from 10,000 to 20,000 bytes
- 2003-11-04 J. Ator – Don't write to LUNIT if opened by openbf() using IO = 'NUL'
- 2003-11-04 S. Bender – Added remarks and routine interdependencies
- 2003-11-04 D. Keyser – Unified/portable for WRF; added history documentation; outputs more complete diagnostic info when routine terminates abnormally, unusual things happen or for informational purposes
- 2005-11-29 J. Ator – Use getlens(), iupbs01(), padmsg(), pkbs1() and nmwrd(); added logic to call pkbs1() and/or cnved4() when necessary
- 2009-03-23 J. Ator – Use idxmsg() and errwrt(); add call to atrcpt(); allow standardizing via COMMON /MSGSTD/ even if data is compressed; work on local copy of input message
- 2012-09-15 J. Woollen – Modified for C/I/O/BUFR interface; call new routine blocks() for file blocking and new C routine cwrbufr() to write BUFR message to disk file
- 2014-12-10 J. Ator – Use modules instead of COMMON blocks
- 2019-05-09 J. Ator – Added dimensions for MSGLEN and MSGTXT
Definition at line 69 of file msgwrt.f.
References atrcpt(), blocks(), bort(), cnved4(), cwrbufr(), errwrt(), getlens(), idxmsg(), iupbs01(), nmwrd(), padmsg(), pkb(), pkbs1(), pkc(), status(), and stndrd().
Referenced by closmg(), copybf(), copymg(), cpymem(), cpyupd(), msgupd(), wrcmps(), and wrdxtb().