NCEPLIBS-bufr  11.6.0
 All Data Structures Files Functions Variables Pages
nemtbb.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Get information about a Table B descriptor
3 
4 C> This subroutine returns information about a Table B descriptor
5 C> from the internal DX BUFR tables.
6 C>
7 C> @author J. Woollen
8 C> @date 1994-01-06
9 C>
10 C> @param[in] LUN -- integer: Internal I/O stream index associated
11 C> with DX BUFR tables
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> <b>Program history log:</b>
20 C> | Date | Programmer | Comments |
21 C> | -----|------------|----------|
22 C> | 1994-01-06 | J. Woollen | Original author |
23 C> | 1995-06-28 | J. Woollen | Increased the size of internal BUFR table arrays in order to handle bigger files |
24 C> | 1998-07-08 | J. Woollen | Replaced call to Cray library routine "ABORT" with call to new internal routine bort() |
25 C> | 1999-11-18 | J. Woollen | Changed call to function "val$" to valx() |
26 C> | 2003-11-04 | J. Ator | Added documentation |
27 C> | 2003-11-04 | S. Bender | Added remarks/bufrlib routine interdependencies |
28 C> | 2003-11-04 | D. Keyser | Unified/portable for WRF; added documentation; outputs more complete diagnostic info when routine terminates abnormally |
29 C> | 2014-12-10 | J. Ator | Use modules instead of COMMON blocks |
30 C>
31  SUBROUTINE nemtbb(LUN,ITAB,UNIT,ISCL,IREF,IBIT)
32 
33  USE moda_tababd
34 
35  CHARACTER*128 bort_str
36  CHARACTER*24 unit
37  CHARACTER*8 nemo
38  REAL*8 mxr
39 
40 C-----------------------------------------------------------------------
41 C-----------------------------------------------------------------------
42 
43  mxr = 1e11-1
44 
45  IF(itab.LE.0 .OR. itab.GT.ntbb(lun)) goto 900
46 
47 C PULL OUT TABLE B INFORMATION
48 C ----------------------------
49 
50  idn = idnb(itab,lun)
51  nemo = tabb(itab,lun)( 7:14)
52  unit = tabb(itab,lun)(71:94)
53  iscl = valx(tabb(itab,lun)( 95: 98))
54  iref = valx(tabb(itab,lun)( 99:109))
55  ibit = valx(tabb(itab,lun)(110:112))
56 
57 C CHECK TABLE B CONTENTS
58 C ----------------------
59 
60  IF(idn.LT.ifxy('000000')) goto 901
61  IF(idn.GT.ifxy('063255')) goto 901
62 
63  IF(iscl.LT.-999 .OR. iscl.GT.999) goto 902
64  IF(iref.LE.-mxr .OR. iref.GE.mxr) goto 903
65  IF(ibit.LE.0) goto 904
66  IF(unit(1:5).NE.'CCITT' .AND. ibit.GT.32 ) goto 904
67  IF(unit(1:5).EQ.'CCITT' .AND. mod(ibit,8).NE.0) goto 905
68 
69 C EXITS
70 C -----
71 
72  RETURN
73 900 WRITE(bort_str,'("BUFRLIB: NEMTBB - ITAB (",I7,") NOT FOUND IN '//
74  . 'TABLE B")') itab
75  CALL bort(bort_str)
76 901 WRITE(bort_str,'("BUFRLIB: NEMTBB - INTEGER REPRESENTATION OF '//
77  . 'DESCRIPTOR FOR TABLE B MNEMONIC ",A," (",I7,") IS OUTSIDE '//
78  . 'RANGE 0-16383 (16383 -> 0-63-255)")') nemo,idn
79  CALL bort(bort_str)
80 902 WRITE(bort_str,'("BUFRLIB: NEMTBB - SCALE VALUE FOR TABLE B '//
81  .'MNEMONIC ",A," (",I7,") IS OUTSIDE RANGE -999 TO 999")')
82  . nemo,iscl
83  CALL bort(bort_str)
84 903 WRITE(bort_str,'("BUFRLIB: NEMTBB - REFERENCE VALUE FOR TABLE B'//
85  .' MNEMONIC ",A," (",I7,") IS OUTSIDE RANGE +/- 1E11-1")')
86  . nemo,iref
87  CALL bort(bort_str)
88 904 WRITE(bort_str,'("BUFRLIB: NEMTBB - BIT WIDTH FOR NON-CHARACTER'//
89  . ' TABLE B MNEMONIC ",A," (",I7,") IS > 32")') nemo,ibit
90  CALL bort(bort_str)
91 905 WRITE(bort_str,'("BUFRLIB: NEMTBB - BIT WIDTH FOR CHARACTER '//
92  . 'TABLE B MNEMONIC ",A," (",I7,") IS NOT A MULTIPLE OF 8")')
93  . nemo,ibit
94  CALL bort(bort_str)
95  END
function valx(STR)
This function decodes a real number from a character string.
Definition: valx.f:25
This module contains array and variable declarations used to store DX BUFR tables internally for mult...
Definition: moda_tababd.F:10
subroutine nemtbb(LUN, ITAB, UNIT, ISCL, IREF, IBIT)
This subroutine returns information about a Table B descriptor from the internal DX BUFR tables...
Definition: nemtbb.f:31
function ifxy(ADSC)
This function converts an FXY value from its 6 character representation to its bit-wise (integer) rep...
Definition: ifxy.f:42
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:22