NCEPLIBS-bufr  12.1.0
cftbvs.F90 File Reference

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...
 

Detailed Description

Convert between code or flag table values and actual data values.

Author
J. Ator
Date
2005-11-29

Definition in file cftbvs.F90.

Function/Subroutine Documentation

◆ getcfmng()

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.

Parameters
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
  • 0 = meaning found and stored in cmeang string
  • -1 = meaning not found
  • >0 = meaning not found, and nemod and ivald were not specified on input, and the meaning of nemoi and ivali depends on the value of one of the mnemonics stored in the first iret 8-byte substrings of cmeang

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.

Remarks
  • An example of when secondary mnemonics nemod and ivald would be required is when a user is searching for the meaning of a numerical code table value for an originating sub-center (i.e. mnemonic GSES). The meaning of any originating sub-center value depends on the identity of the originating center for which the sub-center in question is a member, so in order for the subroutine to locate and return the proper one, information about the originating center must also be provided. So in this case the user would input GSES and the associated numerical value as nemoi and ivali, respectively, but the user would also need to specify an appropriate originating center mnemonic (e.g. GCLONG, OGCE or ORIGC) and associated value from the same BUFR message as input parameters nemod and ivald, respectively, and then the subroutine will be able to locate and return the appropriate meaning string. Otherwise, if this information was not provided, the subroutine would return with an iret value of 3, and with each of the mnemonics GCLONG, OGCE and ORIGC contained in successive 8-byte substrings of cmeang (and with a corresponding value of 24 returned for lnmng), as a hint to the user that more information needs to be input to the subroutine in order to achieve the desired result.
Author
J. Ator
Date
2018-01-11

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().

◆ pkftbv()

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.

Parameters
nbits- Total number of bits in flag table
ibit- Number of bit to be set
Returns
pkftbv - real*8: Value equivalent to the setting of bit #(ibit) within a flag table of nbits bits
Remarks
  • This function is the logical inverse of subroutine upftbv().
  • 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.
Author
J. Ator
Date
2005-11-29

Definition at line 21 of file cftbvs.F90.

References x84().

◆ ufbqcd()

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().

Parameters
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
Author
J. Woollen
Date
1994-01-06

Definition at line 395 of file cftbvs.F90.

References adn30(), bort(), nemtab(), status(), x48(), and x84().

◆ ufbqcp()

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().

Parameters
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
Author
J. Woollen
Date
1994-01-06

Definition at line 455 of file cftbvs.F90.

References bort(), ifxy(), numtab(), status(), and x84().

◆ upftbv()

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.

Parameters
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
Author
J. Ator
Date
2005-11-29

Definition at line 69 of file cftbvs.F90.

References bort(), nemtab(), status(), strnum(), moda_tababd::tabb, x48(), and x84().

Referenced by ufbdmp(), and ufdump().