1 SUBROUTINE DXDUMP
(LUNIT
,LDXOT
)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
6 C PRGMMR: ATOR ORG: NP12 DATE: 2004-08-18
8 C ABSTRACT: THIS SUBROUTINE WRITES, TO LOGICAL UNIT LDXOT, AN ASCII
9 C COPY OF THE BUFR DICTIONARY TABLE INFORMATION ASSOCIATED WITH
10 C THE BUFR FILE DEFINED BY LOGICAL UNIT LUNIT. IT IS ESPECIALLY
11 C USEFUL FOR DETERMINING THE CONTENTS OF ARCHIVE BUFR FILES WHICH
12 C MAY HAVE SUCH INFORMATION EMBEDDED AS DX MESSAGES AT THE FRONT
13 C OF THE FILE. THE OUTPUT FILE WILL BE IN A FORMAT SUITABLE FOR
14 C SUBSEQUENT INPUT AS A USER-DEFINED DICTIONARY TABLES FILE TO
15 C BUFR ARCHIVE LIBRARY SUBROUTINE OPENBF, AND IN THAT SENSE THIS
16 C SUBROUTINE CAN BE VIEWED AS THE LOGICAL INVERSE OF BUFR ARCHIVE
17 C LIBRARY SUBROUTINE RDUSDX. NOTE THAT THE BUFR FILE ASSOCIATED
18 C WITH LOGICAL UNIT LUNIT MUST HAVE ALREADY BEEN IDENTIFIED TO
19 C THE BUFR ARCHIVE LIBRARY SOFTWARE VIA A PRIOR CALL TO OPENBF.
21 C PROGRAM HISTORY LOG:
22 C 2004-08-18 J. ATOR -- ORIGINAL AUTHOR
23 C 2007-01-19 J. ATOR -- CORRECTED OUTPUT FOR REFERENCE VALUES
24 C LONGER THAN 8 DIGITS
26 C USAGE: CALL DXDUMP (LUNIT, LDXOT)
27 C INPUT ARGUMENT LIST:
28 C LUNIT - INTEGER: FORTRAN LOGICAL UNIT NUMBER FOR BUFR FILE
29 C LDXOT - INTEGER: FORTRAN LOGICAL UNIT NUMBER FOR OUTPUT FILE
32 C UNIT "LUNIT" - BUFR FILE WITH EMBEDDED DX DICTIONARY MESSAGES
35 C UNIT "LDXOT" - ASCII VERSION OF DX DICTIONARY INFORMATION, IN
36 C FORMAT SUITABLE FOR SUBSEQUENT INPUT TO OPENBF
39 C THIS ROUTINE CALLS: BORT NEMTBD STATUS STRSUC
40 C THIS ROUTINE IS CALLED BY: None
41 C Normally called only by application
45 C LANGUAGE: FORTRAN 77
46 C MACHINE: PORTABLE TO ALL PLATFORMS
52 COMMON /REPTAB
/ IDNR
(5,2),TYPS
(5,2),REPS
(5,2),LENS
(5)
53 COMMON /TABABD
/ NTBA
(0:NFILES
),NTBB
(0:NFILES
),NTBD
(0:NFILES
),
54 . MTAB
(MAXTBA
,NFILES
),IDNA
(MAXTBA
,NFILES
,2),
55 . IDNB
(MAXTBB
,NFILES
),IDND
(MAXTBD
,NFILES
),
56 . TABA
(MAXTBA
,NFILES
),TABB
(MAXTBB
,NFILES
),
62 CHARACTER*80 CARD
,CARDI1
,CARDI2
,CARDI3
,CARDI4
65 CHARACTER*8 NEMS
(MAXCD
),WRK1
,WRK2
70 DIMENSION IRPS
(MAXCD
),KNTS
(MAXCD
)
72 LOGICAL TBSKIP
, TDSKIP
, XTRCI1
85 . /' |-------------|'/
87 . /'|---------------------------------------'/
89 . /'---------------------------------------|'/
91 C-----------------------------------------------------------------------
92 TBSKIP
(ADN
) = ((ADN
.EQ
.'063000').OR
.(ADN
.EQ
.'063255').OR
.
93 . (ADN
.EQ
.'031000').OR
.(ADN
.EQ
.'031001').OR
.
95 TDSKIP
(ADN
) = ((ADN
.EQ
.'360001').OR
.(ADN
.EQ
.'360002').OR
.
96 . (ADN
.EQ
.'360003').OR
.(ADN
.EQ
.'360004'))
97 C-----------------------------------------------------------------------
99 C DETERMINE LUN FROM LUNIT.
101 CALL STATUS
(LUNIT
,LUN
,IL
,IM
)
104 C CREATE AND WRITE OUT (TO LDXOT) THE HEADER CARDS FOR THE
105 C DESCRIPTOR DEFINITION SECTION.
110 WRITE (LDXOT
,'(A)') CARD
115 CARD
(15:64)=' USER DEFINITIONS FOR TABLE-A TABLE-B TABLE D '
116 WRITE (LDXOT
,'(A)') CARD
118 WRITE (LDXOT
,'(A)') CARDI4
121 CARD
( 3:10)='MNEMONIC'
123 CARD
(23:33)='DESCRIPTION'
124 WRITE (LDXOT
,'(A)') CARD
129 WRITE (LDXOT
,'(A)') CARD
131 C CREATE AND WRITE OUT (TO LDXOT) THE TABLE D DESCRIPTOR
134 WRITE (LDXOT
,'(A)') CARDI1
138 IF(.NOT
.TDSKIP
(TABD
(N
,LUN
)(1:6))) THEN
140 CARD
( 3:10)=TABD
(N
,LUN
)( 7:14)
141 CARD
(14:19)=TABD
(N
,LUN
)( 1: 6)
142 CARD
(23:77)=TABD
(N
,LUN
)(16:70)
144 C CHECK IF THIS TABLE D MNEMONIC IS ALSO A TABLE A MNEMONIC.
145 C IF SO, THEN LABEL IT AS SUCH AND ALSO CHECK IF IT IS THE
146 C LAST OF THE TABLE A MNEMONICS, IN WHICH CASE AN EXTRA
147 C CARDI1 LINE WILL BE WRITTEN TO LDXOT IN ORDER TO SEPARATE
148 C THE TABLE A MNEMONICS FROM THE OTHER TABLE D MNEMONICS.
151 IF(TABA
(NA
,LUN
)(4:11).EQ
.TABD
(N
,LUN
)(7:14)) THEN
153 IF(NA
.EQ
.NTBA
(LUN
)) XTRCI1
=.TRUE
.
157 10 WRITE (LDXOT
,'(A)') CARD
159 WRITE (LDXOT
,'(A)') CARDI1
165 C CREATE AND WRITE OUT (TO LDXOT) THE TABLE B DESCRIPTOR
168 WRITE (LDXOT
,'(A)') CARDI1
171 IF(.NOT
.TBSKIP
(TABB
(N
,LUN
)(1:6))) THEN
173 CARD
( 3:10)=TABB
(N
,LUN
)( 7:14)
174 CARD
(14:19)=TABB
(N
,LUN
)( 1: 6)
175 CARD
(23:77)=TABB
(N
,LUN
)(16:70)
176 WRITE (LDXOT
,'(A)') CARD
180 WRITE (LDXOT
,'(A)') CARDI1
182 C CREATE AND WRITE OUT (TO LDXOT) THE HEADER CARDS FOR THE
183 C SEQUENCE DEFINITION SECTION.
185 WRITE (LDXOT
,'(A)') CARDI4
188 CARD
( 3:10)='MNEMONIC'
189 CARD
(14:21)='SEQUENCE'
190 WRITE (LDXOT
,'(A)') CARD
194 WRITE (LDXOT
,'(A)') CARD
196 C CREATE AND WRITE OUT (TO LDXOT) THE TABLE D SEQUENCE
199 WRITE (LDXOT
,'(A)') CARDI2
202 IF(.NOT
.TDSKIP
(TABD
(N
,LUN
)(1:6))) THEN
204 CARD
( 3:10)=TABD
(N
,LUN
)( 7:14)
207 C GET THE LIST OF CHILD MNEMONICS FOR THIS TABLE D DESCRIPTOR,
208 C AND THEN ADD EACH ONE (INCLUDING ANY REPLICATION TAGS) TO
209 C THE SEQUENCE DEFINITION CARD FOR THIS TABLE D DESCRIPTOR.
211 CALL NEMTBD
(LUN
,N
,NSEQ
,NEMS
,IRPS
,KNTS
)
216 CALL STRSUC
(NEMS
(NC
),WRK2
,NCH
)
217 IF(IRPS
(NC
).NE
.0) THEN
219 C ADD THE OPENING REPLICATION TAG.
222 CMSTR
(ICMS
:ICMS
)=REPS
(IRPS
(NC
),1)
224 CMSTR
(ICMS
+1:ICMS
+NCH
)=WRK2
(1:NCH
)
226 IF(IRPS
(NC
).NE
.0) THEN
228 C ADD THE CLOSING REPLICATION TAG.
231 CMSTR
(ICMS
:ICMS
)=REPS
(IRPS
(NC
),2)
233 IF(KNTS
(NC
).NE
.0) THEN
235 C ADD THE FIXED REPLICATION COUNT.
238 WRITE (WRK1
,'(I3)') KNTS
(NC
)
239 CALL STRSUC
(WRK1
,WRK2
,NCH
)
240 CMSTR
(ICMS
+1:ICMS
+NCH
)=WRK2
(1:NCH
)
244 C WILL THIS CHILD (AND ITS REPLICATION TAGS, IF ANY) FIT
245 C INTO THE CURRENT SEQUENCE DEFINITION CARD? IF NOT, THEN
246 C WRITE OUT (TO LDXOT) THE CURRENT CARD AND INITIALIZE A
247 C NEW ONE TO HOLD THIS CHILD.
249 IF(IC
.GT
.(79-ICMS
)) THEN
250 WRITE (LDXOT
,'(A)') CARD
252 CARD
( 3:10)=TABD
(N
,LUN
)( 7:14)
255 CARD
(IC
:IC
+ICMS
-1)=CMSTR
(1:ICMS
)
257 C NOTE THAT WE WANT TO LEAVE 2 BLANK SPACES BETWEEN EACH
258 C CHILD WITHIN THE SEQUENCE DEFINITION CARD (TO IMPROVE
263 WRITE (LDXOT
,'(A)') CARD
264 WRITE (LDXOT
,'(A)') CARDI2
269 C CREATE AND WRITE OUT (TO LDXOT) THE HEADER CARDS FOR THE
270 C ELEMENT DEFINITION SECTION.
272 WRITE (LDXOT
,'(A)') CARDI4
275 CARD
( 3:10)='MNEMONIC'
277 CARD
(21:29)='REFERENCE'
280 WRITE (LDXOT
,'(A)') CARD
288 WRITE (LDXOT
,'(A)') CARD
290 C CREATE AND WRITE OUT (TO LDXOT) THE TABLE B ELEMENT
293 WRITE (LDXOT
,'(A)') CARDI3
296 IF(.NOT
.TBSKIP
(TABB
(N
,LUN
)(1:6))) THEN
298 CARD
( 3:10)=TABB
(N
,LUN
)( 7:14)
299 CARD
(41:64)=TABB
(N
,LUN
)(71:94)
301 C ADD THE SCALE FACTOR.
303 CALL STRSUC
(TABB
(N
,LUN
)(96:98),WRK2
,NCH
)
304 CARD
(17-NCH
+1:17)=WRK2
305 IF(TABB
(N
,LUN
)(95:95).EQ
.'-') CARD
(17-NCH
:17-NCH
)='-'
307 C ADD THE REFERENCE VALUE.
309 CALL STRSUC
(TABB
(N
,LUN
)(100:109),WRK3
,NCH
)
310 CARD
(31-NCH
+1:31)=WRK3
311 IF(TABB
(N
,LUN
)(99:99).EQ
.'-') CARD
(31-NCH
:31-NCH
)='-'
315 CALL STRSUC
(TABB
(N
,LUN
)(110:112),WRK2
,NCH
)
316 CARD
(37-NCH
+1:37)=WRK2
317 WRITE (LDXOT
,'(A)') CARD
321 WRITE (LDXOT
,'(A)') CARDI3
323 C CREATE AND WRITE OUT (TO LDXOT) THE CLOSING CARD.
328 WRITE (LDXOT
,'(A)') CARD
331 900 CALL BORT
('BUFRLIB: DXDUMP - BUFR FILE IS CLOSED, IT MUST BE'//