NCEPLIBS-bufr  12.1.0
memmsgs.F90 File Reference

Read and process BUFR messages within internal memory arrays. More...

Go to the source code of this file.

Functions/Subroutines

subroutine cpdxmm (lunit)
 Read an entire DX BUFR table from a specified file into internal memory arrays. More...
 
recursive integer function ireadmm (imsg, subset, idate)
 Call subroutine readmm() and pass back its return code as the function value. More...
 
recursive subroutine rdmemm (imsg, subset, jdate, iret)
 Read a specified BUFR message from internal arrays in memory, so that it is now in scope for processing via a subsequent call to subroutine rdmems(). More...
 
recursive subroutine rdmems (isub, iret)
 Read a specified data subset from the BUFR message that was most recently read via a call to subroutine rdmemm() or readmm(). More...
 
recursive subroutine readmm (imsg, subset, jdate, iret)
 Read a specified BUFR message from internal arrays in memory, so that it is now in scope for processing via a subsequent call to subroutine rdmems(). More...
 
recursive subroutine ufbmem (lunit, inew, iret, iunit)
 Connect a new file to the NCEPLIBS-bufr software for input operations, then read the entire file contents into internal arrays so that any of the individual BUFR messages can later be accessed from memory, instead of having to read them one at a time sequentially from the file. More...
 
recursive subroutine ufbmex (lunit, lundx, inew, iret, mesg)
 Connect a new file to the NCEPLIBS-bufr software for input operations, then read the entire file contents into internal arrays so that any of the individual BUFR messages can later be accessed from memory, instead of having to read them one at a time sequentially from the file. More...
 
recursive subroutine ufbmms (imsg, isub, subset, jdate)
 Read a specified data subset from internal arrays. More...
 
recursive subroutine ufbmns (irep, subset, idate)
 Read a specified data subset from internal arrays in memory, so that it is now in scope for processing via calls to any of the values-reading subroutines using the Fortran logical unit number iunit that was returned from the most recent call to subroutine ufbmem(). More...
 
recursive subroutine ufbrms (imsg, isub, usr, i1, i2, iret, str)
 Read one or more data values from a data subset in internal arrays. More...
 
recursive subroutine ufbtam (tab, i1, i2, iret, str)
 Read through every data subset in internal arrays and return one or more specified data values from each subset. More...
 

Detailed Description

Read and process BUFR messages within internal memory arrays.

Author
J. Woollen
Date
1994-01-06

Definition in file memmsgs.F90.

Function/Subroutine Documentation

◆ cpdxmm()

subroutine cpdxmm ( integer, intent(in)  lunit)

Read an entire DX BUFR table from a specified file into internal memory arrays.

Parameters
lunit- Fortran logical unit number for BUFR file
Author
J. Ator
Date
2009-03-23

Definition at line 729 of file memmsgs.F90.

References bort(), errwrt(), moda_msgmem::icdxts, moda_msgmem::ifdxts, moda_msgmem::ipdxm, moda_msgmem::ipmsgs, moda_msgmem::ldxm, moda_msgmem::mdx, moda_mgwa::mgwa, moda_msgmem::msgp, moda_msgmem::mxdxm, moda_msgmem::mxdxw, moda_msgmem::ndxm, moda_msgmem::ndxts, rdmsgw(), and status().

Referenced by ufbmem().

◆ ireadmm()

recursive integer function ireadmm ( integer, intent(inout)  imsg,
character*8, intent(out)  subset,
integer, intent(out)  idate 
)

Call subroutine readmm() and pass back its return code as the function value.

The use of this function allows the return code from readmm() to be used as the target variable within an iterative program loop.

Parameters
imsg- Message pointer within internal arrays:
  • On input, imsg is the number of the BUFR message to be read into scope for further processing, counting from the beginning of the internal arrays in memory
    • On output, imsg is incremented by one from its input value
subset- Table A mnemonic for type of BUFR message that was read into scope (see DX BUFR Tables for further information about Table A mnemonics)
idate- Date-time stored within Section 1 of BUFR message that was read into scope, in format of either YYMMDDHH or YYYYMMDDHH, depending on the most recent call to subroutine datelen()
Returns
ireadmm - return code:
  • 0 new BUFR message was successfully read into scope
  • -1 requested message number could not be found in internal arrays
Author
J. Woollen
Date
1999-11-18

Definition at line 433 of file memmsgs.F90.

References readmm(), x48(), and x84().

Referenced by ufbmns().

◆ rdmemm()

recursive subroutine rdmemm ( integer, intent(in)  imsg,
character*8, intent(out)  subset,
integer, intent(out)  jdate,
integer, intent(out)  iret 
)

Read a specified BUFR message from internal arrays in memory, so that it is now in scope for processing via a subsequent call to subroutine rdmems().

BUFR messages should already be stored within internal arrays in memory via one or more previous calls to subroutine ufbmem().

This subroutine is similar to subroutine readmm(), except that readmm() also increments the value of imsg prior to returning to the calling program, which in turn allows it to be easily called within an iterative program loop.

Parameters
imsg- Number of BUFR message to be read into scope for further processing, counting from the beginning of the internal arrays in memory
subset- Table A mnemonic for type of BUFR message that was read into scope (see DX BUFR Tables for further information about Table A mnemonics)
jdate- Date-time stored within Section 1 of BUFR message that was read into scope, in format of either YYMMDDHH or YYYYMMDDHH, depending on the most recent call to subroutine datelen()
iret- return code:
  • 0 = requested message was successfully read into scope
  • -1 = requested message number could not be found in internal arrays
Author
J. Woollen
Date
1994-01-06

Definition at line 486 of file memmsgs.F90.

References bort(), cktaba(), dxinit(), errwrt(), moda_msgmem::icdxts, moda_msgmem::ifdxts, moda_msgmem::ipdxm, moda_msgmem::ipmsgs, moda_msgmem::ldxm, moda_msgmem::ldxts, makestab(), moda_bitbuf::mbay, moda_msgmem::mdx, moda_mgwa::mgwa, moda_msgmem::mlast, moda_msgmem::msgp, moda_msgmem::msgs, moda_msgmem::munit, moda_msgmem::ndxm, moda_msgmem::ndxts, moda_msgcwd::nmsg, status(), stbfdx(), wtstat(), x48(), and x84().

Referenced by readmm(), ufbmms(), ufbrms(), and ufbtam().

◆ rdmems()

recursive subroutine rdmems ( integer, intent(in)  isub,
integer, intent(out)  iret 
)

Read a specified data subset from the BUFR message that was most recently read via a call to subroutine rdmemm() or readmm().

Whenever this subroutine returns with iret = 0, this indicates that a new BUFR data subset (i.e. report) was successfully read into internal arrays within the NCEPLIBS-bufr software, and from where it can now be easily manipulated or further parsed via calls to any of the values-reading subroutines using the Fortran logical unit number IUNIT that was returned from the most recent call to subroutine ufbmem().

Parameters
isub- Number of data subset to be read from BUFR message, counting from the beginning of the message
iret- return code:
  • 0 = requested data subset was successfully read
  • -1 = requested subset number could not be found in the message
Author
J. Woollen
Date
1994-01-06

Definition at line 634 of file memmsgs.F90.

References bort(), errwrt(), iupb(), moda_bitbuf::mbay, moda_bitbuf::mbyt, moda_unptyp::msgunp, moda_msgcwd::msub, moda_msgmem::munit, moda_msgcwd::nsub, readsb(), status(), x48(), and x84().

Referenced by ufbmms(), ufbmns(), and ufbrms().

◆ readmm()

recursive subroutine readmm ( integer, intent(inout)  imsg,
character*8, intent(out)  subset,
integer, intent(out)  jdate,
integer, intent(out)  iret 
)

Read a specified BUFR message from internal arrays in memory, so that it is now in scope for processing via a subsequent call to subroutine rdmems().

BUFR messages should already be stored within internal arrays in memory via one or more previous calls to subroutine ufbmem().

This subroutine is similar to subroutine rdmemm(), except that this subroutine increments the value of imsg prior to returning to the calling program, which in turn allows it to be easily called within an iterative program loop.

Parameters
imsg- Message pointer within internal arrays:
  • On input, imsg is the number of the BUFR message to be read into scope for further processing, counting from the beginning of the internal arrays in memory
  • On output, imsg is incremented by one from its input value
subset- Table A mnemonic for type of BUFR message that was read into scope (see DX BUFR Tables for further information about Table A mnemonics)
jdate- Date-time stored within Section 1 of BUFR message that was read into scope, in format of either YYMMDDHH or YYYYMMDDHH, depending on the most recent call to subroutine datelen()
iret- return code:
  • 0 = requested message was successfully read into scope
  • -1 = requested message number could not be found in internal arrays
Author
J. Woollen
Date
1999-11-18

Definition at line 381 of file memmsgs.F90.

References rdmemm(), x48(), and x84().

Referenced by ireadmm().

◆ ufbmem()

recursive subroutine ufbmem ( integer, intent(in)  lunit,
integer, intent(in)  inew,
integer, intent(out)  iret,
integer, intent(out)  iunit 
)

Connect a new file to the NCEPLIBS-bufr software for input operations, then read the entire file contents into internal arrays so that any of the individual BUFR messages can later be accessed from memory, instead of having to read them one at a time sequentially from the file.

Any embedded DX BUFR tables contained within the file are also read and processed into separate internal arrays for later use.

Logical unit number lunit must already be associated with an actual filename on the local system, typically via a Fortran "OPEN" statement.

When inew = 0, the output value iunit will be set equal to the input value lunit. Otherwise, the output value iunit will be set to the value of lunit that was input when this subroutine was previously called with inew = 0, and the system file connected to lunit will be closed via an internal call to subroutine closbf() before exiting this subroutine. In either case, iunit can now be used to access all BUFR messages that were read and stored by all previous calls to this subroutine.

Parameters
lunit- Fortran logical unit number for BUFR file
inew- Processing option:
  • 0 = Initialize the internal arrays, then read all BUFR messages from lunit into internal arrays
  • Otherwise, read all BUFR messages from lunit and append them to the existing messages within the internal arrays
iret- Number of BUFR messages that were read from lunit and stored into internal arrays
iunit- File status:
  • 0 = lunit was empty, so no messages were read
  • Otherwise, the Fortran logical unit number to use for later access to any of the messages from the internal arrays
Author
J. Woollen
Date
1994-01-06

Definition at line 38 of file memmsgs.F90.

References bort(), closbf(), cpdxmm(), errwrt(), idxmsg(), moda_msgmem::ldxm, moda_msgmem::ldxts, moda_mgwa::mgwa, moda_msgmem::mlast, moda_msgmem::msgp, moda_msgmem::msgs, moda_msgmem::munit, moda_msgmem::ndxm, moda_msgmem::ndxts, nmwrd(), openbf(), rdmsgw(), status(), x48(), and x84().

◆ ufbmex()

recursive subroutine ufbmex ( integer, dimension(*), intent(in)  lunit,
integer, dimension(*), intent(in)  lundx,
integer, dimension(*), intent(in)  inew,
integer, dimension(*), intent(out)  iret,
integer, dimension(*), intent(out)  mesg 
)

Connect a new file to the NCEPLIBS-bufr software for input operations, then read the entire file contents into internal arrays so that any of the individual BUFR messages can later be accessed from memory, instead of having to read them one at a time sequentially from the file.

This subroutine is similar to subroutine ufbmem(), except that instead of a file status it returns an array of message types that were read in. Furthermore, this subroutine doesn't process any embedded DX BUFR tables contained within the file; instead, it provides an additional call argument lundx to allow for specification of the necessary DX BUFR table information associated with the messages in the file.

Logical unit numbers lunit and lundx must already be associated with actual filenames on the local system, typically via a Fortran "OPEN" statement.

Parameters
lunit- Fortran logical unit number for BUFR file
lundx- Fortran logical unit number containing DX BUFR table information associated with BUFR messages in lunit
inew- Processing option:
  • 0 = Initialize the internal arrays, then read all BUFR messages from lunit into internal arrays
  • Otherwise, read all BUFR messages from lunit and append them to the existing messages within the internal arrays
iret- Number of BUFR messages that were read from lunit and stored into internal arrays
mesg- Types of BUFR messages that were read from lunit and stored into internal arrays
Author
J. Woollen
Date
2012-01-26

Definition at line 216 of file memmsgs.F90.

References bort(), closbf(), errwrt(), moda_msgmem::ipmsgs, iupbs01(), moda_msgmem::ldxm, moda_msgmem::ldxts, moda_mgwa::mgwa, moda_msgmem::mlast, moda_msgmem::msgp, moda_msgmem::msgs, moda_msgmem::munit, moda_msgmem::ndxm, moda_msgmem::ndxts, nmwrd(), openbf(), rdmsgw(), x48(), and x84().

◆ ufbmms()

recursive subroutine ufbmms ( integer, intent(in)  imsg,
integer, intent(in)  isub,
character*8, intent(out)  subset,
integer, intent(out)  jdate 
)

Read a specified data subset from internal arrays.

This subroutine provides a handy way to combine the functionality of subroutines rdmemm() and rdmems() within a single subroutine call.

Whenever this subroutine returns successfully, the requested data subset can now be easily manipulated or further parsed via calls to any of the values-reading subroutines using the Fortran logical unit number iunit that was returned from the most recent call to subroutine ufbmem().

Parameters
imsg- Number of BUFR message to be read into scope for further processing, counting from the beginning of the internal arrays in memory
isub- Number of data subset to be read from the (imsg)th BUFR message, counting from the beginning of the message
subset- Table A mnemonic for type of (imsg)th BUFR message (see DX BUFR Tables for further information about Table A mnemonics)
jdate- Date-time stored within Section 1 of (imsg)th BUFR message, in format of either YYMMDDHH or YYYYMMDDHH, depending on the most recent call to subroutine datelen()
Author
J. Woollen
Date
1994-01-06

Definition at line 839 of file memmsgs.F90.

References bort(), moda_msgmem::msgp, moda_msgcwd::msub, moda_msgmem::munit, rdmemm(), rdmems(), status(), x48(), and x84().

◆ ufbmns()

recursive subroutine ufbmns ( integer, intent(in)  irep,
character*8, intent(out)  subset,
integer, intent(out)  idate 
)

Read a specified data subset from internal arrays in memory, so that it is now in scope for processing via calls to any of the values-reading subroutines using the Fortran logical unit number iunit that was returned from the most recent call to subroutine ufbmem().

This subroutine does not return any information about which BUFR message within the internal arrays contained the specified data subset.

Parameters
irep- Number of data subset to be read into scope for further processing, counting from the beginning of the internal arrays in memory
subset- Table A mnemonic for type of BUFR message that was read into scope (see DX BUFR Tables for further information about Table A mnemonics)
idate- Date-time stored within Section 1 of BUFR message that was read into scope, in format of either YYMMDDHH or YYYYMMDDHH, depending on the most recent call to subroutine datelen()
Author
J. Woollen
Date
1994-01-06

Definition at line 910 of file memmsgs.F90.

References bort(), ireadmm(), moda_msgmem::munit, nmsub(), rdmems(), x48(), and x84().

◆ ufbrms()

recursive subroutine ufbrms ( integer, intent(in)  imsg,
integer, intent(in)  isub,
real*8, dimension(i1,i2), intent(out)  usr,
integer, intent(in)  i1,
integer, intent(in)  i2,
integer, intent(out)  iret,
character*(*), intent(in)  str 
)

Read one or more data values from a data subset in internal arrays.

This subroutine provides a handy way to combine the functionality of subroutines rdmemm(), rdmems() and ufbint() within a single subroutine call.

Parameters
imsg- Number of BUFR message to be read into scope for further processing, counting from the beginning of the internal arrays in memory
isub- Number of data subset to be read from the (imsg)th BUFR message, counting from the beginning of the message
usr- Data values
i1- First dimension of usr as allocated within the calling program
i2- Second dimension of usr as allocated within the calling program
iret- Number of replications of str that were read from the data subset
str- String of blank-separated Table B mnemonics in one-to-one correspondence with the number of data values that will be read from the data subset within the first dimension of usr (see DX BUFR Tables for further information about Table B mnemonics)
Author
J. Woollen
Date
1994-01-06

Definition at line 976 of file memmsgs.F90.

References bort(), errwrt(), moda_msgmem::msgp, moda_msgcwd::msub, moda_msgmem::munit, rdmemm(), rdmems(), status(), ufbint(), x48(), and x84().

◆ ufbtam()

recursive subroutine ufbtam ( real*8, dimension(i1,i2), intent(out)  tab,
integer, intent(in)  i1,
integer, intent(in)  i2,
integer, intent(out)  iret,
character*(*), intent(in)  str 
)

Read through every data subset in internal arrays and return one or more specified data values from each subset.

This provides a useful way to scan the ranges of one or more specified data values across all of the data subsets in the internal arrays. It is similar to subroutine ufbtab(), except that ufbtab() works on data subsets in a BUFR file.

It is the user's responsibility to ensure that TAB is dimensioned sufficiently large enough to accommodate the number of data values that are to be read from the internal arrays. Specifically, each row of TAB will contain the data values read from a different data subset, so the value I2 must be at least as large as the total number of data subsets in the internal arrays.

The internal arrays must have already been populated via a previous call to subroutine ufbmem().

There are a few additional special mnemonics that can be included within str when calling this subroutine, and which in turn will result in special information being returned within the corresponding location in tab:

  • IREC - returns the number of the BUFR message within the internal arrays (counting from the beginning of the internal arrays) in which the current data subset resides.
  • ISUB - returns the number of the current data subset within the BUFR message pointed to by IREC, counting from the beginning of the message.
  • ITBL - returns the number of the DX BUFR table that is in scope for the current data subset.

This subroutine will not work on compressed data subsets.

Parameters
tab- Data values
i1- First dimension of tab as allocated within the calling program
i2- Second dimension of tab as allocated within the calling program
iret- Number of data subsets in internal arrays
str- String of blank-separated Table B mnemonics, in one-to-one correspondence with the number of data values that will be read from each data subset within the first dimension of tab (see DX BUFR Tables for further information about Table B mnemonics)
Author
J. Woollen
Date
1994-01-06

Definition at line 1102 of file memmsgs.F90.

References bort(), errwrt(), moda_bitbuf::ibit, moda_tables::ibt, moda_usrint::inv, moda_tables::itp, moda_msgmem::ldxts, moda_bitbuf::mbay, moda_bitbuf::mbyt, moda_msgmem::msgp, moda_msgcwd::msub, moda_msgmem::munit, moda_msgcwd::nmsg, nmsub(), moda_msgcwd::nsub, moda_usrint::nval, parstr(), rdmemm(), status(), string(), upb(), upb8(), upc(), ups(), usrtpl(), x48(), and x84().