NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
numtab.f
Go to the documentation of this file.
1 C> @file
2 C> @author WOOLLEN @date 1994-01-06
3 
4 C> THIS SUBROUTINE FIRST SEARCHES FOR AN INTEGER IDN,
5 C> CONTAINING THE BIT-WISE REPRESENTATION OF A DESCRIPTOR (FXY) VALUE,
6 C> WITHIN THE INTERNAL BUFR REPLICATION ARRAYS IN COMMON BLOCK /REPTAB/
7 C> TO SEE IF IDN IS A REPLICATION DESCRIPTOR OR A REPLICATION FACTOR
8 C> DESCRIPTOR. IF THIS SEARCH IS UNSUCCESSFUL, IT SEACHES FOR IDN
9 C> WITHIN THE INTERNAL BUFR TABLE D AND B ARRAYS TO SEE IF IDN IS A
10 C> TABLE D OR TABLE B DESCRIPTOR. IF THIS SEARCH IS ALSO UNSUCCESSFUL,
11 C> IT SEARCHES TO SEE IF IDN IS A TABLE C OPERATOR DESCRIPTOR. IF IDN
12 C> IS FOUND IN ANY OF THESE SEARCHES, THIS SUBROUTINE RETURNS THE
13 C> CORRESPONDING MNEMONIC AND OTHER INFORMATION FROM WITHIN EITHER THE
14 C> INTERNAL ARRAYS FOR REPLICATION, REPLICATION FACTOR, TABLE D OR
15 C> TABLE B DESCRIPTORS, OR ELSE FROM THE KNOWN VALUES FOR TABLE C
16 C> DESCRIPTORS. IF IDN IS NOT FOUND, IT RETURNS WITH IRET=0.
17 C>
18 C> PROGRAM HISTORY LOG:
19 C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
20 C> 1995-06-28 J. WOOLLEN -- INCREASED THE SIZE OF INTERNAL BUFR TABLE
21 C> ARRAYS IN ORDER TO HANDLE BIGGER FILES
22 C> 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
23 C> OPENED AT ONE TIME INCREASED FROM 10 TO 32
24 C> (NECESSARY IN ORDER TO PROCESS MULTIPLE
25 C> BUFR FILES UNDER THE MPI)
26 C> 2000-09-19 J. WOOLLEN -- ADDED CAPABILITY TO ENCODE AND DECODE DATA
27 C> USING THE OPERATOR DESCRIPTORS (BUFR TABLE
28 C> C) FOR CHANGING WIDTH AND CHANGING SCALE
29 C> 2003-11-04 J. ATOR -- ADDED DOCUMENTATION
30 C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
31 C> INTERDEPENDENCIES
32 C> 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED HISTORY
33 C> DOCUMENTATION; CORRECTED TYPO ("IDN" WAS
34 C> SPECIFIED AS "ID" IN CALCULATION OF IRET
35 C> FOR TAB='C')
36 C> 2005-11-29 J. ATOR -- ADDED SUPPORT FOR 207 AND 208 OPERATORS
37 C> 2009-04-21 J. ATOR -- USE NUMTBD
38 C> 2010-03-19 J. ATOR -- ADDED SUPPORT FOR 204 AND 205 OPERATORS
39 C> 2012-03-02 J. ATOR -- ADDED SUPPORT FOR 203 OPERATOR
40 C> 2015-02-25 J. ATOR -- ALLOW PROCESSING OF 2-2X, 2-3X AND 2-4X
41 C> NON-MARKER OPERATORS IN DX TABLES
42 C>
43 C> USAGE: CALL NUMTAB (LUN, IDN, NEMO, TAB, IRET)
44 C> INPUT ARGUMENT LIST:
45 C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
46 C> IDN - INTEGER: BIT-WISE REPRESENTATION OF DESCRIPTOR (FXY)
47 C> VALUE
48 C>
49 C> OUTPUT ARGUMENT LIST:
50 C> NEMO - CHARACTER*(*): MNEMONIC CORRESPONDING TO IDN
51 C> TAB - CHARACTER*1: TYPE OF FXY VALUE THAT IS BIT-WISE
52 C> REPRESENTED BY IDN:
53 C> 'B' = BUFR Table B descriptor
54 C> 'C' = BUFR Table C descriptor
55 C> 'D' = BUFR Table D descriptor
56 C> 'R' = BUFR replication descriptor
57 C> 'F' = BUFR replication factor descriptor
58 C> IRET - INTEGER: RETURN VALUE (SEE REMARKS)
59 C>
60 C> REMARKS:
61 C> THE INTERPRETATION OF THE RETURN VALUE IRET DEPENDS UPON THE
62 C> RETURN VALUE OF TAB AND THE INPUT VALUE IDN, AS FOLLOWS:
63 C>
64 C> IF ( TAB = 'B' ) THEN
65 C> IRET = positional index of IDN within internal BUFR Table B
66 C> array
67 C> ELSE IF ( TAB = 'C') THEN
68 C> IRET = the X portion of the FXY value that is bit-wise
69 C> represented by IDN
70 C> ELSE IF ( TAB = 'D') THEN
71 C> IRET = positional index of IDN within internal BUFR Table D
72 C> array
73 C> ELSE IF ( TAB = 'R') THEN
74 C> IF ( IDN denoted regular (i.e. non-delayed) replication ) THEN
75 C> IRET = ((-1)*Y), where Y is the number of replications
76 C> ELSE ( i.e. delayed replication )
77 C> IRET = positional index (=I) of IDN within internal
78 C> replication descriptor array IDNR(I,1), where:
79 C> IRET (=I) =2 --> 16-bit delayed replication descriptor
80 C> IRET (=I) =3 --> 8-bit delayed replication descriptor
81 C> IRET (=I) =4 --> 8-bit delayed replication descriptor
82 C> (stack)
83 C> IRET (=I) =5 --> 1-bit delayed replication descriptor
84 C> END IF
85 C> ELSE IF ( TAB = 'F') THEN
86 C> IRET = positional index (=I) of IDN within internal replication
87 C> factor array IDNR(I,2), where:
88 C> IRET (=I) =2 --> 16-bit replication factor
89 C> IRET (=I) =3 --> 8-bit replication factor
90 C> IRET (=I) =4 --> 8-bit replication factor
91 C> (stack)
92 C> IRET (=I) =5 --> 1-bit replication factor
93 C> ELSE IF ( IRET = 0 ) THEN
94 C> IDN was not found in internal BUFR Table B or D, nor does it
95 C> represent a Table C operator descriptor, a replication
96 C> descriptor, or a replication factor descriptor
97 C> END IF
98 C>
99 C>
100 C> THIS ROUTINE CALLS: ADN30 IOKOPER NUMTBD
101 C> THIS ROUTINE IS CALLED BY: CKTABA NEMTBD SEQSDX STNDRD
102 C> UFBQCP
103 C> Normally not called by any application
104 C> programs.
105 C>
106  SUBROUTINE numtab(LUN,IDN,NEMO,TAB,IRET)
107 
108 C Note that the values within the COMMON /REPTAB/ arrays were
109 C initialized within subroutine BFRINI.
110 
111  COMMON /reptab/ idnr(5,2),typs(5,2),reps(5,2),lens(5)
112 
113  CHARACTER*(*) nemo
114  CHARACTER*6 adn30,cid
115  CHARACTER*3 typs
116  CHARACTER*1 reps,tab
117 
118 C-----------------------------------------------------------------------
119 C-----------------------------------------------------------------------
120 
121  nemo = ' '
122  iret = 0
123  tab = ' '
124 
125 C LOOK FOR A REPLICATOR OR A REPLICATION FACTOR DESCRIPTOR
126 C --------------------------------------------------------
127 
128  IF(idn.GE.idnr(1,1) .AND. idn.LE.idnr(1,2)) THEN
129 
130 C Note that the above test is checking whether IDN is the bit-
131 C wise representation of a FXY (descriptor) value denoting F=1
132 C regular (i.e. non-delayed) replication, since, as was
133 C initialized within subroutine BFRINI,
134 C IDNR(1,1) = IFXY('101000'), and IDNR(1,2) = IFXY('101255').
135 
136  tab = 'R'
137  iret = -mod(idn,256)
138  goto 100
139  ENDIF
140 
141  DO i=2,5
142  IF(idn.EQ.idnr(i,1)) THEN
143  tab = 'R'
144  iret = i
145  goto 100
146  ELSEIF(idn.EQ.idnr(i,2)) THEN
147  tab = 'F'
148  iret = i
149  goto 100
150  ENDIF
151  ENDDO
152 
153 C LOOK FOR IDN IN TABLE B AND TABLE D
154 C -----------------------------------
155 
156  CALL numtbd(lun,idn,nemo,tab,iret)
157  IF(iret.NE.0) goto 100
158 
159 C LOOK FOR IDN IN TABLE C
160 C -----------------------
161 
162  cid = adn30(idn,6)
163  IF (iokoper(cid).EQ.1) THEN
164  nemo = cid(1:6)
165  READ(nemo,'(1X,I2)') iret
166  tab = 'C'
167  goto 100
168  ENDIF
169 
170 C EXIT
171 C ----
172 
173 100 RETURN
174  END
subroutine numtab(LUN, IDN, NEMO, TAB, IRET)
THIS SUBROUTINE FIRST SEARCHES FOR AN INTEGER IDN, CONTAINING THE BIT-WISE REPRESENTATION OF A DESCRI...
Definition: numtab.f:106
subroutine numtbd(LUN, IDN, NEMO, TAB, IRET)
THIS SUBROUTINE SEARCHES FOR AN INTEGER IDN, CONTAINING THE BIT-WISE REPRESENTATION OF A DESCRIPTOR (...
Definition: numtbd.f:54
character *(*) function adn30(IDN, L30)
This function converts a descriptor from its bit-wise (integer) representation to its 5 or 6 characte...
Definition: adn30.f:27
INTEGER function iokoper(NEMO)
This function determines whether a specified mnemonic is a Table C operator supported by the BUFRLIB ...
Definition: iokoper.f:22