NCEPLIBS-bufr 11.7.1
rdusdx.f
Go to the documentation of this file.
1C> @file
2C> @author WOOLLEN @date 1994-01-06
3
4C> THIS SUBROUTINE READS AND PARSES A FILE CONTAINING A USER-
5C> SUPPLIED BUFR DICTIONARY TABLE IN CHARACTER FORMAT, AND THEN STORES
6C> THIS INFORMATION INTO INTERNAL ARRAYS IN MODULE TABABD (SEE REMARKS
7C> FOR CONTENTS OF INTERNAL ARRAYS). THIS SUBROUTINE PERFORMS
8C> A FUNCTION SIMILAR TO BUFR ARCHIVE LIBRARY SUBROUTINE RDBFDX,
9C> EXECPT THAT RDBFDX READS THE BUFR TABLE DIRECTLY FROM MESSAGES AT
10C> BEGINNING OF AN INPUT BUFR FILE.
11C>
12C> PROGRAM HISTORY LOG:
13C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
14C> 1995-06-28 J. WOOLLEN -- INCREASED THE SIZE OF INTERNAL BUFR TABLE
15C> ARRAYS IN ORDER TO HANDLE BIGGER FILES
16C> 1996-12-17 J. WOOLLEN -- FIXED FOR SOME MVS COMPILER'S TREATMENT OF
17C> INTERNAL READS (INCREASES PORTABILITY)
18C> 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
19C> "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
20C> ROUTINE "BORT"; CORRECTED SOME MINOR ERRORS
21C> 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
22C> OPENED AT ONE TIME INCREASED FROM 10 TO 32
23C> (NECESSARY IN ORDER TO PROCESS MULTIPLE
24C> BUFR FILES UNDER THE MPI)
25C> 2003-11-04 J. ATOR -- ADDED DOCUMENTATION
26C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
27C> INTERDEPENDENCIES
28C> 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED HISTORY
29C> DOCUMENTATION; OUTPUTS MORE COMPLETE
30C> DIAGNOSTIC INFO WHEN ROUTINE TERMINATES
31C> ABNORMALLY; CHANGED CALL FROM BORT TO BORT2
32C> 2006-04-14 D. KEYSER -- ABORTS IF A USER-DEFINED MESSAGE TYPE "011"
33C> IS READ (EITHER DIRECTLY FROM A TABLE A
34C> MNEMONIC OR FROM THE "Y" VALUE OF A TABLE A
35C> FXY SEQUENCE DESCRIPTOR), MESSAGE TYPE
36C> "011" IS RESERVED FOR DICTIONARY MESSAGES
37C> (PREVIOUSLY WOULD STORE DATA WITH MESSAGE
38C> TYPE "011" BUT SUCH MESSAGES WOULD BE
39C> SKIPPED OVER WHEN READ)
40C> 2007-01-19 J. ATOR -- MODIFIED IN RESPONSE TO NUMBCK CHANGES
41C> 2009-03-23 J. ATOR -- INCREASE SIZE OF BORT_STR2; USE STNTBIA
42C> 2013-01-08 J. WHITING -- ADD ERR= OPTION TO READ STATEMENT
43C> 2014-12-10 J. ATOR -- USE MODULES INSTEAD OF COMMON BLOCKS
44C>
45C> USAGE: CALL RDUSDX (LUNDX, LUN)
46C> INPUT ARGUMENT LIST:
47C> LUNDX - INTEGER: FORTRAN LOGICAL UNIT NUMBER FOR USER-
48C> SUPPLIED BUFR DICTIONARY TABLE IN CHARACTER FORMAT
49C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
50C>
51C> INPUT FILES:
52C> UNIT "LUNDX" - USER-SUPPLIED BUFR DICTIONARY TABLE IN CHARACTER
53C> FORMAT
54C>
55C> REMARKS:
56C>
57C> THIS ROUTINE CALLS: BORT2 DXINIT ELEMDX IGETNTBI
58C> MAKESTAB NEMOCK NUMBCK SEQSDX
59C> STNTBI STNTBIA
60C> THIS ROUTINE IS CALLED BY: CKTABA READDX
61C> Normally not called by any application
62C> programs.
63C>
64 SUBROUTINE rdusdx(LUNDX,LUN)
65
66 USE moda_tababd
67
68 CHARACTER*128 BORT_STR1
69 CHARACTER*156 BORT_STR2
70 CHARACTER*80 CARD
71 CHARACTER*8 NEMO
72 CHARACTER*6 NUMB,NMB2
73
74C-----------------------------------------------------------------------
75C-----------------------------------------------------------------------
76
77C INITIALIZE THE DICTIONARY TABLE CONTROL WORD PARTITION ARRAYS
78C WITH APRIORI TABLE B AND D ENTRIES
79C --------------------------------------------------------------
80
81 CALL dxinit(lun,1)
82 rewind lundx
83
84C READ USER CARDS UNTIL THERE ARE NO MORE
85C ---------------------------------------
86
871 READ(lundx,'(A80)',END=200,ERR=200) card
88
89C REREAD IF NOT A DEFINITION CARD
90C -------------------------------
91
92c .... This is a comment line
93 IF(card(1: 1).EQ. '*') GOTO 1
94c .... This is a separation line
95 IF(card(3:10).EQ.'--------') GOTO 1
96c .... This is a blank line
97 IF(card(3:10).EQ.' ') GOTO 1
98c .... This is a header line
99 IF(card(3:10).EQ.'MNEMONIC') GOTO 1
100c .... This is a header line
101 IF(card(3:10).EQ.'TABLE D') GOTO 1
102c .... This is a header line
103 IF(card(3:10).EQ.'TABLE B') GOTO 1
104
105C PARSE A DESCRIPTOR DEFINITION CARD
106C ----------------------------------
107
108 IF(card(12:12).EQ.'|' .AND. card(21:21).EQ.'|') THEN
109
110c .... NEMO is the 8-character mnemonic name
111 nemo = card(3:10)
112 iret=nemock(nemo)
113 IF(iret.EQ.-1) GOTO 900
114 IF(iret.EQ.-2) GOTO 901
115
116c .... NUMB is the 6-character FXY value corresponding to NEMO
117 numb = card(14:19)
118 nmb2 = numb
119 IF(nmb2(1:1).EQ.'A') nmb2(1:1) = '3'
120 iret=numbck(nmb2)
121 IF(iret.EQ.-1) GOTO 902
122 IF(iret.EQ.-2) GOTO 903
123 IF(iret.EQ.-3) GOTO 904
124 IF(iret.EQ.-4) GOTO 905
125
126C TABLE A DESCRIPTOR FOUND
127C ------------------------
128
129 IF(numb(1:1).EQ.'A') THEN
130 n = igetntbi( lun, 'A' )
131 CALL stntbia ( n, lun, numb, nemo, card(23:) )
132 IF ( idna(n,lun,1) .EQ. 11 ) GOTO 906
133c .... Replace "A" with "3" so Table D descriptor will be found in
134c .... card as well (see below)
135 numb(1:1) = '3'
136 ENDIF
137
138C TABLE B DESCRIPTOR FOUND
139C ------------------------
140
141 IF(numb(1:1).EQ.'0') THEN
142 CALL stntbi ( igetntbi(lun,'B'), lun, numb, nemo, card(23:) )
143 GOTO 1
144 ENDIF
145
146C TABLE D DESCRIPTOR FOUND
147C ------------------------
148
149 IF(numb(1:1).EQ.'3') THEN
150 CALL stntbi ( igetntbi(lun,'D'), lun, numb, nemo, card(23:) )
151 GOTO 1
152 ENDIF
153
154c .... First character of NUMB is not 'A', '0' or '3'
155 GOTO 902
156
157 ENDIF
158
159C PARSE A SEQUENCE DEFINITION CARD
160C --------------------------------
161
162 IF(card(12:12).EQ.'|' .AND. card(19:19).NE.'|') THEN
163 CALL seqsdx(card,lun)
164 GOTO 1
165 ENDIF
166
167C PARSE AN ELEMENT DEFINITION CARD
168C --------------------------------
169
170 IF(card(12:12).EQ.'|' .AND. card(19:19).EQ.'|') THEN
171 CALL elemdx(card,lun)
172 GOTO 1
173 ENDIF
174
175C CAN'T FIGURE OUT WHAT KIND OF CARD IT IS
176C ----------------------------------------
177
178 GOTO 907
179
180C NORMAL ENDING
181C -------------
182
183200 CALL makestab
184
185C EXITS
186C -----
187
188 RETURN
189900 WRITE(bort_str1,'("BUFRLIB: RDUSDX - CARD READ IN IS: ",A)') card
190 WRITE(bort_str2,'(18X,"MNEMONIC ",A," IN USER DICTIONARY IS NOT'//
191 . ' BETWEEN 1 AND 8 CHARACTERS")') nemo
192 CALL bort2(bort_str1,bort_str2)
193901 WRITE(bort_str1,'("BUFRLIB: RDUSDX - CARD READ IN IS: ",A)') card
194 WRITE(bort_str2,'(18X,"MNEMONIC ",A," IN USER DICTIONARY HAS '//
195 . 'INVALID CHARACTERS")') nemo
196 CALL bort2(bort_str1,bort_str2)
197902 WRITE(bort_str1,'("BUFRLIB: RDUSDX - CARD READ IN IS: ",A)') card
198 WRITE(bort_str2,'(18X,"DESCRIPTOR NUMBER ",A," IN USER '//
199 . 'DICTIONARY HAS AN INVALID FIRST CHARACTER (F VALUE) - MUST BE'//
200 . ' A, 0 OR 3")') numb
201 CALL bort2(bort_str1,bort_str2)
202903 WRITE(bort_str1,'("BUFRLIB: RDUSDX - CARD READ IN IS: ",A)') card
203 WRITE(bort_str2,'(18X,"DESCRIPTOR NUMBER ",A," IN USER '//
204 . 'DICTIONARY HAS NON-NUMERIC VALUES IN CHARACTERS 2-6 (X AND Y '//
205 . 'VALUES)")') numb
206 CALL bort2(bort_str1,bort_str2)
207904 WRITE(bort_str1,'("BUFRLIB: RDUSDX - CARD READ IN IS: ",A)') card
208 WRITE(bort_str2,'(18X,"DESCRIPTOR NUMBER ",A," IN USER '//
209 . 'DICTIONARY HAS INVALID NUMBER IN CHARACTERS 2-3 (X VALUE) - '//
210 . 'MUST BE BETWEEN 00 AND 63")') numb
211 CALL bort2(bort_str1,bort_str2)
212905 WRITE(bort_str1,'("BUFRLIB: RDUSDX - CARD READ IN IS: ",A)') card
213 WRITE(bort_str2,'(18X,"DESCRIPTOR NUMBER ",A," IN USER '//
214 . 'DICTIONARY HAS INVALID NUMBER IN CHARACTERS 4-6 (Y VALUE) - '//
215 . 'MUST BE BETWEEN 000 AND 255")') numb
216 CALL bort2(bort_str1,bort_str2)
217906 WRITE(bort_str1,'("BUFRLIB: RDUSDX - CARD READ IN IS: ",A)') card
218 WRITE(bort_str2,'(18X,"USER-DEFINED MESSAGE TYPE ""011"" IS '//
219 . 'RESERVED FOR DICTIONARY MESSAGES")')
220 CALL bort2(bort_str1,bort_str2)
221907 WRITE(bort_str1,'("BUFRLIB: RDUSDX - CARD READ IN IS: ",A)') card
222 WRITE(bort_str2,'(18X,"THIS CARD HAS A BAD FORMAT - IT IS NOT '//
223 . 'RECOGNIZED BY THIS SUBROUTINE")')
224 CALL bort2(bort_str1,bort_str2)
225
226 END
subroutine bort2(STR1, STR2)
This subroutine calls subroutine errwrt() to log two error messages, then calls subroutine bort_exit(...
Definition: bort2.f:23
subroutine dxinit(LUN, IOI)
THIS SUBROUTINE INITIALIZES THE INTERNAL ARRAYS (IN MODULE TABABD) HOLDING THE DICTIONARY TABLE.
Definition: dxinit.f:41
subroutine elemdx(CARD, LUN)
THIS SUBROUTINE DECODES THE SCALE FACTOR, REFERENCE VALUE, BIT WIDTH AND UNITS (I....
Definition: elemdx.f:48
function igetntbi(LUN, CTB)
This function returns the next available index for storing an entry within a specified internal DX BU...
Definition: igetntbi.f:28
subroutine makestab
THIS SUBROUTINE CONSTRUCTS AN INTERNAL JUMP/LINK TABLE WITHIN MODULE TABLES, USING THE INFORMATION WI...
Definition: makestab.f:75
This module contains array and variable declarations used to store DX BUFR tables internally for mult...
Definition: moda_tababd.F:10
function nemock(NEMO)
THIS FUNCTION CHECKS A MNEMONIC TO VERIFY THAT IT HAS A LENGTH OF BETWEEN ONE AND EIGHT CHARACTERS AN...
Definition: nemock.f:37
function numbck(NUMB)
THIS FUNCTION CHECKS THE INPUT CHARACTER STRING TO DETERMINE WHETHER IT CONTAINS A VALID FXY (DESCRIP...
Definition: numbck.f:47
subroutine rdusdx(LUNDX, LUN)
THIS SUBROUTINE READS AND PARSES A FILE CONTAINING A USER- SUPPLIED BUFR DICTIONARY TABLE IN CHARACTE...
Definition: rdusdx.f:65
subroutine seqsdx(CARD, LUN)
THIS SUBROUTINE DECODES THE TABLE D SEQUENCE INFORMATION FROM A MNEMONIC DEFINITION CARD THAT WAS PRE...
Definition: seqsdx.f:40
subroutine stntbi(N, LUN, NUMB, NEMO, CELSQ)
THIS SUBROUTINE STORES A NEW ENTRY WITHIN INTERNAL BUFR TABLE B OR D, DEPENDING ON THE VALUE OF NUMB.
Definition: stntbi.f:28
subroutine stntbia(N, LUN, NUMB, NEMO, CELSQ)
THIS SUBROUTINE STORES A NEW ENTRY WITHIN INTERNAL BUFR TABLE A.
Definition: stntbia.f:28