NCEPLIBS-bufr  12.0.1
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 C>
5 C> @author J. Ator @date 2014-10-02
6 
7 C> Given a Table B mnemonic defined in the
8 C> [DX BUFR Tables](@ref dfbftab) associated with a BUFR file
9 C> (or in the [master BUFR tables](@ref dfbfmstab), if the file
10 C> was opened in subroutine openbf() with IO = 'SEC3'), this
11 C> subroutine returns the element name and units associated
12 C> with that mnemonic.
13 C>
14 C> @param[in] LUNIT - integer: Fortran logical unit number for
15 C> BUFR file
16 C> @param[in] NEMO - character*(*): Table B mnemonic
17 C> @param[out] CELEM - character*55: Element name associated
18 C> with NEMO
19 C> @param[out] CUNIT - character*24: Units associated with NEMO
20 C> @param[out] IRET - integer: return code
21 C> - 0 normal return
22 C> - -1 NEMO could not be found, or some
23 C> other error occurred
24 C>
25 C> Logical unit LUNIT should have already been opened for
26 C> input or output operations via a previous call to subroutine
27 C> openbf().
28 C>
29 C> @author J. Ator @date 2014-10-02
30 
31  RECURSIVE SUBROUTINE nemdefs ( LUNIT, NEMO, CELEM, CUNIT, IRET )
32 
33  USE moda_tababd
34  USE modv_im8b
35 
36  CHARACTER*1 tab
37 
38  CHARACTER*(*) nemo, celem, cunit
39 
40 C----------------------------------------------------------------------
41 C----------------------------------------------------------------------
42 
43 C Check for I8 integers.
44 
45  IF(im8b) THEN
46  im8b=.false.
47 
48  CALL x84 ( lunit, my_lunit, 1 )
49  CALL nemdefs ( my_lunit, nemo, celem, cunit, iret )
50  CALL x48 ( iret, iret, 1 )
51 
52  im8b=.true.
53  RETURN
54  ENDIF
55 
56  iret = -1
57 
58 C Get LUN from LUNIT.
59 
60  CALL status( lunit, lun, il, im )
61  IF ( il .EQ. 0 ) RETURN
62 
63 C Find the requested mnemonic in the internal Table B arrays.
64 
65  CALL nemtab( lun, nemo, idn, tab, iloc )
66  IF ( ( iloc .EQ. 0 ) .OR. ( tab .NE. 'B' ) ) RETURN
67 
68 C Get the element name and units of the requested mnemonic.
69 
70  celem = ' '
71  ls = min(len(celem),55)
72  celem(1:ls) = tabb(iloc,lun)(16:15+ls)
73 
74  cunit = ' '
75  ls = min(len(cunit),24)
76  cunit(1:ls) = tabb(iloc,lun)(71:70+ls)
77 
78  iret = 0
79 
80  RETURN
81  END
This module contains array and variable declarations used to store DX BUFR tables internally for mult...
character *128, dimension(:,:), allocatable tabb
Table B entries for each internal I/O stream.
This module declares and initializes the IM8B variable.
logical, public im8b
Status indicator to keep track of whether all future calls to BUFRLIB subroutines and functions from ...
recursive 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:32
subroutine nemtab(LUN, NEMO, IDN, TAB, IRET)
Get information about a descriptor, based on the mnemonic.
Definition: nemtab.f:29
recursive subroutine status(LUNIT, LUN, IL, IM)
Check whether a specified Fortran logical unit number is currently connected to the NCEPLIBS-bufr sof...
Definition: status.f:36
subroutine x48(IIN4, IOUT8, NVAL)
Encode one or more 4-byte integer values as 8-byte integer values.
Definition: x48.F:19
subroutine x84(IIN8, IOUT4, NVAL)
Encode one or more 8-byte integer values as 4-byte integer values.
Definition: x84.F:19