NCEPLIBS-bufr  12.0.0
nemtbb.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Get information about a Table B descriptor
3 C>
4 C> @author J. Woollen @date 1994-01-06
5 
6 C> Get information about a Table B descriptor.
7 C>
8 C> This subroutine returns information about a Table B descriptor
9 C> from the internal DX BUFR tables.
10 C>
11 C> @param[in] LUN - integer: File ID.
12 C> @param[in] ITAB - integer: Positional index of descriptor within
13 C> internal Table B.
14 C> @param[out] UNIT - character*24: Units of descriptor.
15 C> @param[out] ISCL - integer: Scale factor of descriptor.
16 C> @param[out] IREF - integer: Reference value of descriptor.
17 C> @param[out] IBIT - integer: Bit width of descriptor.
18 C>
19 C> @author J. Woollen @date 1994-01-06
20 
21  SUBROUTINE nemtbb(LUN,ITAB,UNIT,ISCL,IREF,IBIT)
22 
23  USE moda_tababd
24 
25  CHARACTER*128 BORT_STR
26  CHARACTER*24 UNIT
27  CHARACTER*8 NEMO
28  real*8 mxr
29 
30 C-----------------------------------------------------------------------
31 C-----------------------------------------------------------------------
32 
33  mxr = 1e11-1
34 
35  IF(itab.LE.0 .OR. itab.GT.ntbb(lun)) GOTO 900
36 
37 C PULL OUT TABLE B INFORMATION
38 C ----------------------------
39 
40  idn = idnb(itab,lun)
41  nemo = tabb(itab,lun)( 7:14)
42  unit = tabb(itab,lun)(71:94)
43  CALL strnum(tabb(itab,lun)( 95: 98),iscl,ierns)
44  CALL strnum(tabb(itab,lun)( 99:109),iref,ierns)
45  CALL strnum(tabb(itab,lun)(110:112),ibit,ierns)
46 
47 C CHECK TABLE B CONTENTS
48 C ----------------------
49 
50  IF(idn.LT.ifxy('000000')) GOTO 901
51  IF(idn.GT.ifxy('063255')) GOTO 901
52 
53  IF(iscl.LT.-999 .OR. iscl.GT.999) GOTO 902
54  IF(iref.LE.-mxr .OR. iref.GE.mxr) GOTO 903
55  IF(ibit.LE.0) GOTO 904
56  IF(unit(1:5).NE.'CCITT' .AND. ibit.GT.32 ) GOTO 904
57  IF(unit(1:5).EQ.'CCITT' .AND. mod(ibit,8).NE.0) GOTO 905
58 
59 C EXITS
60 C -----
61 
62  RETURN
63 900 WRITE(bort_str,'("BUFRLIB: NEMTBB - ITAB (",I7,") NOT FOUND IN '//
64  . 'TABLE B")') itab
65  CALL bort(bort_str)
66 901 WRITE(bort_str,'("BUFRLIB: NEMTBB - INTEGER REPRESENTATION OF '//
67  . 'DESCRIPTOR FOR TABLE B MNEMONIC ",A," (",I7,") IS OUTSIDE '//
68  . 'RANGE 0-16383 (16383 -> 0-63-255)")') nemo,idn
69  CALL bort(bort_str)
70 902 WRITE(bort_str,'("BUFRLIB: NEMTBB - SCALE VALUE FOR TABLE B '//
71  .'MNEMONIC ",A," (",I7,") IS OUTSIDE RANGE -999 TO 999")')
72  . nemo,iscl
73  CALL bort(bort_str)
74 903 WRITE(bort_str,'("BUFRLIB: NEMTBB - REFERENCE VALUE FOR TABLE B'//
75  .' MNEMONIC ",A," (",I7,") IS OUTSIDE RANGE +/- 1E11-1")')
76  . nemo,iref
77  CALL bort(bort_str)
78 904 WRITE(bort_str,'("BUFRLIB: NEMTBB - BIT WIDTH FOR NON-CHARACTER'//
79  . ' TABLE B MNEMONIC ",A," (",I7,") IS > 32")') nemo,ibit
80  CALL bort(bort_str)
81 905 WRITE(bort_str,'("BUFRLIB: NEMTBB - BIT WIDTH FOR CHARACTER '//
82  . 'TABLE B MNEMONIC ",A," (",I7,") IS NOT A MULTIPLE OF 8")')
83  . nemo,ibit
84  CALL bort(bort_str)
85  END
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18
function ifxy(ADSC)
Convert an FXY value from its 6 character representation to its WMO bit-wise representation.
Definition: ifxy.f:34
This module contains array and variable declarations used to store DX BUFR tables internally for mult...
integer, dimension(:), allocatable ntbb
Number of Table B entries for each internal I/O stream (up to a maximum of MAXTBB,...
integer, dimension(:,:), allocatable idnb
Bit-wise representations of the FXY values corresponding to tabb.
character *128, dimension(:,:), allocatable tabb
Table B entries for each internal I/O stream.
subroutine nemtbb(LUN, ITAB, UNIT, ISCL, IREF, IBIT)
Get information about a Table B descriptor.
Definition: nemtbb.f:22
recursive subroutine strnum(str, num, iret)
Decode an integer from a character string.
Definition: strnum.F90:24