NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
nemtbd.f
Go to the documentation of this file.
1 C> @file
2 C> @author WOOLLEN @date 1994-01-06
3 
4 C> THIS SUBROUTINE RETURNS A LIST OF THE MNEMONICS (I.E.,
5 C> "CHILD" MNEMONICS) CONTAINED WITHIN A TABLE D SEQUENCE MNEMONIC
6 C> (I.E., A "PARENT MNEMONIC"). THIS INFORMATION SHOULD HAVE BEEN
7 C> PACKED INTO THE INTERNAL BUFR TABLE D ENTRY FOR THE PARENT
8 C> MNEMONIC (IN MODULE TABABD) VIA PREVIOUS CALLS TO BUFR ARCHIVE
9 C> LIBRARY SUBROUTINE PKTDD. NOTE THAT NEMTBD DOES NOT RECURSIVELY
10 C> RESOLVE CHILD MNEMONICS WHICH ARE THEMSELVES TABLE D SEQUENCE
11 C> MNEMONICS; RATHER, SUCH RESOLUTION MUST BE DONE VIA SEPARATE
12 C> SUBSEQUENT CALLS TO THIS SUBROUTINE.
13 C>
14 C> PROGRAM HISTORY LOG:
15 C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
16 C> 1995-06-28 J. WOOLLEN -- INCREASED THE SIZE OF INTERNAL BUFR TABLE
17 C> ARRAYS IN ORDER TO HANDLE BIGGER FILES
18 C> 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
19 C> "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
20 C> ROUTINE "BORT"
21 C> 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
22 C> OPENED AT ONE TIME INCREASED FROM 10 TO 32
23 C> (NECESSARY IN ORDER TO PROCESS MULTIPLE
24 C> BUFR FILES UNDER THE MPI)
25 C> 2000-09-19 J. WOOLLEN -- MUST NOW CHECK FOR TABLE C (OPERATOR
26 C> DESCRIPTOR) MNEMONICS SINCE THE CAPABILITY
27 C> HAS NOW BEEN ADDED TO ENCODE AND DECODE
28 C> THESE
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; OUTPUTS MORE COMPLETE
34 C> DIAGNOSTIC INFO WHEN ROUTINE TERMINATES
35 C> ABNORMALLY
36 C> 2014-12-10 J. ATOR -- USE MODULES INSTEAD OF COMMON BLOCKS
37 C>
38 C> USAGE: CALL NEMTBD (LUN, ITAB, NSEQ, NEMS, IRPS, KNTS)
39 C> INPUT ARGUMENT LIST:
40 C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
41 C> ITAB - INTEGER: POSITIONAL INDEX OF PARENT MNEMONIC WITHIN
42 C> INTERNAL BUFR TABLE D ARRAY TABD(*,*)
43 C>
44 C> OUTPUT ARGUMENT LIST:
45 C> NSEQ - INTEGER: TOTAL NUMBER OF CHILD MNEMONICS FOR THE
46 C> PARENT MNEMONIC GIVEN BY TABD(ITAB,LUN)
47 C> NEMS - CHARACTER*8: (NSEQ)-WORD ARRAY OF CHILD MNEMONICS
48 C> IRPS - INTEGER: (NSEQ)-WORD RETURN VALUE ARRAY (SEE REMARKS)
49 C> KNTS - INTEGER: (NSEQ)-WORD RETURN VALUE ARRAY (SEE REMARKS)
50 C>
51 C> REMARKS:
52 C> VALUE FOR OUTPUT ARGUMENT IRPS:
53 C> The interpretation of the return value IRPS(I) depends upon the
54 C> type of descriptor corresponding to NEMS(I), as follows:
55 C>
56 C> IF ( NEMS(I) corresponds to an F=1 regular (i.e. non-delayed)
57 C> replication descriptor ) THEN
58 C> IRPS(I) = 1
59 C> ELSE IF ( NEMS(I) corresponds to a delayed replicator or
60 C> replication factor descriptor ) THEN
61 C> IRPS(I) = positional index of corresponding descriptor
62 C> within internal replication array IDNR(*,*)
63 C> ELSE
64 C> IRPS(I) = 0
65 C> END IF
66 C>
67 C>
68 C> VALUE FOR OUTPUT ARGUMENT KNTS:
69 C> The interpretation of the return value KNTS(I) depends upon the
70 C> type of descriptor corresponding to NEMS(I), as follows:
71 C>
72 C> IF ( NEMS(I) corresponds to an F=1 regular (i.e. non-delayed)
73 C> replication descriptor ) THEN
74 C> KNTS(I) = number of replications
75 C> ELSE
76 C> KNTS(I) = 0
77 C> END IF
78 C>
79 C>
80 C> THIS ROUTINE CALLS: ADN30 BORT IFXY NUMTAB
81 C> RSVFVM UPTDD
82 C> THIS ROUTINE IS CALLED BY: CHEKSTAB DXDUMP GETABDB TABSUB
83 C> Normally not called by any application
84 C> programs.
85 C>
86  SUBROUTINE nemtbd(LUN,ITAB,NSEQ,NEMS,IRPS,KNTS)
87 
88  USE modv_maxcd
89  USE moda_tababd
90 
91  CHARACTER*128 bort_str
92  CHARACTER*8 nemo,nems,nemt,nemf
93  CHARACTER*6 adn30,clemon
94  CHARACTER*1 tab
95  dimension nems(*),irps(*),knts(*)
96  LOGICAL rep
97 
98 C-----------------------------------------------------------------------
99 C-----------------------------------------------------------------------
100 
101  IF(itab.LE.0 .OR. itab.GT.ntbd(lun)) goto 900
102 
103  rep = .false.
104 
105 C CLEAR THE RETURN VALUES
106 C -----------------------
107 
108  nseq = 0
109 
110  DO i=1,maxcd
111  nems(i) = ' '
112  irps(i) = 0
113  knts(i) = 0
114  ENDDO
115 
116 C PARSE THE TABLE D ENTRY
117 C -----------------------
118 
119  nemo = tabd(itab,lun)(7:14)
120  idsc = idnd(itab,lun)
121  CALL uptdd(itab,lun,0,ndsc)
122 
123  IF(idsc.LT.ifxy('300000')) goto 901
124  IF(idsc.GT.ifxy('363255')) goto 901
125 cccc IF(NDSC.LE.0 ) GOTO 902
126 
127 C Loop through each child mnemonic.
128 
129 c .... DK: What happens here if NDSC=0 ?
130  DO j=1,ndsc
131  IF(nseq+1.GT.maxcd) goto 903
132  CALL uptdd(itab,lun,j,idsc)
133 c .... get NEMT from IDSC
134  CALL numtab(lun,idsc,nemt,tab,iret)
135  IF(tab.EQ.'R') THEN
136  IF(rep) goto 904
137  rep = .true.
138  IF(iret.LT.0) THEN
139 
140 C F=1 regular (i.e. non-delayed) replication.
141 
142  irps(nseq+1) = 1
143  knts(nseq+1) = abs(iret)
144  ELSEIF(iret.GT.0) THEN
145 
146 C Delayed replication.
147 
148  irps(nseq+1) = iret
149  ENDIF
150  ELSEIF(tab.EQ.'F') THEN
151 
152 C Replication factor.
153 
154  IF(.NOT.rep) goto 904
155  irps(nseq+1) = iret
156  rep = .false.
157  ELSEIF(tab.EQ.'D'.OR.tab.EQ.'C') THEN
158  rep = .false.
159  nseq = nseq+1
160  nems(nseq) = nemt
161  ELSEIF(tab.EQ.'B') THEN
162  rep = .false.
163  nseq = nseq+1
164  IF((nemt(1:1).EQ.'.').AND.(j.LT.ndsc)) THEN
165 
166 C This is a "following value" mnemonic.
167 
168  CALL uptdd(itab,lun,j+1,idsc)
169 c .... get NEMF from IDSC
170  CALL numtab(lun,idsc,nemf,tab,iret)
171  CALL rsvfvm(nemt,nemf)
172  IF(tab.NE.'B') goto 906
173  ENDIF
174  nems(nseq) = nemt
175  ELSE
176  goto 905
177  ENDIF
178  ENDDO
179 
180 C EXITS
181 C -----
182 
183  RETURN
184 900 WRITE(bort_str,'("BUFRLIB: NEMTBD - ITAB (",I7,") NOT FOUND IN '//
185  . 'TABLE D")') itab
186  CALL bort(bort_str)
187 901 WRITE(bort_str,'("BUFRLIB: NEMTBD - INTEGER REPRESENTATION OF '//
188  . 'DESCRIPTOR FOR TABLE D MNEMONIC ",A," (",I7,") IS OUTSIDE '//
189  . 'RANGE 0-65535 (65535 -> 3-63-255)")') nemo,idsc
190  CALL bort(bort_str)
191 902 WRITE(bort_str,'("BUFRLIB: NEMTBD - TABLE D MNEMONIC ",A," IS A'//
192  . ' ZERO LENGTH SEQUENCE")') nemo
193  CALL bort(bort_str)
194 903 WRITE(bort_str,'("BUFRLIB: NEMTBD - THERE ARE MORE THAN '//
195  . '(",I4,") DESCRIPTORS (THE LIMIT) IN TABLE D SEQUENCE '//
196  . 'MNEMONIC ",A)') maxcd, nemo
197  CALL bort(bort_str)
198 904 WRITE(bort_str,'("BUFRLIB: NEMTBD - REPLICATOR IS OUT OF ORDER '//
199  . 'IN TABLE D SEQUENCE MNEMONIC ",A)') nemo
200  CALL bort(bort_str)
201 905 clemon = adn30(idsc,6)
202  WRITE(bort_str,'("BUFRLIB: NEMTBD - UNRECOGNIZED DESCRIPTOR '//
203  . '",A," IN TABLE D SEQUENCE MNEMONIC ",A)') clemon,nemo
204  CALL bort(bort_str)
205 906 WRITE(bort_str,'("BUFRLIB: NEMTBD - A ''FOLLOWING VALUE'' '//
206  . 'MNEMONIC (",A,") IS FROM TABLE ",A,", IT MUST BE FROM TABLE B'//
207  . '")') nemf,tab
208  CALL bort(bort_str)
209  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 rsvfvm(NEM1, NEM2)
THIS SUBROUTINE STEPS THROUGH THE "FOLLOWING VALUE" MNEMONIC NEM1 AND, FOR EACH "." CHARACTER ENCOUNTERED (EXCEPT FOR THE INITIAL ONE), OVERWRITES IT WITH THE NEXT CORRESPONDING CHARACTER FROM NEM2 (SEE REMARKS).
Definition: rsvfvm.f:40
This module contains array and variable declarations used to store DX BUFR tables internally for mult...
Definition: moda_tababd.F:10
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
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
subroutine uptdd(ID, LUN, IENT, IRET)
THIS SUBROUTINE RETURNS THE BIT-WISE REPRESENTATION OF THE FXY VALUE CORRESPONDING TO...
Definition: uptdd.f:60
subroutine nemtbd(LUN, ITAB, NSEQ, NEMS, IRPS, KNTS)
THIS SUBROUTINE RETURNS A LIST OF THE MNEMONICS (I.E., "CHILD" MNEMONICS) CONTAINED WITHIN A TABLE D ...
Definition: nemtbd.f:86
This module declares and initializes the MAXCD variable.
Definition: modv_MAXCD.F:16