NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
nemtbb.f
Go to the documentation of this file.
1 C> @file
2 C> @author WOOLLEN @date 1994-01-06
3 
4 C> THIS SUBROUTINE CHECKS ALL OF THE PROPERTIES (E.G. FXY
5 C> VALUE, UNITS, SCALE FACTOR, REFERENCE VALUE, ETC.) OF A SPECIFIED
6 C> MNEMONIC WITHIN THE INTERNAL BUFR TABLE B ARRAYS (IN MODULE
7 C> TABABD) IN ORDER TO VERIFY THAT THE VALUES OF THOSE PROPERTIES
8 C> ARE ALL LEGAL AND WELL-DEFINED. IF ANY ERRORS ARE FOUND, THEN AN
9 C> APPROPRIATE CALL IS MADE TO BUFR ARCHIVE LIBRARY SUBROUTINE BORT.
10 C>
11 C> PROGRAM HISTORY LOG:
12 C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
13 C> 1995-06-28 J. WOOLLEN -- INCREASED THE SIZE OF INTERNAL BUFR TABLE
14 C> ARRAYS IN ORDER TO HANDLE BIGGER FILES
15 C> 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
16 C> "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
17 C> ROUTINE "BORT"; CORRECTED SOME MINOR ERRORS
18 C> 1999-11-18 J. WOOLLEN -- CHANGED CALL TO FUNCTION "VAL$" TO "VALX"
19 C> (IT HAS BEEN RENAMED TO REMOVE THE
20 C> POSSIBILITY OF THE "$" SYMBOL CAUSING
21 C> PROBLEMS ON OTHER PLATFORMS)
22 C> 2003-11-04 J. ATOR -- ADDED DOCUMENTATION
23 C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
24 C> INTERDEPENDENCIES
25 C> 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED HISTORY
26 C> DOCUMENTATION; OUTPUTS MORE COMPLETE
27 C> DIAGNOSTIC INFO WHEN ROUTINE TERMINATES
28 C> ABNORMALLY
29 C> 2014-12-10 J. ATOR -- USE MODULES INSTEAD OF COMMON BLOCKS
30 C>
31 C> USAGE: CALL NEMTBB (LUN, ITAB, UNIT, ISCL, IREF, IBIT)
32 C> INPUT ARGUMENT LIST:
33 C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
34 C> ITAB - INTEGER: POSITIONAL INDEX INTO INTERNAL BUFR TABLE B
35 C> ARRAYS FOR MNEMONIC TO BE CHECKED
36 C>
37 C> OUTPUT ARGUMENT LIST:
38 C> UNIT - CHARACTER*24: UNITS OF MNEMONIC
39 C> ISCL - INTEGER: SCALE FACTOR OF MNEMONIC
40 C> IREF - INTEGER: REFERENCE VALUE OF MNEMONIC
41 C> IBIT - INTEGER: BIT WIDTH OF MNEMONIC
42 C>
43 C> REMARKS:
44 C> THIS ROUTINE CALLS: BORT IFXY VALX
45 C> THIS ROUTINE IS CALLED BY: CHEKSTAB RESTD TABENT
46 C> Normally not called by any application
47 C> programs.
48 C>
49  SUBROUTINE nemtbb(LUN,ITAB,UNIT,ISCL,IREF,IBIT)
50 
51  USE moda_tababd
52 
53  CHARACTER*128 bort_str
54  CHARACTER*24 unit
55  CHARACTER*8 nemo
56  REAL*8 mxr
57 
58 C-----------------------------------------------------------------------
59 C-----------------------------------------------------------------------
60 
61  mxr = 1e11-1
62 
63  IF(itab.LE.0 .OR. itab.GT.ntbb(lun)) goto 900
64 
65 C PULL OUT TABLE B INFORMATION
66 C ----------------------------
67 
68  idn = idnb(itab,lun)
69  nemo = tabb(itab,lun)( 7:14)
70  unit = tabb(itab,lun)(71:94)
71  iscl = valx(tabb(itab,lun)( 95: 98))
72  iref = valx(tabb(itab,lun)( 99:109))
73  ibit = valx(tabb(itab,lun)(110:112))
74 
75 C CHECK TABLE B CONTENTS
76 C ----------------------
77 
78  IF(idn.LT.ifxy('000000')) goto 901
79  IF(idn.GT.ifxy('063255')) goto 901
80 
81  IF(iscl.LT.-999 .OR. iscl.GT.999) goto 902
82  IF(iref.LE.-mxr .OR. iref.GE.mxr) goto 903
83  IF(ibit.LE.0) goto 904
84  IF(unit(1:5).NE.'CCITT' .AND. ibit.GT.32 ) goto 904
85  IF(unit(1:5).EQ.'CCITT' .AND. mod(ibit,8).NE.0) goto 905
86 
87 C EXITS
88 C -----
89 
90  RETURN
91 900 WRITE(bort_str,'("BUFRLIB: NEMTBB - ITAB (",I7,") NOT FOUND IN '//
92  . 'TABLE B")') itab
93  CALL bort(bort_str)
94 901 WRITE(bort_str,'("BUFRLIB: NEMTBB - INTEGER REPRESENTATION OF '//
95  . 'DESCRIPTOR FOR TABLE B MNEMONIC ",A," (",I7,") IS OUTSIDE '//
96  . 'RANGE 0-16383 (16383 -> 0-63-255)")') nemo,idn
97  CALL bort(bort_str)
98 902 WRITE(bort_str,'("BUFRLIB: NEMTBB - SCALE VALUE FOR TABLE B '//
99  .'MNEMONIC ",A," (",I7,") IS OUTSIDE RANGE -999 TO 999")')
100  . nemo,iscl
101  CALL bort(bort_str)
102 903 WRITE(bort_str,'("BUFRLIB: NEMTBB - REFERENCE VALUE FOR TABLE B'//
103  .' MNEMONIC ",A," (",I7,") IS OUTSIDE RANGE +/- 1E11-1")')
104  . nemo,iref
105  CALL bort(bort_str)
106 904 WRITE(bort_str,'("BUFRLIB: NEMTBB - BIT WIDTH FOR NON-CHARACTER'//
107  . ' TABLE B MNEMONIC ",A," (",I7,") IS > 32")') nemo,ibit
108  CALL bort(bort_str)
109 905 WRITE(bort_str,'("BUFRLIB: NEMTBB - BIT WIDTH FOR CHARACTER '//
110  . 'TABLE B MNEMONIC ",A," (",I7,") IS NOT A MULTIPLE OF 8")')
111  . nemo,ibit
112  CALL bort(bort_str)
113  END
function valx(STR)
THIS FUNCTION DECODES A REAL NUMBER FROM A CHARACTER STRING.
Definition: valx.f:39
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 CHECKS ALL OF THE PROPERTIES (E.G.
Definition: nemtbb.f:49
function ifxy(ADSC)
THIS FUNCTION RETURNS THE INTEGER CORRESPONDING TO THE BIT-WISE REPRESENTATION OF AN INPUT CHARACTER ...
Definition: ifxy.f:49
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23