NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
nemdefs.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Get the element name and units associated with a
3 C> Table B mnemonic.
4 
5 C> Given a Table B mnemonic defined in the
6 C> [DX BUFR Tables](@ref dfbftab) associated with a BUFR file
7 C> (or in the [master BUFR tables](@ref dfbfmstab), if the file
8 C> was opened in subroutine openbf() with IO = 'SEC3'), this
9 C> subroutine returns the element name and units associated
10 C> with that mnemonic.
11 C>
12 C> @author J. Ator
13 C> @date 2014-10-02
14 C>
15 C> @param[in] LUNIT - integer: Fortran logical unit number for
16 C> BUFR file
17 C> @param[in] NEMO - character*(*): Table B mnemonic
18 C> @param[out] CELEM - character*55: Element name associated
19 C> with NEMO
20 C> @param[out] CUNIT - character*24: Units associated with NEMO
21 C> @param[out] IRET - integer: return code
22 C> - 0 = normal return
23 C> - -1 = NEMO could not be found, or some
24 C> other error occurred
25 C>
26 C> <p>Logical unit LUNIT should have already been opened for
27 C> input or output operations via a previous call to subroutine
28 C> openbf().
29 C>
30 C> <b>Program history log:</b>
31 C> - 2014-10-02 J. Ator -- Original version
32 C> - 2014-12-10 J. Ator -- Use modules instead of COMMON blocks
33 C>
34  SUBROUTINE nemdefs ( LUNIT, NEMO, CELEM, CUNIT, IRET )
35 
36  USE moda_tababd
37 
38  CHARACTER*1 tab
39 
40  CHARACTER*(*) nemo, celem, cunit
41 
42 C----------------------------------------------------------------------
43 C----------------------------------------------------------------------
44 
45  iret = -1
46 
47 C Get LUN from LUNIT.
48 
49  CALL status( lunit, lun, il, im )
50  IF ( il .EQ. 0 ) RETURN
51 
52 C Find the requested mnemonic in the internal Table B arrays.
53 
54  CALL nemtab( lun, nemo, idn, tab, iloc )
55  IF ( ( iloc .EQ. 0 ) .OR. ( tab .NE. 'B' ) ) RETURN
56 
57 C Get the element name and units of the requested mnemonic.
58 
59  celem = ' '
60  ls = min(len(celem),55)
61  celem(1:ls) = tabb(iloc,lun)(16:15+ls)
62 
63  cunit = ' '
64  ls = min(len(cunit),24)
65  cunit(1:ls) = tabb(iloc,lun)(71:70+ls)
66 
67  iret = 0
68 
69  RETURN
70  END
This module contains array and variable declarations used to store DX BUFR tables internally for mult...
Definition: moda_tababd.F:10
subroutine status(LUNIT, LUN, IL, IM)
This subroutine checks whether a specified Fortran logical unit number is currently connected to the ...
Definition: status.f:61
subroutine nemdefs(LUNIT, NEMO, CELEM, CUNIT, IRET)
Given a Table B mnemonic defined in the DX BUFR Tables associated with a BUFR file (or in the master ...
Definition: nemdefs.f:34
subroutine nemtab(LUN, NEMO, IDN, TAB, IRET)
THIS SUBROUTINE SEARCHES FOR MNEMONIC NEMO WITHIN THE INTERNAL TABLE B AND D ARRAYS HOLDING THE DICTI...
Definition: nemtab.f:66