1 SUBROUTINE UFBGET
(LUNIT
,TAB
,I1
,IRET
,STR
)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
6 C PRGMMR: WOOLLEN ORG: NP20 DATE: 1994-01-06
8 C ABSTRACT: THIS SUBROUTINE UNPACKS AND RETURNS THE VALUES FOR ONE-
9 C DIMENSIONAL DESCRIPTORS IN THE INPUT STRING WITHOUT ADVANCING THE
12 C PROGRAM HISTORY LOG:
13 C 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
14 C 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
15 C "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
16 C ROUTINE "BORT"; IMPROVED MACHINE
18 C 1998-10-27 J. WOOLLEN -- MODIFIED TO CORRECT PROBLEMS CAUSED BY IN-
19 C LINING CODE WITH FPP DIRECTIVES
20 C 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
21 C OPENED AT ONE TIME INCREASED FROM 10 TO 32
22 C (NECESSARY IN ORDER TO PROCESS MULTIPLE
23 C BUFR FILES UNDER THE MPI)
24 C 2000-09-19 J. WOOLLEN -- MAXIMUM MESSAGE LENGTH INCREASED FROM
25 C 10,000 TO 20,000 BYTES
26 C 2002-05-14 J. WOOLLEN -- REMOVED OLD CRAY COMPILER DIRECTIVES
27 C 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
29 C 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
30 C INCREASED FROM 15000 TO 16000 (WAS IN
31 C VERIFICATION VERSION); UNIFIED/PORTABLE FOR
32 C WRF; ADDED DOCUMENTATION (INCLUDING
33 C HISTORY); OUTPUTS MORE COMPLETE DIAGNOSTIC
34 C INFO WHEN ROUTINE TERMINATES ABNORMALLY
35 C 2004-08-09 J. ATOR -- MAXIMUM MESSAGE LENGTH INCREASED FROM
36 C 20,000 TO 50,000 BYTES
37 C 2012-03-02 J. ATOR -- USE FUNCTION UPS
39 C USAGE: CALL UFBGET (LUNIT, TAB, I1, IRET, STR)
40 C INPUT ARGUMENT LIST:
41 C LUNIT - INTEGER: FORTRAN LOGICAL UNIT NUMBER FOR BUFR FILE
42 C I1 - INTEGER: LENGTH OF TAB
43 C STR - CHARACTER*(*): STRING OF BLANK-SEPARATED TABLE B
44 C MNEMONICS IN ONE-TO-ONE CORRESPONDENCE WITH THE WORDS
46 C - THERE ARE THREE "GENERIC" MNEMONICS NOT RELATED
47 C TO TABLE B, THESE RETURN THE FOLLOWING
48 C INFORMATION IN CORRESPONDING TAB LOCATION:
49 C 'NUL' WHICH ALWAYS RETURNS BMISS ("MISSING")
50 C 'IREC' WHICH ALWAYS RETURNS THE CURRENT BUFR
51 C MESSAGE (RECORD) NUMBER IN WHICH THIS
53 C 'ISUB' WHICH ALWAYS RETURNS THE CURRENT SUBSET
54 C NUMBER OF THIS SUBSET WITHIN THE BUFR
55 C MESSAGE (RECORD) NUMBER 'IREC'
57 C OUTPUT ARGUMENT LIST:
58 C TAB - REAL*8: (I1) STARTING ADDRESS OF DATA VALUES READ FROM
60 C IRET - INTEGER: RETURN CODE:
62 C -1 = there are no more subsets in the BUFR
66 C THIS ROUTINE CALLS: BORT INVWIN STATUS STRING
68 C THIS ROUTINE IS CALLED BY: None
69 C Normally called only by application
73 C LANGUAGE: FORTRAN 77
74 C MACHINE: PORTABLE TO ALL PLATFORMS
80 COMMON /MSGCWD
/ NMSG
(NFILES
),NSUB
(NFILES
),MSUB
(NFILES
),
81 . INODE
(NFILES
),IDATE
(NFILES
)
82 COMMON /BITBUF
/ MAXBYT
,IBIT
,IBAY
(MXMSGLD4
),MBYT
(NFILES
),
83 . MBAY
(MXMSGLD4
,NFILES
)
84 COMMON /USRINT
/ NVAL
(NFILES
),INV
(MAXSS
,NFILES
),VAL
(MAXSS
,NFILES
)
85 COMMON /USRSTR
/ NNOD
,NCON
,NODS
(20),NODC
(10),IVLS
(10),KONS
(10)
86 COMMON /BTABLES
/ MAXTAB
,NTAB
,TAG
(MAXJL
),TYP
(MAXJL
),KNT
(MAXJL
),
87 . JUMP
(MAXJL
),LINK
(MAXJL
),JMPB
(MAXJL
),
88 . IBT
(MAXJL
),IRF
(MAXJL
),ISC
(MAXJL
),
89 . ITP
(MAXJL
),VALI
(MAXJL
),KNTI
(MAXJL
),
90 . ISEQ
(MAXJL
,2),JSEQ
(MAXJL
)
91 COMMON /USRBIT
/ NBIT
(MAXSS
),MBIT
(MAXSS
)
97 EQUIVALENCE
(CVAL
,RVAL
)
98 REAL*8 VAL
,RVAL
,TAB
(I1
),UPS
100 C-----------------------------------------------------------------------
101 MPS
(NODE
) = 2**(IBT
(NODE
))-1
102 C-----------------------------------------------------------------------
110 C MAKE SURE A FILE/MESSAGE IS OPEN FOR INPUT
111 C ------------------------------------------
113 CALL STATUS
(LUNIT
,LUN
,IL
,IM
)
118 C SEE IF THERE IS ANOTHER SUBSET IN THE MESSAGE
119 C ---------------------------------------------
121 IF(NSUB
(LUN
).EQ
.MSUB
(LUN
)) THEN
129 CALL STRING
(STR
,LUN
,I1
,0)
131 C EXPAND THE TEMPLATE FOR THIS SUBSET AS LITTLE AS POSSIBLE
132 C ---------------------------------------------------------
136 MBIT
(N
) = MBYT
(LUN
)*8 + 16
139 10 DO N
=N
+1,NVAL
(LUN
)
142 MBIT
(N
) = MBIT
(N
-1)+NBIT
(N
-1)
143 IF(NODE
.EQ
.NODS
(NNOD
)) THEN
146 ELSEIF
(ITP
(NODE
).EQ
.1) THEN
147 CALL UPBB
(IVAL
,NBIT
(N
),MBIT
(N
),MBAY
(1,LUN
))
148 CALL USRTPL
(LUN
,N
,IVAL
)
154 C UNPACK ONLY THE NODES FOUND IN THE STRING
155 C -----------------------------------------
159 INVN
= INVWIN
(NODE
,LUN
,1,NVAL
(LUN
))
161 CALL UPBB
(IVAL
,NBIT
(INVN
),MBIT
(INVN
),MBAY
(1,LUN
))
162 IF(ITP
(NODE
).EQ
.1) THEN
164 ELSEIF
(ITP
(NODE
).EQ
.2) THEN
165 IF(IVAL
.LT
.MPS
(NODE
)) TAB
(I
) = UPS
(IVAL
,NODE
)
166 ELSEIF
(ITP
(NODE
).EQ
.3) THEN
169 CALL UPC
(CVAL
,NBIT
(INVN
)/8,MBAY
(1,LUN
),KBIT
)
181 900 CALL BORT
('BUFRLIB: UFBGET - INPUT BUFR FILE IS CLOSED, IT MUST'//
182 . ' BE OPEN FOR INPUT')
183 901 CALL BORT
('BUFRLIB: UFBGET - INPUT BUFR FILE IS OPEN FOR OUTPUT'//
184 . ', IT MUST BE OPEN FOR INPUT')
185 902 CALL BORT
('BUFRLIB: UFBGET - A MESSAGE MUST BE OPEN IN INPUT '//
186 . 'BUFR FILE, NONE ARE')