1 SUBROUTINE NEMTBD
(LUN
,ITAB
,NSEQ
,NEMS
,IRPS
,KNTS
)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
6 C PRGMMR: WOOLLEN ORG: NP20 DATE: 1994-01-06
8 C ABSTRACT: THIS SUBROUTINE RETURNS A LIST OF THE MNEMONICS (I.E.,
9 C "CHILD" MNEMONICS) CONTAINED WITHIN A TABLE D SEQUENCE MNEMONIC
10 C (I.E., A "PARENT MNEMONIC"). THIS INFORMATION SHOULD HAVE BEEN
11 C PACKED INTO THE INTERNAL BUFR TABLE D ENTRY FOR THE PARENT MNEMONIC
12 C (IN COMMON BLOCK /TABABD/) VIA PREVIOUS CALLS TO BUFR ARCHIVE
13 C LIBRARY SUBROUTINE PKTDD. NOTE THAT NEMTBD DOES NOT RECURSIVELY
14 C RESOLVE CHILD MNEMONICS WHICH ARE THEMSELVES TABLE D SEQUENCE
15 C MNEMONICS; RATHER, SUCH RESOLUTION MUST BE DONE VIA SEPARATE
16 C SUBSEQUENT CALLS TO THIS SUBROUTINE.
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 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
23 C "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
25 C 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
26 C OPENED AT ONE TIME INCREASED FROM 10 TO 32
27 C (NECESSARY IN ORDER TO PROCESS MULTIPLE
28 C BUFR FILES UNDER THE MPI)
29 C 2000-09-19 J. WOOLLEN -- MUST NOW CHECK FOR TABLE C (OPERATOR
30 C DESCRIPTOR) MNEMONICS SINCE THE CAPABILITY
31 C HAS NOW BEEN ADDED TO ENCODE AND DECODE
33 C 2003-11-04 J. ATOR -- ADDED DOCUMENTATION
34 C 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
36 C 2003-11-04 D. KEYSER -- UNIFIED/PORTABLE FOR WRF; ADDED HISTORY
37 C DOCUMENTATION; OUTPUTS MORE COMPLETE
38 C DIAGNOSTIC INFO WHEN ROUTINE TERMINATES
41 C USAGE: CALL NEMTBD (LUN, ITAB, NSEQ, NEMS, IRPS, KNTS)
42 C INPUT ARGUMENT LIST:
43 C LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
44 C ITAB - INTEGER: POSITIONAL INDEX OF PARENT MNEMONIC WITHIN
45 C INTERNAL BUFR TABLE D ARRAY TABD(*,*)
47 C OUTPUT ARGUMENT LIST:
48 C NSEQ - INTEGER: TOTAL NUMBER OF CHILD MNEMONICS FOR THE
49 C PARENT MNEMONIC GIVEN BY TABD(ITAB,LUN)
50 C NEMS - CHARACTER*8: (NSEQ)-WORD ARRAY OF CHILD MNEMONICS
51 C IRPS - INTEGER: (NSEQ)-WORD RETURN VALUE ARRAY (SEE REMARKS)
52 C KNTS - INTEGER: (NSEQ)-WORD RETURN VALUE ARRAY (SEE REMARKS)
55 C VALUE FOR OUTPUT ARGUMENT IRPS:
56 C The interpretation of the return value IRPS(I) depends upon the
57 C type of descriptor corresponding to NEMS(I), as follows:
59 C IF ( NEMS(I) corresponds to an F=1 regular (i.e. non-delayed)
60 C replication descriptor ) THEN
62 C ELSE IF ( NEMS(I) corresponds to a delayed replicator or
63 C replication factor descriptor ) THEN
64 C IRPS(I) = positional index of corresponding descriptor
65 C within internal replication array IDNR(*,*)
71 C VALUE FOR OUTPUT ARGUMENT KNTS:
72 C The interpretation of the return value KNTS(I) depends upon the
73 C type of descriptor corresponding to NEMS(I), as follows:
75 C IF ( NEMS(I) corresponds to an F=1 regular (i.e. non-delayed)
76 C replication descriptor ) THEN
77 C KNTS(I) = number of replications
83 C THIS ROUTINE CALLS: ADN30 BORT IFXY NUMTAB
85 C THIS ROUTINE IS CALLED BY: CHEKSTAB DXDUMP GETABDB TABSUB
86 C Normally not called by any application
90 C LANGUAGE: FORTRAN 77
91 C MACHINE: PORTABLE TO ALL PLATFORMS
97 COMMON /TABABD
/ NTBA
(0:NFILES
),NTBB
(0:NFILES
),NTBD
(0:NFILES
),
98 . MTAB
(MAXTBA
,NFILES
),IDNA
(MAXTBA
,NFILES
,2),
99 . IDNB
(MAXTBB
,NFILES
),IDND
(MAXTBD
,NFILES
),
100 . TABA
(MAXTBA
,NFILES
),TABB
(MAXTBB
,NFILES
),
101 . TABD
(MAXTBD
,NFILES
)
106 CHARACTER*128 BORT_STR
107 CHARACTER*8 NEMO
,NEMS
,NEMT
,NEMF
108 CHARACTER*6 ADN30
,CLEMON
110 DIMENSION NEMS
(MAXCD
),IRPS
(MAXCD
),KNTS
(MAXCD
)
113 C-----------------------------------------------------------------------
114 C-----------------------------------------------------------------------
116 IF(ITAB
.LE
.0 .OR
. ITAB
.GT
.NTBD
(LUN
)) GOTO 900
120 C CLEAR THE RETURN VALUES
121 C -----------------------
131 C PARSE THE TABLE D ENTRY
132 C -----------------------
134 NEMO
= TABD
(ITAB
,LUN
)(7:14)
135 IDSC
= IDND
(ITAB
,LUN
)
136 CALL UPTDD
(ITAB
,LUN
,0,NDSC
)
138 IF(IDSC
.LT
.IFXY
('300000')) GOTO 901
139 IF(IDSC
.GT
.IFXY
('363255')) GOTO 901
140 cccc IF(NDSC.LE.0 ) GOTO 902
142 C Loop through each child mnemonic.
144 c .... DK: What happens here if NDSC=0 ?
146 IF(NSEQ
+1.GT
.MAXCD
) GOTO 903
147 CALL UPTDD
(ITAB
,LUN
,J
,IDSC
)
148 c .... get NEMT from IDSC
149 CALL NUMTAB
(LUN
,IDSC
,NEMT
,TAB
,IRET
)
155 C F=1 regular (i.e. non-delayed) replication.
158 KNTS
(NSEQ
+1) = ABS
(IRET
)
159 ELSEIF
(IRET
.GT
.0) THEN
161 C Delayed replication.
165 ELSEIF
(TAB
.EQ
.'F') THEN
167 C Replication factor.
169 IF(.NOT
.REP
) GOTO 904
172 ELSEIF
(TAB
.EQ
.'D'.OR
.TAB
.EQ
.'C') THEN
176 ELSEIF
(TAB
.EQ
.'B') THEN
179 IF(NEMT
(1:1).EQ
.'.') THEN
181 C This is a "following value" mnemonic.
183 CALL UPTDD
(ITAB
,LUN
,J
+1,IDSC
)
184 c .... get NEMF from IDSC
185 CALL NUMTAB
(LUN
,IDSC
,NEMF
,TAB
,IRET
)
186 CALL RSVFVM
(NEMT
,NEMF
)
187 IF(TAB
.NE
.'B') GOTO 906
199 900 WRITE(BORT_STR
,'("BUFRLIB: NEMTBD - ITAB (",I7,") NOT FOUND IN '//
202 901 WRITE(BORT_STR
,'("BUFRLIB: NEMTBD - INTEGER REPRESENTATION OF '//
203 . 'DESCRIPTOR FOR TABLE D MNEMONIC ",A," (",I7,") IS OUTSIDE '//
204 . 'RANGE 0-65535 (65535 -> 3-63-255)")') NEMO
,IDSC
206 902 WRITE(BORT_STR
,'("BUFRLIB: NEMTBD - TABLE D MNEMONIC ",A," IS A'//
207 . ' ZERO LENGTH SEQUENCE")') NEMO
209 903 WRITE(BORT_STR
,'("BUFRLIB: NEMTBD - THERE ARE MORE THAN '//
210 . '(",I4,") DESCRIPTORS (THE LIMIT) IN TABLE D SEQUENCE '//
211 . 'MNEMONIC ",A)') MAXCD
, NEMO
213 904 WRITE(BORT_STR
,'("BUFRLIB: NEMTBD - REPLICATOR IS OUT OF ORDER '//
214 . 'IN TABLE D SEQUENCE MNEMONIC ",A)') NEMO
216 905 CLEMON
= ADN30
(IDSC
,6)
217 WRITE(BORT_STR
,'("BUFRLIB: NEMTBD - UNRECOGNIZED DESCRIPTOR '//
218 . '",A," IN TABLE D SEQUENCE MNEMONIC ",A)') CLEMON
,NEMO
220 906 WRITE(BORT_STR
,'("BUFRLIB: NEMTBD - A ''FOLLOWING VALUE'' '//
221 . 'MNEMONIC (",A,") IS FROM TABLE ",A,", IT MUST BE FROM TABLE B'//