NCEPLIBS-bufr  11.6.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> | Date | Programmer | Comments |
32 C> | -----|------------|----------|
33 C> | 2014-10-02 | J. Ator | Original version |
34 C> | 2014-12-10 | J. Ator | Use modules instead of COMMON blocks |
35 C>
36  SUBROUTINE nemdefs ( LUNIT, NEMO, CELEM, CUNIT, IRET )
37 
38  USE moda_tababd
39 
40  CHARACTER*1 tab
41 
42  CHARACTER*(*) nemo, celem, cunit
43 
44 C----------------------------------------------------------------------
45 C----------------------------------------------------------------------
46 
47  iret = -1
48 
49 C Get LUN from LUNIT.
50 
51  CALL status( lunit, lun, il, im )
52  IF ( il .EQ. 0 ) RETURN
53 
54 C Find the requested mnemonic in the internal Table B arrays.
55 
56  CALL nemtab( lun, nemo, idn, tab, iloc )
57  IF ( ( iloc .EQ. 0 ) .OR. ( tab .NE. 'B' ) ) RETURN
58 
59 C Get the element name and units of the requested mnemonic.
60 
61  celem = ' '
62  ls = min(len(celem),55)
63  celem(1:ls) = tabb(iloc,lun)(16:15+ls)
64 
65  cunit = ' '
66  ls = min(len(cunit),24)
67  cunit(1:ls) = tabb(iloc,lun)(71:70+ls)
68 
69  iret = 0
70 
71  RETURN
72  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:55
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:36
subroutine nemtab(LUN, NEMO, IDN, TAB, IRET)
This subroutine returns information about a descriptor from the internal DX BUFR tables, based on the mnemonic associated with that descriptor.
Definition: nemtab.f:44