NCEPLIBS-bufr
12.1.0
|
Read or write jump/link table information. More...
Go to the source code of this file.
Functions/Subroutines | |
subroutine | chekstab (lun) |
Check that an internal BUFR table representation is self-consistent and fully defined. More... | |
subroutine | conwin (lun, inc1, inc2) |
Search consecutive subset buffer segments for a conditional node. More... | |
subroutine | drstpl (inod, lun, inv1, inv2, invn) |
Search for a specified mnemonic within unexpanded sequences of the internal jump/link table. More... | |
subroutine | fstag (lun, utag, nutag, nin, nout, iret) |
Search for a specified occurrence of a specified mnemonic within a data subset definition, starting from a specified location. More... | |
recursive subroutine | gettagpr (lunit, tagch, ntagch, tagpr, iret) |
Get the parent for a specified occurrence of a Table B or Table D mnemonic within a data subset definition. More... | |
subroutine | getwin (node, lun, iwin, jwin) |
Look for a window containing a specified node within the internal jump/link table. More... | |
integer function | icmpdx (lud, lun) |
Check whether the full set of associated DX BUFR Table information is identical between two Fortran logical units. More... | |
subroutine | inctab (atag, atyp, node) |
Get the next available positional index for writing into the internal jump/link table in module moda_tables, and also use that index to store atag and atyp within, respectively, the internal jump/link table arrays tag(*) and typ(*). More... | |
integer function | invcon (nc, lun, inv1, inv2) |
Search a specified window for a conditional node. More... | |
integer function | invtag (node, lun, inv1, inv2) |
Search for a specified mnemonic within a specified portion of the current data subset. More... | |
integer function | invwin (node, lun, inv1, inv2) |
Search for a specified node within a specified portion of the current data subset. More... | |
integer function | ishrdx (lud, lun) |
Check whether the same DX BUFR Table is being shared between two Fortran logical units. More... | |
integer function | lstjpb (node, lun, jbtyp) |
Search backwards, beginning from a given node within the jump/link table, until finding the most recent node of type jbtyp. More... | |
subroutine | makestab |
Build the entire internal jump/link table within module moda_tables, using all of the internal BUFR table array information from module moda_tababd for all of the file IDs that are currently defined to the library in module moda_stbfr. More... | |
recursive subroutine | nemspecs (lunit, nemo, nnemo, nscl, nref, nbts, iret) |
Get the scale factor, reference value and bit width associated with a specified occurrence of a Table B mnemonic. More... | |
subroutine | newwin (lun, iwin, jwin) |
Compute the ending index of the window. More... | |
integer function | nvnwin (node, lun, inv1, inv2, invn, nmax) |
Search for all occurrences of a specified node within a specified portion of the current data subset. More... | |
subroutine | nxtwin (lun, iwin, jwin) |
Compute the start and end indices of the next window. More... | |
subroutine | tabent (lun, nemo, tab, itab, irep, iknt, jum0) |
Build and store an entry for a Table B or Table D mnemonic within the internal jump/link table. More... | |
subroutine | tabsub (lun, nemo) |
Build and store the entire jump/link tree (including recursively resolving all "child" mnemonics) for a Table A mnemonic within the internal jump/link table. More... | |
subroutine chekstab | ( | integer, intent(in) | lun | ) |
Check that an internal BUFR table representation is self-consistent and fully defined.
If any errors are found, then make an appropriate call to NCEPLIBS-bufr subroutine bort().
lun | - File ID |
Definition at line 279 of file jumplink.F90.
References bort(), moda_nmikrp::irp, moda_nmikrp::krp, moda_nmikrp::nem, nemtab(), nemtbb(), nemtbd(), moda_tababd::ntba, moda_tababd::ntbb, moda_tababd::ntbd, and moda_tababd::taba.
Referenced by makestab().
subroutine conwin | ( | integer, intent(in) | lun, |
integer, intent(out) | inc1, | ||
integer, intent(out) | inc2 | ||
) |
Search consecutive subset buffer segments for a conditional node.
Search consecutive subset buffer segments for an element identified in the user string as a conditional node. A conditional node is an element which must meet a condition in order to be read from or written to a data subset. If a conditional element is found and it conforms to the condition, then return the internal subset buffer indices of the "window" (see below).
The four conditions which can be exercised are:
Each condition in a string is applied to one element, and all conditions are 'and'ed to evaluate an outcome. For example, if the condition string is: "POB<500 TOB>30 TQM<4" then the only levels of data read or written are those with pressure less than 500 mb, temperature greater than 30 degrees, and temperature quality mark less than 4.
See the docblock in subroutine getwin() for an explanation of "windows" within the context of a BUFR data subset.
Subroutine conwin() works with function invcon() to identify subset buffer segments which conform to the set of conditions.
lun | - File ID |
inc1 | - Subset buffer start index |
inc2 | - Subset buffer ending index |
Definition at line 1382 of file jumplink.F90.
References getwin(), and moda_usrint::nval.
subroutine drstpl | ( | integer, intent(in) | inod, |
integer, intent(in) | lun, | ||
integer, intent(in) | inv1, | ||
integer, intent(inout) | inv2, | ||
integer, intent(out) | invn | ||
) |
Search for a specified mnemonic within unexpanded sequences of the internal jump/link table.
This subroutine is called internally by subroutine ufbrw() whenever it can't find a mnemonic it wants to write within the current subset buffer. It looks for the mnemonic within any unexpanded "DRS" (stack) or "DRB" (1-bit delayed replication) sequences inside of the portion of the subset buffer bounded by the indices inv1 and inv2. If found, it expands the applicable "DRS" or "DRB" sequence to the point where the mnemonic in question now appears in the subset buffer, and in doing so it will also return a new value for inv2.
inod | - Jump/link table index of mnemonic to look for |
lun | - File ID |
inv1 | - Starting index of the portion of the subset buffer currently being processed by ufbrw() |
inv2 | - Ending index
|
invn | - Location index of inod within subset buffer
|
Definition at line 897 of file jumplink.F90.
References moda_tables::jmpb, newwin(), moda_tables::typ, and usrtpl().
Referenced by ufbrw().
subroutine fstag | ( | integer, intent(in) | lun, |
character*(*), intent(in) | utag, | ||
integer, intent(in) | nutag, | ||
integer, intent(in) | nin, | ||
integer, intent(out) | nout, | ||
integer, intent(out) | iret | ||
) |
Search for a specified occurrence of a specified mnemonic within a data subset definition, starting from a specified location.
Search for the (nutag)th occurrence of mnemonic utag within the current overall subset definition, starting from parameter #(nin) within the subset. The subroutine searches forward from nin if nutag is positive or else backward if nutag is negative.
lun | - File ID |
utag | - Mnemonic |
nutag | - Ordinal occurrence of utag to search for within the overall subset definition, counting from parameter #(nin) within the subset. The subroutine will search in a forward direction from parameter #(nin) if nutag is positive or else in a backward direction if nutag is negative. |
nin | - Location within the overall subset definition from which to begin searching for utag |
nout | - Location of (nutag)th occurrence of utag |
iret | - Return code:
|
Definition at line 1064 of file jumplink.F90.
References moda_usrint::inv, moda_usrint::nval, parstr(), and moda_tables::tag.
Referenced by gettagpr(), gettagre(), getvalnb(), nemspecs(), setvalnb(), and ufdump().
recursive subroutine gettagpr | ( | integer, intent(in) | lunit, |
character*(*), intent(in) | tagch, | ||
integer, intent(in) | ntagch, | ||
character*(*), intent(out) | tagpr, | ||
integer, intent(out) | iret | ||
) |
Get the parent for a specified occurrence of a Table B or Table D mnemonic within a data subset definition.
lunit | - Fortran logical unit number for BUFR file |
tagch | - Table B or Table D mnemonic |
ntagch | - Ordinal occurrence of TAGCH for which the parent Table D mnemonic is to be returned, counting from the beginning of the overall subset definition |
tagpr | - Table D mnemonic corresponding to parent sequence of (ntagch)th occurrence of tagch |
iret | - Return code
|
A data subset must already be in scope within the NCEPLIBS-bufr internal arrays for LUNIT, either via a previous call to one of the subset-reading subroutines (when reading BUFR data subsets) or via a previous call to one of the message-writing subroutines (when writing BUFR data subsets).
Definition at line 1125 of file jumplink.F90.
References fstag(), moda_msgcwd::inode, moda_usrint::inv, moda_tables::jmpb, status(), moda_tables::tag, x48(), and x84().
subroutine getwin | ( | integer, intent(in) | node, |
integer, intent(in) | lun, | ||
integer, intent(out) | iwin, | ||
integer, intent(out) | jwin | ||
) |
Look for a window containing a specified node within the internal jump/link table.
Given a node index within the internal jump/link table, this subroutine looks within the current subset buffer for a "window" (see below remarks) which contains this node. If found, it returns the starting and ending indices of this window within the current subset buffer. For example, if the node is found within the subset but is not part of a delayed replication sequence, then the returned indices define the start and end of the entire subset buffer. Otherwise, the returned indices define the start and end of the next available delayed replication sequence iteration which contains the node. If no further iterations of the sequence can be found, then the starting index is returned with a value of zero.
node | - Jump/link table index of mnemonic to look for |
lun | - File ID |
iwin | - Starting index of the current window iteration which contains node
|
jwin | - Ending index of the current window iteration which contains node |
Definition at line 1313 of file jumplink.F90.
References bort(), moda_usrint::nval, and moda_usrint::val.
integer function icmpdx | ( | integer, intent(in) | lud, |
integer, intent(in) | lun | ||
) |
Check whether the full set of associated DX BUFR Table information is identical between two Fortran logical units.
Note that two different logical units can have identical DX BUFR Table information associated with them even if they aren't actually sharing the same DX BUFR table.
lud | - File ID for first BUFR file |
lun | - File ID for second BUFR file |
Definition at line 831 of file jumplink.F90.
References moda_tababd::idna, moda_tababd::idnb, moda_tababd::idnd, ishrdx(), moda_tababd::ntba, moda_tababd::ntbb, moda_tababd::ntbd, moda_tababd::taba, moda_tababd::tabb, and moda_tababd::tabd.
Referenced by iok2cpy().
subroutine inctab | ( | character*(*), intent(in) | atag, |
character*(*), intent(in) | atyp, | ||
integer, intent(out) | node | ||
) |
Get the next available positional index for writing into the internal jump/link table in module moda_tables, and also use that index to store atag and atyp within, respectively, the internal jump/link table arrays tag(*) and typ(*).
If there is no more room for additional entries within the internal jump/link table, then an appropriate call is made to subroutine bort().
atag | - Mnemonic name |
atyp | - Mnemonic type |
node | - Next available positional index for writing into the internal jump/link table |
Definition at line 695 of file jumplink.F90.
References bort(), moda_tables::ntab, moda_tables::tag, and moda_tables::typ.
integer function invcon | ( | integer, intent(in) | nc, |
integer, intent(in) | lun, | ||
integer, intent(in) | inv1, | ||
integer, intent(in) | inv2 | ||
) |
Search a specified window for a conditional node.
Search a "window" (see below remarks) for an element identified in the user string as a conditional node. A conditional node is an element which must meet a condition in order to be read from or written to a data subset. If a conditional element is found and it conforms to the condition, then the index of the element within the window is returned; otherwise a value of zero is returned.
See the docblock in subroutine getwin() for an explanation of "windows" within the context of a BUFR data subset.
nc | - Condition code:
|
lun | - File ID |
inv1 | - First index of window to search |
inv2 | - Last index of window to search |
Definition at line 1440 of file jumplink.F90.
References errwrt(), moda_usrint::inv, moda_usrint::nval, and moda_usrint::val.
integer function invtag | ( | integer, intent(in) | node, |
integer, intent(in) | lun, | ||
integer, intent(in) | inv1, | ||
integer, intent(in) | inv2 | ||
) |
Search for a specified mnemonic within a specified portion of the current data subset.
This function is similar to function invwin(), except that invwin() searches based on the actual node within the internal jump/link table, rather than on the mnemonic corresponding to that node.
node | - Jump/link table index of mnemonic to look for |
lun | - File ID |
inv1 | - Starting index of the portion of the subset buffer in which to look |
inv2 | - Ending index of the portion of the subset buffer in which to look |
Definition at line 1190 of file jumplink.F90.
References errwrt(), moda_usrint::inv, and moda_tables::tag.
Referenced by ufbseq().
integer function invwin | ( | integer, intent(in) | node, |
integer, intent(in) | lun, | ||
integer, intent(in) | inv1, | ||
integer, intent(in) | inv2 | ||
) |
Search for a specified node within a specified portion of the current data subset.
This function is similar to function invtag(), except that invtag() searches based on the mnemonic corresponding to the node.
node | - Jump/link table index to look for |
lun | - File ID |
inv1 | - Starting index of the portion of the subset buffer in which to look |
inv2 | - Ending index of the portion of the subset buffer in which to look |
Definition at line 1238 of file jumplink.F90.
References errwrt(), and moda_usrint::inv.
integer function ishrdx | ( | integer, intent(in) | lud, |
integer, intent(in) | lun | ||
) |
Check whether the same DX BUFR Table is being shared between two Fortran logical units.
lud | - File ID for first BUFR file |
lun | - File ID for second BUFR file |
Definition at line 786 of file jumplink.F90.
References moda_tababd::mtab, and moda_tababd::ntba.
Referenced by icmpdx().
integer function lstjpb | ( | integer, intent(in) | node, |
integer, intent(in) | lun, | ||
character*(*), intent(in) | jbtyp | ||
) |
Search backwards, beginning from a given node within the jump/link table, until finding the most recent node of type jbtyp.
The internal jmpb array is used to jump backwards within the jump/link table, and the function returns the table index of the found node. If the input node itself is of type jbtyp, then the function simply returns the index of that same node.
node | - Jump/link table index of entry to begin searching backwards from |
lun | - File ID |
jbtyp | - Type of node for which to search |
Definition at line 740 of file jumplink.F90.
References bort(), moda_msgcwd::inode, moda_tables::isc, moda_tables::jmpb, and moda_tables::typ.
Referenced by igetrfel(), and nevn().
subroutine makestab |
Build the entire internal jump/link table within module moda_tables, using all of the internal BUFR table array information from module moda_tababd for all of the file IDs that are currently defined to the library in module moda_stbfr.
The entire jump/link table will always be completely reconstructed from scratch, even if some of the information within the internal BUFR table arrays already existed there at the time of the previous call to this subroutine, because there may have been other events that have taken place since the previous call to this subroutine and which haven't yet been reflected within the internal jump/link table. For example, a file ID may have recently been unlinked from the library via an internal call to subroutine closbf(), or the DX BUFR tables associated with a file ID may have changed.
Definition at line 22 of file jumplink.F90.
References bort(), chekstab(), closmg(), cpbfdx(), errwrt(), moda_tables::ibt, moda_usrint::inv, moda_stbfr::iolun, moda_stbfr::iomsg, moda_tables::irf, moda_tables::isc, moda_tables::iseq, moda_tables::itp, moda_tables::jmpb, moda_tables::jseq, moda_tables::jump, moda_tables::knt, moda_tables::knti, moda_tables::link, moda_lushr::lus, moda_tababd::mtab, moda_nrv203::nnrv, moda_tables::ntab, moda_bitmaps::ntamc, moda_tababd::ntba, moda_usrint::nval, strcln(), moda_tababd::taba, tabsub(), moda_tables::tag, moda_tables::typ, moda_tables::vali, wrdxtb(), and moda_xtab::xtab.
Referenced by rdbfdx(), rdmemm(), rdusdx(), readdx(), readerme(), and reads3().
recursive subroutine nemspecs | ( | integer, intent(in) | lunit, |
character*(*), intent(in) | nemo, | ||
integer, intent(in) | nnemo, | ||
integer, intent(out) | nscl, | ||
integer, intent(out) | nref, | ||
integer, intent(out) | nbts, | ||
integer, intent(out) | iret | ||
) |
Get the scale factor, reference value and bit width associated with a specified occurrence of a Table B mnemonic.
Given a Table B mnemonic defined within a data subset, this subroutine returns the scale factor, reference value and bit width of a specified occurrence of that mnemonic within the overall data subset definition, counting from the beginning of the subset.
The values returned include the application of any Table C operators (e.g. 2-01-YYY, 2-02-YYY, 2-03-YYY, 2-07-YYY, 2-08-YYY) which may be in effect for the specified occurrence of the mnemonic.
lunit | - Fortran logical unit number for BUFR file |
nemo | - Table B mnemonic |
nnemo | - Ordinal occurrence of nemo for which information is to be returned, counting from the beginning of the overall subset definition |
nscl | - Scale factor in effect for (nnemo)th occurrence of nemo |
nref | - Reference value in effect for (nnemo)th occurrence of nemo |
nbts | - Bit width in effect for (nnemo)th occurrence of nemo |
iret | - Return code
|
A data subset must already be in scope within the NCEPLIBS-bufr internal arrays for lunit, either via a previous call to one of the subset-reading subroutines (when reading BUFR data subsets) or via a previous call to one of the message-writing subroutines (when writing BUFR data subsets).
Definition at line 961 of file jumplink.F90.
References fstag(), moda_tables::ibt, moda_nrv203::ienrv, moda_msgcwd::inode, moda_nrv203::inodnrv, moda_usrint::inv, moda_tables::irf, moda_tables::isc, moda_nrv203::isnrv, moda_nrv203::nnrv, moda_nrv203::nrv, status(), strsuc(), moda_nrv203::tagnrv, moda_tables::typ, x48(), and x84().
Referenced by bufr_c2f_interface::nemspecs_c().
subroutine newwin | ( | integer, intent(in) | lun, |
integer, intent(in) | iwin, | ||
integer, intent(out) | jwin | ||
) |
Compute the ending index of the window.
Given an index within the internal jump/link table which points to the start of an "RPC" window (which is the iteration of an 8-bit or 16-bit delayed replication sequence), this subroutine computes the ending index of the window. Alternatively, if the given index points to the start of a "SUB" window (which is the first node of a subset), then the subroutine returns the index of the last node.
See the docblock in subroutine getwin() for an explanation of "windows" within the context of a BUFR data subset.
lun | - File ID |
iwin | - Starting index of window iteration |
jwin | - Ending index of window iteration |
Definition at line 1490 of file jumplink.F90.
References bort(), moda_usrint::inv, moda_usrint::nval, and moda_usrint::val.
integer function nvnwin | ( | integer, intent(in) | node, |
integer, intent(in) | lun, | ||
integer, intent(in) | inv1, | ||
integer, intent(in) | inv2, | ||
integer, dimension(*), intent(out) | invn, | ||
integer, intent(in) | nmax | ||
) |
Search for all occurrences of a specified node within a specified portion of the current data subset.
Search for and return all occurrences of a specified node within the portion of the current subset buffer bounded by the indices inv1 and inv2. The resulting list is a stack of "event" indices for the requested node.
node | - Jump/link table index to look for |
lun | - File ID |
inv1 | - Starting index of the portion of the subset buffer in which to look |
inv2 | - Ending index of the portion of the subset buffer in which to look |
invn | - Array of stack "event" indices for node |
nmax | - Dimensioned size of invn; used by the function to ensure that it doesn't overflow the invn array |
Definition at line 1588 of file jumplink.F90.
References bort(), errwrt(), and moda_usrint::inv.
Referenced by ufbevn().
subroutine nxtwin | ( | integer, intent(in) | lun, |
integer, intent(inout) | iwin, | ||
integer, intent(inout) | jwin | ||
) |
Compute the start and end indices of the next window.
Given indices within the internal jump/link table which point to the start and end of an "RPC" window (which is an iteration of an 8-bit or 16-bit delayed replication sequence), this subroutine computes the start and end indices of the next sequential window.
See the docblock in subroutine getwin() for an explanation of "windows" within the context of a BUFR data subset.
lun | - File ID |
iwin | - Starting index:
|
jwin | - Ending index:
|
Definition at line 1538 of file jumplink.F90.
References bort(), moda_usrint::inv, moda_usrint::nval, and moda_usrint::val.
subroutine tabent | ( | integer, intent(in) | lun, |
character*8, intent(in) | nemo, | ||
character, intent(in) | tab, | ||
integer, intent(in) | itab, | ||
integer, intent(in) | irep, | ||
integer, intent(in) | iknt, | ||
integer, intent(in) | jum0 | ||
) |
Build and store an entry for a Table B or Table D mnemonic within the internal jump/link table.
lun | - File ID |
nemo | - Table B or D mnemonic to store in jump/link table |
tab | - Internal BUFR table array ('B' or 'D') in which nemo is defined |
itab | - Positional index of nemo within TAB |
irep | - Positional index within internal arrays, for use when nemo is replicated:
|
iknt | - Number of replications, for use when nemo is replicated using F=1 regular (i.e., non-delayed) replication:
|
jum0 | - Index value to be stored for nemo within internal jump/link table array jmpb(*) |
Definition at line 585 of file jumplink.F90.
References bort(), moda_tables::ibt, moda_nrv203::ibtnrv, inctab(), moda_nrv203::inodnrv, moda_nrv203::ipfnrv, moda_tables::irf, moda_tables::isc, moda_nrv203::isnrv, moda_tables::jmpb, moda_tables::jump, moda_tables::link, nemtbb(), moda_nrv203::nnrv, and moda_nrv203::tagnrv.
Referenced by tabsub().
subroutine tabsub | ( | integer, intent(in) | lun, |
character*8, intent(in) | nemo | ||
) |
Build and store the entire jump/link tree (including recursively resolving all "child" mnemonics) for a Table A mnemonic within the internal jump/link table.
lun | - File ID |
nemo | - Table A mnemonic |
Definition at line 333 of file jumplink.F90.
References bort(), moda_bitmaps::ctco, moda_tables::ibt, moda_nrv203::ibtnrv, moda_nrv203::ienrv, inctab(), moda_bitmaps::inodtamc, moda_bitmaps::inodtco, moda_nrv203::ipfnrv, moda_tables::irf, moda_nmikrp::irp, moda_tables::isc, moda_tables::jmpb, moda_tables::jump, moda_nmikrp::krp, moda_tables::link, moda_nmikrp::nem, nemtab(), nemtbd(), moda_nrv203::nnrv, moda_tables::ntab, moda_bitmaps::ntamc, moda_bitmaps::ntco, and tabent().
Referenced by makestab().