NCEPLIBS-bufr
12.1.0
|
Convert between code or flag table values and actual data values. More...
Go to the source code of this file.
Functions/Subroutines | |
recursive subroutine | getcfmng (lunit, nemoi, ivali, nemod, ivald, cmeang, lnmng, iret) |
Decode the meaning of a numerical value from a code or flag table. More... | |
recursive real *8 function | pkftbv (nbits, ibit) |
Compute the numerical value equivalent to the setting of bit #(ibit) within a flag table of nbits bits. More... | |
recursive subroutine | ufbqcd (lunit, nemo, iqcd) |
Given a mnemonic associated with a category 63 Table D descriptor from an NCEP prepbufr file, return the corresponding event program code. More... | |
recursive subroutine | ufbqcp (lunit, iqcp, nemo) |
Given an event program code, which is equivalent to the Y value of a category 63 Table D descriptor from an NCEP prepbufr file, return the corresponding mnemonic. More... | |
recursive subroutine | upftbv (lunit, nemo, val, mxib, ibit, nib) |
Given a Table B mnemonic with flag table units and a corresponding numerical data value, this subroutine determines the bit settings equivalent to that numerical value. More... | |
Convert between code or flag table values and actual data values.
Definition in file cftbvs.F90.
recursive subroutine getcfmng | ( | integer, intent(in) | lunit, |
character*(*), intent(in) | nemoi, | ||
integer, intent(in) | ivali, | ||
character*(*), intent(in) | nemod, | ||
integer, intent(in) | ivald, | ||
character*(*), intent(out) | cmeang, | ||
integer, intent(out) | lnmng, | ||
integer, intent(out) | iret | ||
) |
Decode the meaning of a numerical value from a code or flag table.
Search for a specified Table B mnemonic and associated value (code figure or bit number) within the master Code/Flag tables, and if found return the associated meaning as a character string.
lunit | - Fortran logical unit number for BUFR file |
nemoi | - Mnemonic to search for |
ivali | - Value (code figure or bit number) associated with nemoi |
nemod | - Optional second mnemonic upon which the values nemoi and ivali depend; set to all blank characters if the meanings of nemoi and ivali do not depend on the value of any other mnemonic |
ivald | - Value (code figure or bit number) associated with nemod; set to (-1) whenever nemod is set to all blank characters |
cmeang | - If the initial search of the master Code/Flag tables was successful, then this string contains the meaning corresponding to nemoi and ivali (and to nemod and ivald, if specified). However, if the initial search was unsuccessful, and if no optional second mnemonic and associated value were specified on input, and if a second search of the table determines that the meaning of nemoi and ivali indeed depends on one or more other possible second mnemonics, then those possible second mnemonics are returned within this string, as a series of iret successive 8-byte substrings. An example of this scenario is included below within the Remarks. |
lnmng | - Length (in bytes) of string returned in cmeang |
iret | - Return code
|
As noted above, this subroutine first does an initial search of the master Code/Flag tables based on the mnemonics and values provided. The input parameters nemoi and ivali specify the mnemonic and corresponding numerical code or flag table value for which the meaning is sought, and the optional secondary parameters nemod and ivald are specified when needed to differentiate between multiple possible results. An example of this particular scenario is included below within the Remarks. Otherwise, if the meaning of nemod and ivald does not depend on the value associated with any other mnemonic, then nemod should be set to a field of all blank characters, and ivald should be set to a value of (-1).
Subroutine codflg() must be called with a cf value of 'Y' prior to calling this subroutine, in order to ensure that master Code/Flag tables have been read into internal memory.
This subroutine can be called at any time after a BUFR message has been read into internal arrays by one of the NCEPLIBS-bufr message-reading subroutines, and it can be called for any code or flag table mnemonic defined within that particular message. In most cases, this means that the mnemonic must be contained within the subset definition (Section 3) of that message. The only exceptions to this rule are for originating centers, originating subcenters, data types and data subtypes, since those can also be contained within the identification section (Section 1) of a BUFR message.
It is the user's responsibility to provide sufficient allocated space in cmeang for the returned meaning string; otherwise, the returned string will be truncated.
Definition at line 219 of file cftbvs.F90.
References bort(), moda_tablef::cdmf, ifxy(), ireadmt(), nemtab(), numtbd(), parstr(), status(), moda_tababd::tabb, x48(), and x84().
Referenced by fdebufr_c(), and satcode().
recursive real*8 function pkftbv | ( | integer, intent(in) | nbits, |
integer, intent(in) | ibit | ||
) |
Compute the numerical value equivalent to the setting of bit #(ibit) within a flag table of nbits bits.
If the computation fails for any reason, then the function returns the current placeholder value for "missing" data.
nbits | - Total number of bits in flag table |
ibit | - Number of bit to be set |
Definition at line 21 of file cftbvs.F90.
References x84().
recursive subroutine ufbqcd | ( | integer, intent(in) | lunit, |
character*(*), intent(in) | nemo, | ||
integer, intent(out) | iqcd | ||
) |
Given a mnemonic associated with a category 63 Table D descriptor from an NCEP prepbufr file, return the corresponding event program code.
The event program code is equivalent to the Y value of the category 63 (i.e. X=63) Table D descriptor. Knowledge of this value is especially useful for application programs which are writing data events to NCEP prepbufr files.
Logical unit lunit should have already been opened via a previous call to subroutine openbf().
This subroutine is the logical inverse of subroutine ufbqcp().
lunit | - Fortran logical unit number for NCEP prepbufr file |
nemo | - Mnemonic associated with a category 63 (i.e. X=63) Table D descriptor |
iqcd | - Y value of descriptor associated with nemo |
Definition at line 395 of file cftbvs.F90.
References adn30(), bort(), nemtab(), status(), x48(), and x84().
recursive subroutine ufbqcp | ( | integer, intent(in) | lunit, |
integer, intent(in) | iqcp, | ||
character*(*), intent(out) | nemo | ||
) |
Given an event program code, which is equivalent to the Y value of a category 63 Table D descriptor from an NCEP prepbufr file, return the corresponding mnemonic.
Logical unit lunit should have already been opened via a previous call to subroutine openbf().
This subroutine is the logical inverse of subroutine ufbqcd().
lunit | - Fortran logical unit number for NCEP prepbufr file |
iqcp | - Y value of a category 63 (i.e. X=63) Table D descriptor |
nemo | - Mnemonic associated with iqcp |
Definition at line 455 of file cftbvs.F90.
recursive subroutine upftbv | ( | integer, intent(in) | lunit, |
character*(*), intent(in) | nemo, | ||
real*8, intent(in) | val, | ||
integer, intent(in) | mxib, | ||
integer, dimension(*), intent(out) | ibit, | ||
integer, intent(out) | nib | ||
) |
Given a Table B mnemonic with flag table units and a corresponding numerical data value, this subroutine determines the bit settings equivalent to that numerical value.
This subroutine is the logical inverse of function pkftbv().
According to the WMO standard, bits within a bit field are numbered from left to right, so bit #1 is always the high-order i.e. most significant) bit in any bit field.
lunit | - Fortran logical unit number for BUFR file |
nemo | - Table B mnemonic with flag table units |
val | - Value corresponding to nemo |
mxib | - Dimensioned size (in integers) of ibit in the calling program; used by the subroutine to ensure that it doesn't overflow the ibit array |
ibit | - Bit numbers which were set to "On" (i.e. set to "1") in val |
nib | - Number of bit numbers returned in ibit |
Definition at line 69 of file cftbvs.F90.
References bort(), nemtab(), status(), strnum(), moda_tababd::tabb, x48(), and x84().