NCEPLIBS-bufr  12.1.0
mastertable.F90 File Reference

Read or write master table information. More...

Go to the source code of this file.

Functions/Subroutines

subroutine codflg (cf)
 Specify whether or not code and flag table information should be included during all future reads of master BUFR tables. More...
 
subroutine getntbe (lunt, ifxyn, line, iret)
 Read the first line of the next entry from the specified ASCII master table B, table D or table F (Code/Flag) file. More...
 
subroutine gettbh (luns, lunl, tab, imt, imtv, iogce, iltv)
 Read the header lines from two separate ASCII files (one standard and one local) containing master table B, table D, or Code/Flag table information. More...
 
integer function igetntbl (lunt, line)
 Read the next line from an ASCII master table B, table D or Code/Flag table file, ignoring any blank lines or comment lines in the process. More...
 
integer function igettdi (iflag)
 Depending on the value of the input flag, either return the next usable scratch Table D index for the current master table, or else reset the index back to its minimum value. More...
 
integer function ireadmt (lun)
 Check the most recent BUFR message that was read via a call to one of the message-reading subroutines and determine whether the appropriate corresponding BUFR master tables have already been read into internal memory. More...
 
subroutine mtfnam (imt, imtv, iogce, imtvl, tbltyp, stdfil, locfil)
 Based on the input arguments, determine the names of the corresponding standard and local master table files. More...
 
recursive subroutine mtinfo (cmtdir, lunmt1, lunmt2)
 Specify the directory location and Fortran logical unit numbers to be used when reading master BUFR tables on the local file system. More...
 
integer function nemock (nemo)
 Check a mnemonic for validity. More...
 
subroutine rdmtbb (lunstb, lunltb, mxmtbb, imt, imtv, iogce, iltv, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem)
 Read master Table B information from two separate ASCII files (one standard and one local) and then merge the output into a single set of arrays. More...
 
subroutine rdmtbd (lunstd, lunltd, mxmtbd, mxelem, imt, imtv, iogce, iltv, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem)
 Read master Table D information from two separate ASCII files (one standard and one local) and then merge the output into a single set of arrays. More...
 
subroutine rdmtbf (lunstf, lunltf)
 Read master Code/Flag table information from two separate ASCII files (one standard and one local) and then merge the output into a single set of arrays. More...
 
subroutine sntbbe (ifxyn, line, mxmtbb, nmtbb, imfxyn, cmscl, cmsref, cmbw, cmunit, cmmnem, cmdsc, cmelem)
 Store an entry that was previously read from an ASCII master Table B file into a set of merged Fortran arrays. More...
 
subroutine sntbde (lunt, ifxyn, line, mxmtbd, mxelem, nmtbd, imfxyn, cmmnem, cmdsc, cmseq, nmelem, iefxyn, ceelem)
 Store the first line of an entry that was previously read from an ASCII master Table D file into a set of merged Fortran arrays, then read and store all remaining lines of that same entry into the same merged Fortran arrays. More...
 
subroutine sntbestr (hestr, ifxyn, estr)
 Generate an error-reporting string containing an FXY number. More...
 
subroutine sntbfe (lunt, ifxyn)
 Read an entire entry from a previously-opened ASCII master Code/Flag table file, then store the information into an internal memory structure. More...
 

Detailed Description

Read or write master table information.

Author
J. Ator
Date
2009-03-23

Definition in file mastertable.F90.

Function/Subroutine Documentation

◆ codflg()

subroutine codflg ( character, intent(in)  cf)

Specify whether or not code and flag table information should be included during all future reads of master BUFR tables.

Parameters
cf- Flag indicating whether or not to include code and flag table information during all future reads of master BUFR tables:
  • 'N' = No (the default)
  • 'Y' = Yes

See Master BUFR Tables for more information about master BUFR tables. In particlar, note that Table B and Table D files are always read whenever master BUFR tables are being used, but the reading of Code/Flag table files is optional and should only be included if the user intends to make one or more future calls to subroutine getcfmng(); otherwise, the reading of Code/Flag table files will result in the unnecessary use of memory and other system resources.

If Code/Flag tables are to be read and used, they must reside in the same directory as the master Table B and Table D files on the local filesystem, as specified within a separate call to subroutine mtinfo().

The specified value for cf will remain in effect for all future reads of master BUFR tables, 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.

Author
J. Ator
Date
2017-10-13

Definition at line 1208 of file mastertable.F90.

References bort(), capit(), and moda_tablef::cdmf.

Referenced by fdebufr_c(), and sinv().

◆ getntbe()

subroutine getntbe ( integer, intent(in)  lunt,
integer, intent(out)  ifxyn,
character*(*), intent(out)  line,
integer, intent(out)  iret 
)

Read the first line of the next entry from the specified ASCII master table B, table D or table F (Code/Flag) file.

This line contains, among other things, the FXY number corresponding to this entry.

Parameters
lunt- Fortran logical unit number of master table B, table D or Code/Flag table file
ifxyn- WMO bit-wise representation of FXY number for next table entry
line- First line of next table entry
iret- Return code
  • 0 = normal return
  • -1 = end-of-file encountered while reading from lunt
Author
J. Ator
Date
2007-01-19

Definition at line 1147 of file mastertable.F90.

References bort2(), and parstr().

Referenced by rdmtbb(), rdmtbd(), and rdmtbf().

◆ gettbh()

subroutine gettbh ( integer, intent(in)  luns,
integer, intent(in)  lunl,
character, intent(in)  tab,
integer, intent(out)  imt,
integer, intent(out)  imtv,
integer, intent(out)  iogce,
integer, intent(out)  iltv 
)

Read the header lines from two separate ASCII files (one standard and one local) containing master table B, table D, or Code/Flag table information.

Parameters
luns- Fortran logical unit number for ASCII file containing standard table information
lunl- Fortran logical unit number for ASCII file containing local table information
tab- Type of table:
  • 'B' = Table B
  • 'D' = Table D
  • 'F' = Code/Flag table
imt- Master table
  • This value is read from both ASCII files and must be identical between them
imtv- Version number of master table
  • This value is read from the standard ASCII file
iogce- Originating center
  • This value is read from the local ASCII file
iltv- Version number of local table
  • This value is read from the local ASCII file
Author
J. Ator
Date
2007-01-19

Definition at line 1071 of file mastertable.F90.

References bort(), parstr(), and strnum().

Referenced by rdmtbb(), rdmtbd(), and rdmtbf().

◆ igetntbl()

integer function igetntbl ( integer, intent(in)  lunt,
character*(*), intent(out)  line 
)

Read the next line from an ASCII master table B, table D or Code/Flag table file, ignoring any blank lines or comment lines in the process.

Parameters
lunt- Fortran logical unit number for ASCII file containing table information
line- Next non-blank, non-comment line that was read from lunt
Returns
igetntbl:
  • 0 = normal return
  • -1 = end-of-file encountered while reading from lunt
Author
J. Ator
Date
2007-01-19

Definition at line 992 of file mastertable.F90.

◆ igettdi()

integer function igettdi ( integer, intent(in)  iflag)

Depending on the value of the input flag, either return the next usable scratch Table D index for the current master table, or else reset the index back to its minimum value.

Parameters
iflag- Flag:
  • if set to 0, then the function will reset the scratch Table D index back to its minimum value
  • otherwise, the function will return the next usable scratch Table D index for the current master table
Returns
- igettdi:
  • -1 if function was called with iflag = 0
  • otherwise, the next usable scratch Table D index for the current master table
Author
J. Ator
Date
2009-03-23

Definition at line 1027 of file mastertable.F90.

References bort().

Referenced by bufr_c2f_interface::igettdi_c().

◆ ireadmt()

integer function ireadmt ( integer, intent(in)  lun)

Check the most recent BUFR message that was read via a call to one of the message-reading subroutines and determine whether the appropriate corresponding BUFR master tables have already been read into internal memory.

If not, then open the appropriate master BUFR tables on the local file system and read the contents into internal memory, clearing any previous master BUFR table information that may have previously been stored there.

Parameters
lun- File ID
Returns
ireadmt - Flag indicating whether new master BUFR tables needed to be read into internal memory:
  • 0 = No
  • 1 = Yes

Information about the location of master BUFR tables on the local file system is obtained from the most recent call to subroutine mtinfo(), or else from subroutine bfrini() if subroutine mtinfo() was never called, and in which case Fortran logical unit numbers 98 and 99 will be used by this function for opening and reading master BUFR table files.

Author
J. Ator
Date
2009-03-23

Definition at line 177 of file mastertable.F90.

References bort2(), moda_mstabs::cbbw, moda_mstabs::cbelem, moda_mstabs::cbmnem, moda_mstabs::cbscl, moda_mstabs::cbsref, moda_mstabs::cbunit, moda_tablef::cdmf, moda_mstabs::cdmnem, moda_s3list::cds3, moda_mstabs::cdseq, moda_rdmtb::ceelem, moda_rdmtb::cmdscb, moda_rdmtb::cmdscd, errwrt(), moda_mstabs::ibfxyn, moda_mstabs::idefxy, moda_mstabs::idfxyn, moda_rdmtb::iefxyn, ifxy(), moda_sc3bfr::isc3, istdesc(), iupbs01(), moda_bitbuf::mbay, mtfnam(), moda_mstabs::ndelem, moda_mstabs::nmtb, moda_mstabs::nmtd, rdmtbb(), rdmtbd(), rdmtbf(), and upds3().

Referenced by getcfmng(), and ufdump().

◆ mtfnam()

subroutine mtfnam ( integer, intent(in)  imt,
integer, intent(in)  imtv,
integer, intent(in)  iogce,
integer, intent(in)  imtvl,
character*(*), intent(in)  tbltyp,
character*(*), intent(out)  stdfil,
character*(*), intent(out)  locfil 
)

Based on the input arguments, determine the names of the corresponding standard and local master table files.

After determining the corresponding file names, this subroutine then confirms the existence of those files on the filesystem, using additional information obtained from the most recent call to subroutine mtinfo(), or else as defined within subroutine bfrini() if subroutine mtinfo() was never called.

Parameters
imt- Master table number
imtv- Master table version number
iogce- Originating center
imtvl- Local table version number
tbltyp- Table type:
  • 'TableB' = Table B
  • 'TableD' = Table D
  • 'CodeFlag' = Code and Flag Tables
stdfil- Standard master table path/filename
locfil- Local master table path/filename
Author
Ator
Date
2017-10-16

Definition at line 86 of file mastertable.F90.

References bort2(), errwrt(), and strsuc().

Referenced by ireadmt().

◆ mtinfo()

recursive subroutine mtinfo ( character*(*), intent(in)  cmtdir,
integer, intent(in)  lunmt1,
integer, intent(in)  lunmt2 
)

Specify the directory location and Fortran logical unit numbers to be used when reading master BUFR tables on the local file system.

Parameters
cmtdir- Directory location of master BUFR tables on local file system (up to 240 characters)
lunmt1- First Fortran logical unit number to use when reading master BUFR tables on local file system
lunmt2- Second Fortran logical unit number to use when reading master BUFR tables on local file system

See Master BUFR Tables for more information about master BUFR tables. In particular, note that this subroutine is normally only ever called after a prior call has been made to subroutine openbf() with io = 'SEC3'. But in such cases, any call to this subroutine must be made prior to any subsequent calls to any of the BUFR message-reading subroutines for the associated BUFR file; otherwise, default values for cmtdir, lunmt1 and lunmt2 will be used as defined within subroutine bfrini().

For cmtdir, any full or relative directory pathname that is legal on the local filesystem is permissible, up to a total maximum length of 240 characters. The library will then automatically search within this directory for any necessary master table files and open and read them as needed.

The logical unit numbers lunmt1 and lunmt2 should be distinct from each other but should not already be assigned to any files on the local system.

Author
J. Ator
Date
2009-03-23

Definition at line 34 of file mastertable.F90.

References strsuc(), and x84().

Referenced by bfrini(), fdebufr_c(), bufr_c2f_interface::mtinfo_c(), and sinv().

◆ nemock()

integer function nemock ( character*(*), intent(in)  nemo)

Check a mnemonic for validity.

For a mnemonic to be valid, it must have a length of between 1 and 8 characters, and it must only contain characters from the allowable character set.

Parameters
nemo- Mnemonic
Returns
nemock - Indicator as to whether nemo is valid:
  • 0 = Yes
  • -1 = No, the length is not between 1 and 8 characters
  • -2 = No, it contains characters from outside of the allowable character set
Author
J. Woollen
Date
1994-01-06

Definition at line 1240 of file mastertable.F90.

◆ rdmtbb()

subroutine rdmtbb ( integer, intent(in)  lunstb,
integer, intent(in)  lunltb,
integer, intent(in)  mxmtbb,
integer, intent(out)  imt,
integer, intent(out)  imtv,
integer, intent(out)  iogce,
integer, intent(out)  iltv,
integer, intent(out)  nmtbb,
integer, dimension(*), intent(out)  imfxyn,
character, dimension(4,*), intent(out)  cmscl,
character, dimension(12,*), intent(out)  cmsref,
character, dimension(4,*), intent(out)  cmbw,
character, dimension(24,*), intent(out)  cmunit,
character, dimension(8,*), intent(out)  cmmnem,
character, dimension(*), intent(out)  cmdsc,
character, dimension(120,*), intent(out)  cmelem 
)

Read master Table B information from two separate ASCII files (one standard and one local) and then merge the output into a single set of arrays.

Each of the two ASCII files must already be individually sorted in ascending order with respect to the FXY numbers.

Parameters
lunstb- Fortran logical unit number for ASCII file containing standard Table B information
lunltb- Fortran logical unit number for ASCII file containing local Table B information
mxmtbb- Dimensioned size (in integers) of merged output arrays; used by the subroutine to ensure that it doesn't overflow these arrays
imt- Master table
  • This value is read from both ASCII files and must be identical between them
imtv- Version number of master table
  • This value is read from the standard ASCII file
iogce- Originating center
  • This value is read from the local ASCII file
iltv- Version number of local table
  • This value is read from the local ASCII file
nmtbb- Number of entries in merged output arrays
imfxyn- Merged array containing WMO bit-wise representations of FXY numbers
cmscl- Merged array containing scale factors
cmsref- Merged array containing reference values
cmbw- Merged array containing bit widths
cmunit- Merged array containing units
cmmnem- Merged array containing mnemonics
cmdsc- Merged array containing descriptor codes
cmelem- Merged array containing element names
Author
J. Ator
Date
2007-01-19

Definition at line 370 of file mastertable.F90.

References bort(), getntbe(), gettbh(), and sntbbe().

Referenced by ireadmt().

◆ rdmtbd()

subroutine rdmtbd ( integer, intent(in)  lunstd,
integer, intent(in)  lunltd,
integer, intent(in)  mxmtbd,
integer, intent(in)  mxelem,
integer, intent(out)  imt,
integer, intent(out)  imtv,
integer, intent(out)  iogce,
integer, intent(out)  iltv,
integer, intent(out)  nmtbd,
integer, dimension(*), intent(out)  imfxyn,
character, dimension(8,*), intent(out)  cmmnem,
character, dimension(*), intent(out)  cmdsc,
character, dimension(120,*), intent(out)  cmseq,
integer, dimension(*), intent(out)  nmelem,
integer, dimension(mxmtbd,mxelem), intent(out)  iefxyn,
character, dimension(mxmtbd,mxelem), intent(out)  ceelem 
)

Read master Table D information from two separate ASCII files (one standard and one local) and then merge the output into a single set of arrays.

Each of the two ASCII files must already be individually sorted in ascending order with respect to the FXY numbers.

Parameters
lunstd- Fortran logical unit number for ASCII file containing standard Table D information
lunltd- Fortran logical unit number for ASCII file containing local Table D information
mxmtbd- Dimensioned size (in integers) of merged output arrays; used by the subroutine to ensure that it doesn't overflow these arrays
mxelem- Maximum number of elements to be stored per Table D sequence within merged output arrays; used by the subroutine to ensure that it doesn't overflow these arrays
imt- Master table
  • This value is read from both ASCII files and must be identical between them
imtv- Version number of master table
  • This value is read from the standard ASCII file
iogce- Originating center
  • This value is read from the local ASCII file
iltv- Version number of local table
  • This value is read from the local ASCII file
nmtbd- Number of entries in merged output arrays
imfxyn- Merged array containing WMO bit-wise representations of FXY numbers
cmmnem- Merged array containing mnemonics
cmdsc- Merged array containing descriptor codes
cmseq- Merged array containing sequence names
nmelem- Merged array containing number of elements stored for each sequence
iefxyn- Merged array containing WMO bit-wise representations of element FXY numbers
ceelem- Merged array containing element names
Author
J. Ator
Date
2007-01-19

Definition at line 448 of file mastertable.F90.

References bort(), getntbe(), gettbh(), and sntbde().

Referenced by ireadmt().

◆ rdmtbf()

subroutine rdmtbf ( integer, intent(in)  lunstf,
integer, intent(in)  lunltf 
)

Read master Code/Flag table information from two separate ASCII files (one standard and one local) and then merge the output into a single set of arrays.

Each of the two ASCII files must already be individually sorted in ascending order with respect to the FXY numbers.

Parameters
lunstf- Fortran logical unit number for ASCII file containing standard Code/Flag table information
lunltf- Fortran logical unit number for ASCII file containing local Code/Flag table information
Author
J. Ator
Date
2017-10-17

Definition at line 507 of file mastertable.F90.

References bort(), getntbe(), gettbh(), and sntbfe().

Referenced by ireadmt().

◆ sntbbe()

subroutine sntbbe ( integer, intent(in)  ifxyn,
character*(*), intent(in)  line,
integer, intent(in)  mxmtbb,
integer, intent(out)  nmtbb,
integer, dimension(*), intent(out)  imfxyn,
character, dimension(4,*), intent(out)  cmscl,
character, dimension(12,*), intent(out)  cmsref,
character, dimension(4,*), intent(out)  cmbw,
character, dimension(24,*), intent(out)  cmunit,
character, dimension(8,*), intent(out)  cmmnem,
character, dimension(*), intent(out)  cmdsc,
character, dimension(120,*), intent(out)  cmelem 
)

Store an entry that was previously read from an ASCII master Table B file into a set of merged Fortran arrays.

Parameters
ifxyn- WMO bit-wise representation of FXY number
line- Table B entry
mxmtbb- Dimensioned size (in integers) of merged output arrays; used by the subroutine to ensure that it doesn't overflow these arrays
nmtbb- Number of entries in merged output arrays
imfxyn- Merged array containing WMO bit-wise representations of FXY numbers
cmscl- Merged array containing scale factors
cmsref- Merged array containing reference values
cmbw- Merged array containing bit widths
cmunit- Merged array containing units
cmmnem- Merged array containing mnemonics
cmdsc- Merged array containing descriptor codes
cmelem- Merged array containing element names
Author
J. Ator
Date
2007-01-19

Definition at line 579 of file mastertable.F90.

References bort(), bort2(), parstr(), and sntbestr().

Referenced by rdmtbb().

◆ sntbde()

subroutine sntbde ( integer, intent(in)  lunt,
integer, intent(in)  ifxyn,
character*(*), intent(in)  line,
integer, intent(in)  mxmtbd,
integer, intent(in)  mxelem,
integer, intent(out)  nmtbd,
integer, dimension(*), intent(out)  imfxyn,
character, dimension(8,*), intent(out)  cmmnem,
character, dimension(*), intent(out)  cmdsc,
character, dimension(120,*), intent(out)  cmseq,
integer, dimension(*), intent(out)  nmelem,
integer, dimension(mxmtbd,mxelem), intent(out)  iefxyn,
character, dimension(mxmtbd,mxelem), intent(out)  ceelem 
)

Store the first line of an entry that was previously read from an ASCII master Table D file into a set of merged Fortran arrays, then read and store all remaining lines of that same entry into the same merged Fortran arrays.

Parameters
lunt- Fortran logical unit number for ASCII file containing Table D information
ifxyn- WMO bit-wise representation of FXY number
line- First line of Table D entry
mxmtbd- Dimensioned size (in integers) of merged output arrays; used by the subroutine to ensure that it doesn't overflow these arrays
mxelem- Maximum number of elements to be stored per Table D sequence within merged output arrays; used by the subroutine to ensure that it doesn't overflow these arrays
nmtbd- Number of entries in merged output arrays
imfxyn- Merged array containing WMO bit-wise representations of FXY numbers
cmmnem- Merged array containing mnemonics
cmdsc- Merged array containing descriptor codes
cmseq- Merged array containing sequence names
nmelem- Merged array containing number of elements stored for each sequence
iefxyn- Merged array containing WMO bit-wise representations of element FXY numbers
ceelem- Merged array containing element names
Author
J. Ator
Date
2007-01-19

Definition at line 723 of file mastertable.F90.

References bort(), bort2(), parstr(), and sntbestr().

Referenced by rdmtbd().

◆ sntbestr()

subroutine sntbestr ( character*(*), intent(in)  hestr,
integer, intent(in)  ifxyn,
character*(*), intent(out)  estr 
)

Generate an error-reporting string containing an FXY number.

Parameters
hestr- Head portion of error-reporting string
ifxyn- WMO bit-wise representation of FXY number
estr- Error-reporting string
Author
J. Ator
Date
2024-04-15

Definition at line 966 of file mastertable.F90.

Referenced by sntbbe(), sntbde(), and sntbfe().

◆ sntbfe()

subroutine sntbfe ( integer, intent(in)  lunt,
integer, intent(in)  ifxyn 
)

Read an entire entry from a previously-opened ASCII master Code/Flag table file, then store the information into an internal memory structure.

Parameters
lunt- Fortran logical unit number for ASCII file containing Code/Flag table information
ifxyn- WMO bit-wise representation of FXY number
Author
J. Ator
Date
2017-11-02

Definition at line 835 of file mastertable.F90.

References bort2(), parstr(), sntbestr(), and strnum().

Referenced by rdmtbf().