1 SUBROUTINE UFBEVN
(LUNIT
,USR
,I1
,I2
,I3
,IRET
,STR
)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
6 C PRGMMR: WOOLLEN ORG: NP20 DATE: 1994-01-06
8 C ABSTRACT: THIS SUBROUTINE READS SPECIFIED VALUES FROM THE CURRENT
9 C BUFR DATA SUBSET WITHIN INTERNAL ARRAYS. THE DATA VALUES
10 C CORRESPOND TO MNEMONICS WHICH ARE PART OF A MULTIPLE-REPLICATION
11 C SEQUENCE WITHIN ANOTHER MULTIPLE-REPLICATION SEQUENCE. THE INNER
12 C SEQUENCE IS USUALLY ASSOCIATED WITH DATA "LEVELS" AND THE OUTER
13 C SEQUENCE WITH DATA "EVENTS". THE BUFR FILE IN LOGICAL UNIT LUNIT
14 C MUST HAVE BEEN OPENED FOR INPUT VIA A PREVIOUS CALL TO BUFR ARCHIVE
15 C LIBRARY SUBROUTINE OPENBF. IN ADDITION, THE DATA SUBSET MUST HAVE
16 C SUBSEQUENTLY BEEN READ INTO THE INTERNAL BUFR ARCHIVE LIBRARY
17 C ARRAYS VIA CALLS TO BUFR ARCHIVE LIBRARY SUBROUTINE READMG OR
18 C READERME FOLLOWED BY A CALL TO BUFR ARCHIVE LIBRARY SUBROUTINE
19 C READSB (OR VIA A SINGLE CALL TO BUFR ARCHIVE LIBRARY
20 C SUBROUTINE READNS). OTHER THAN THE ADDITION OF A THIRD
21 C DIMENSION AND THE READ ONLY RESTRICTION, THE CONTEXT AND USAGE OF
22 C UFBEVN IS EXACTLY THE SAME AS FOR BUFR ARCHIVE LIBRARY SUBROUTINES
23 C UFBINT, UFBREP AND UFBSEQ. THIS SUBROUTINE IS DESIGNED TO READ
24 C EVENT INFORMATION FROM "PREPBUFR" TYPE BUFR FILES. PREPBUFR FILES
25 C HAVE THE FOLLOWING BUFR TABLE EVENT STRUCTURE (NOTE SIXTEEN
26 C CHARACTERS HAVE BEEN REMOVED FROM THE LAST COLUMN TO ALLOW THE
27 C TABLE TO FIT IN THIS DOCBLOCK):
29 C | ADPUPA | HEADR {PLEVL} |
30 C | HEADR | SID XOB YOB DHR ELV TYP T29 TSB ITP SQN |
31 C | PLEVL | CAT <PINFO> <QINFO> <TINFO> <ZINFO> <WINFO> |
32 C | PINFO | [PEVN] <PBACKG> <PPOSTP> |
33 C | QINFO | [QEVN] TDO <QBACKG> <QPOSTP> |
34 C | TINFO | [TEVN] TVO <TBACKG> <TPOSTP> |
35 C | ZINFO | [ZEVN] <ZBACKG> <ZPOSTP> |
36 C | WINFO | [WEVN] <WBACKG> <WPOSTP> |
37 C | PEVN | POB PQM PPC PRC |
38 C | QEVN | QOB QQM QPC QRC |
39 C | TEVN | TOB TQM TPC TRC |
40 C | ZEVN | ZOB ZQM ZPC ZRC |
41 C | WEVN | UOB WQM WPC WRC VOB |
42 C | PBACKG | POE PFC |
43 C | QBACKG | QOE QFC |
44 C | TBACKG | TOE TFC |
45 C | ZBACKG | ZOE ZFC |
46 C | WBACKG | WOE UFC VFC |
51 C | WPOSTP | UAN VAN |
53 C NOTE THAT THE EIGHT-BIT DELAYED REPLIATION EVENT SEQUENCES "[xxxx]"
54 C ARE NESTED INSIDE ONE-BIT DELAYED REPLICATED SEQUENCES "<yyyy>".
55 C THE ANALOGOUS BUFR ARCHIVE LIBRARY SUBROUTINE UFBIN3 DOES NOT WORK
56 C PROPERLY ON THIS TYPE OF EVENT STRUCTURE. IT WORKS ONLY ON THE
57 C EVENT STRUCTURE FOUND IN "PREPFITS" TYPE BUFR FILES (SEE UFBIN3 FOR
58 C MORE DETAILS). IN TURN, UFBEVN DOES NOT WORK PROPERLY ON THE EVENT
59 C STRUCTURE FOUND IN PREPFITS FILES (ALWAYS USE UFBIN3 IN THIS CASE).
60 C ONE OTHER DIFFERENCE BETWEEN UFBEVN AND UFBIN3 IS THAT UFBEVN
61 C STORES THE MAXIMUM NUMBER OF EVENTS FOUND FOR ALL DATA VALUES
62 C SPECIFIED AMONGST ALL LEVELS RETURNED INTERNALLY IN COMMON BLOCK
63 C /UFBN3C/. UFBIN3 RETURNS THIS VALUE AS AN ADDITIONAL OUTPUT
66 C PROGRAM HISTORY LOG:
67 C 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
68 C 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
69 C "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
70 C ROUTINE "BORT"; IMPROVED MACHINE
72 C 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
73 C OPENED AT ONE TIME INCREASED FROM 10 TO 32
74 C (NECESSARY IN ORDER TO PROCESS MULTIPLE
75 C BUFR FILES UNDER THE MPI)
76 C 2003-11-04 J. WOOLLEN -- SAVES THE MAXIMUM NUMBER OF EVENTS FOUND
77 C FOR ALL DATA VALUES SPECIFIED AMONGST ALL
78 C LEVELS RETURNED AS VARIABLE MAXEVN IN NEW
79 C COMMON BLOCK /UFBN3C/
80 C 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
82 C 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
83 C INCREASED FROM 15000 TO 16000 (WAS IN
84 C VERIFICATION VERSION); ADDED CALL TO BORT
85 C IF BUFR FILE IS OPEN FOR OUTPUT; UNIFIED/
86 C PORTABLE FOR WRF; ADDED DOCUMENTATION
87 C (INCLUDING HISTORY); OUTPUTS MORE COMPLETE
88 C DIAGNOSTIC INFO WHEN ROUTINE TERMINATES
89 C ABNORMALLY OR UNUSUAL THINGS HAPPEN
90 C 2009-04-21 J. ATOR -- USE ERRWRT
92 C USAGE: CALL UFBEVN (LUNIT, USR, I1, I2, I3, IRET, STR)
93 C INPUT ARGUMENT LIST:
94 C LUNIT - INTEGER: FORTRAN LOGICAL UNIT NUMBER FOR BUFR FILE
95 C I1 - INTEGER: LENGTH OF FIRST DIMENSION OF USR OR THE
96 C NUMBER OF BLANK-SEPARATED MNEMONICS IN STR (FORMER
97 C MUST BE .GE. LATTER)
98 C I2 - INTEGER: LENGTH OF SECOND DIMENSION OF USR
99 C I3 - INTEGER: LENGTH OF THIRD DIMENSION OF USR (MAXIMUM
101 C STR - CHARACTER*(*): STRING OF BLANK-SEPARATED TABLE B
102 C MNEMONICS IN ONE-TO-ONE CORRESPONDENCE WITH FIRST
104 C - THERE ARE THREE "GENERIC" MNEMONICS NOT RELATED
105 C TO TABLE B, THESE RETURN THE FOLLOWING
106 C INFORMATION IN CORRESPONDING USR LOCATION:
107 C 'NUL' WHICH ALWAYS RETURNS BMISS ("MISSING")
108 C 'IREC' WHICH ALWAYS RETURNS THE CURRENT BUFR
109 C MESSAGE (RECORD) NUMBER IN WHICH THIS
111 C 'ISUB' WHICH ALWAYS RETURNS THE CURRENT SUBSET
112 C NUMBER OF THIS SUBSET WITHIN THE BUFR
113 C MESSAGE (RECORD) NUMBER 'IREC'
115 C OUTPUT ARGUMENT LIST:
116 C USR - REAL*8: (I1,I2,I3) STARTING ADDRESS OF DATA VALUES
117 C READ FROM DATA SUBSET
118 C IRET - INTEGER: NUMBER OF "LEVELS" OF DATA VALUES READ FROM
119 C DATA SUBSET (MUST BE NO LARGER THAN I2)
122 C APPLICATION PROGRAMS READING PREPFITS FILES SHOULD NOT CALL THIS
125 C THIS ROUTINE CALLS: BORT CONWIN ERRWRT GETWIN
126 C NVNWIN NXTWIN STATUS STRING
127 C THIS ROUTINE IS CALLED BY: None
128 C Normally called only by application
132 C LANGUAGE: FORTRAN 77
133 C MACHINE: PORTABLE TO ALL PLATFORMS
137 INCLUDE
'bufrlib.prm'
139 COMMON /MSGCWD
/ NMSG
(NFILES
),NSUB
(NFILES
),MSUB
(NFILES
),
140 . INODE
(NFILES
),IDATE
(NFILES
)
141 COMMON /USRINT
/ NVAL
(NFILES
),INV
(MAXSS
,NFILES
),VAL
(MAXSS
,NFILES
)
142 COMMON /USRSTR
/ NNOD
,NCON
,NODS
(20),NODC
(10),IVLS
(10),KONS
(10)
143 COMMON /UFBN3C
/ MAXEVN
149 REAL*8 VAL
,USR
(I1
,I2
,I3
)
151 C----------------------------------------------------------------------
152 C----------------------------------------------------------------------
157 C CHECK THE FILE STATUS AND I-NODE
158 C --------------------------------
160 CALL STATUS
(LUNIT
,LUN
,IL
,IM
)
164 IF(INODE
(LUN
).NE
.INV
(1,LUN
)) GOTO 903
168 CALL ERRWRT
('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
169 ERRSTR
= 'BUFRLIB: UFBEVN - 3rd ARG. (INPUT) IS .LE. 0, ' //
170 . 'SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
173 CALL ERRWRT
('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
179 CALL ERRWRT
('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
180 ERRSTR
= 'BUFRLIB: UFBEVN - 4th ARG. (INPUT) IS .LE. 0, ' //
181 . 'SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
184 CALL ERRWRT
('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
190 CALL ERRWRT
('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
191 ERRSTR
= 'BUFRLIB: UFBEVN - 5th ARG. (INPUT) IS .LE. 0, ' //
192 . 'SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
195 CALL ERRWRT
('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
201 C PARSE OR RECALL THE INPUT STRING
202 C --------------------------------
204 CALL STRING
(STR
,LUN
,I1
,0)
206 C INITIALIZE USR ARRAY
207 C --------------------
217 C LOOP OVER COND WINDOWS
218 C ----------------------
223 1 CALL CONWIN
(LUN
,INC1
,INC2
)
227 ELSEIF
(INC1
.EQ
.0) THEN
231 IF(NODS
(I
).GT
.0) THEN
233 CALL GETWIN
(NODS
(I
),LUN
,INS1
,INS2
)
234 IF(INS1
.EQ
.0) GOTO 100
242 C READ PUSH DOWN STACK DATA INTO 3D ARRAYS
243 C ----------------------------------------
248 IF(NODS
(I
).GT
.0) THEN
249 NNVN
= NVNWIN
(NODS
(I
),LUN
,INS1
,INS2
,INVN
,I3
)
250 MAXEVN
= MAX
(NNVN
,MAXEVN
)
252 USR
(I
,IRET
,N
) = VAL
(INVN
(N
),LUN
)
258 C DECIDE WHAT TO DO NEXT
259 C ----------------------
261 CALL NXTWIN
(LUN
,INS1
,INS2
)
262 IF(INS1
.GT
.0 .AND
. INS1
.LT
.INC2
) GOTO 2
267 CALL ERRWRT
('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
268 ERRSTR
= 'BUFRLIB: UFBEVN - NO SPECIFIED VALUES READ IN, ' //
269 . 'SO RETURN WITH 6th ARG. (IRET) = 0; 7th ARG. (STR) ='
272 CALL ERRWRT
('+++++++++++++++++++++WARNING+++++++++++++++++++++++')
281 900 CALL BORT
('BUFRLIB: UFBEVN - INPUT BUFR FILE IS CLOSED, IT MUST'//
282 . ' BE OPEN FOR INPUT')
283 901 CALL BORT
('BUFRLIB: UFBEVN - INPUT BUFR FILE IS OPEN FOR OUTPUT'//
284 . ', IT MUST BE OPEN FOR INPUT')
285 902 CALL BORT
('BUFRLIB: UFBEVN - A MESSAGE MUST BE OPEN IN INPUT '//
286 . 'BUFR FILE, NONE ARE')
287 903 CALL BORT
('BUFRLIB: UFBEVN - LOCATION OF INTERNAL TABLE FOR '//
288 . 'INPUT BUFR FILE DOES NOT AGREE WITH EXPECTED LOCATION IN '//
289 . 'INTERNAL SUBSET ARRAY')