NCEPLIBS-bufr 11.7.1
nemdefs.f
Go to the documentation of this file.
1C> @file
2C> @brief Get the element name and units associated with a
3C> Table B mnemonic.
4
5C> Given a Table B mnemonic defined in the
6C> [DX BUFR Tables](@ref dfbftab) associated with a BUFR file
7C> (or in the [master BUFR tables](@ref dfbfmstab), if the file
8C> was opened in subroutine openbf() with IO = 'SEC3'), this
9C> subroutine returns the element name and units associated
10C> with that mnemonic.
11C>
12C> @author J. Ator
13C> @date 2014-10-02
14C>
15C> @param[in] LUNIT -- integer: Fortran logical unit number for
16C> BUFR file
17C> @param[in] NEMO -- character*(*): Table B mnemonic
18C> @param[out] CELEM -- character*55: Element name associated
19C> with NEMO
20C> @param[out] CUNIT -- character*24: Units associated with NEMO
21C> @param[out] IRET -- integer: return code
22C> - 0 = normal return
23C> - -1 = NEMO could not be found, or some
24C> other error occurred
25C>
26C> <p>Logical unit LUNIT should have already been opened for
27C> input or output operations via a previous call to subroutine
28C> openbf().
29C>
30C> <b>Program history log:</b>
31C> | Date | Programmer | Comments |
32C> | -----|------------|----------|
33C> | 2014-10-02 | J. Ator | Original version |
34C> | 2014-12-10 | J. Ator | Use modules instead of COMMON blocks |
35C>
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
44C----------------------------------------------------------------------
45C----------------------------------------------------------------------
46
47 iret = -1
48
49C Get LUN from LUNIT.
50
51 CALL status( lunit, lun, il, im )
52 IF ( il .EQ. 0 ) RETURN
53
54C 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
59C 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
character *128, dimension(:,:), allocatable tabb
Table B entries for each internal I/O stream.
Definition: moda_tababd.F:59
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:37
subroutine nemtab(LUN, NEMO, IDN, TAB, IRET)
This subroutine returns information about a descriptor from the internal DX BUFR tables,...
Definition: nemtab.f:45
subroutine status(LUNIT, LUN, IL, IM)
This subroutine checks whether a specified Fortran logical unit number is currently connected to the ...
Definition: status.f:56