3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
6 C PRGMMR: WOOLLEN ORG: NP20 DATE: 1994-01-06
8 C ABSTRACT: THIS SUBROUTINE UNPACKS THE NEXT SUBSET FROM THE INTERNAL
9 C UNCOMPRESSED MESSAGE BUFFER (ARRAY MBAY IN COMMON BLOCK /BITBUF/)
10 C AND STORES THE UNPACKED SUBSET WITHIN THE INTERNAL ARRAY VAL(*,LUN)
11 C IN COMMON BLOCK /USRINT/.
13 C PROGRAM HISTORY LOG:
14 C 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
15 C 1998-10-27 J. WOOLLEN -- MODIFIED TO CORRECT PROBLEMS CAUSED BY IN-
16 C LINING CODE WITH FPP DIRECTIVES
17 C 1999-11-18 J. WOOLLEN -- THE NUMBER OF BUFR FILES WHICH CAN BE
18 C OPENED AT ONE TIME INCREASED FROM 10 TO 32
19 C (NECESSARY IN ORDER TO PROCESS MULTIPLE
20 C BUFR FILES UNDER THE MPI)
21 C 2000-09-19 J. WOOLLEN -- MAXIMUM MESSAGE LENGTH INCREASED FROM
22 C 10,000 TO 20,000 BYTES
23 C 2003-11-04 J. WOOLLEN -- FIXED A BUG WHICH COULD ONLY OCCUR WHEN
24 C THE LAST ELEMENT IN A SUBSET IS A CHARACTER
25 C 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
27 C 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
28 C INCREASED FROM 15000 TO 16000 (WAS IN
29 C VERIFICATION VERSION); UNIFIED/PORTABLE FOR
30 C WRF; ADDED DOCUMENTATION (INCLUDING
32 C 2004-08-09 J. ATOR -- MAXIMUM MESSAGE LENGTH INCREASED FROM
33 C 20,000 TO 50,000 BYTES
34 C 2007-01-19 J. ATOR -- PREVENT OVERFLOW OF CVAL FOR STRINGS LONGER
36 C 2012-03-02 J. ATOR -- USE FUNCTION UPS
37 C 2012-06-04 J. ATOR -- SET DECODED REAL*8 VALUE TO "MISSING" WHEN
38 C CORRESPONDING CHARACTER FIELD HAS ALL BITS
41 C USAGE: CALL RDTREE (LUN)
42 C INPUT ARGUMENT LIST:
43 C LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
46 C THIS ROUTINE CALLS: RCSTPL ICBFMS UPBB UPC
48 C THIS ROUTINE IS CALLED BY: READSB
49 C Normally not called by any application
53 C LANGUAGE: FORTRAN 77
54 C MACHINE: PORTABLE TO ALL PLATFORMS
60 COMMON /BITBUF
/ MAXBYT
,IBIT
,IBAY
(MXMSGLD4
),MBYT
(NFILES
),
61 . MBAY
(MXMSGLD4
,NFILES
)
62 COMMON /BTABLES
/ MAXTAB
,NTAB
,TAG
(MAXJL
),TYP
(MAXJL
),KNT
(MAXJL
),
63 . JUMP
(MAXJL
),LINK
(MAXJL
),JMPB
(MAXJL
),
64 . IBT
(MAXJL
),IRF
(MAXJL
),ISC
(MAXJL
),
65 . ITP
(MAXJL
),VALI
(MAXJL
),KNTI
(MAXJL
),
66 . ISEQ
(MAXJL
,2),JSEQ
(MAXJL
)
67 COMMON /USRINT
/ NVAL
(NFILES
),INV
(MAXSS
,NFILES
),VAL
(MAXSS
,NFILES
)
68 COMMON /USRBIT
/ NBIT
(MAXSS
),MBIT
(MAXSS
)
74 EQUIVALENCE
(CVAL
,RVAL
)
77 C-----------------------------------------------------------------------
78 C Statement function to compute BUFR "missing value" for field
79 C of length IBT(NODE)) bits (all bits "on"):
81 MPS
(NODE
) = 2**(IBT
(NODE
))-1
82 C-----------------------------------------------------------------------
84 C CYCLE THROUGH A SUBSET SETTING UP THE TEMPLATE
85 C ----------------------------------------------
91 C UNPACK A SUBSET INTO THE USER ARRAY IVAL
92 C ----------------------------------------
95 CALL UPBB
(IVAL
(N
),NBIT
(N
),MBIT
(N
),MBAY
(1,LUN
))
98 C LOOP THROUGH EACH ELEMENT OF THE SUBSET, CONVERTING THE UNPACKED
99 C VALUES TO THE PROPER TYPES
100 C ----------------------------------------------------------------
104 IF(ITP
(NODE
).EQ
.1) THEN
106 C The unpacked value is a delayed descriptor replication factor.
109 ELSEIF
(ITP
(NODE
).EQ
.2) THEN
111 C The unpacked value is a real.
113 IF(IVAL
(N
).LT
.MPS
(NODE
)) VAL
(N
,LUN
) = UPS
(IVAL
(N
),NODE
)
114 ELSEIF
(ITP
(NODE
).EQ
.3) THEN
116 C The value is a character string, so unpack it using an
117 C equivalenced REAL*8 value. Note that a maximum of 8 characters
118 C will be unpacked here, so a separate subsequent call to BUFR
119 C archive library subroutine READLC will be needed to fully
120 C unpack any string longer than 8 characters.
124 NBT
= MIN
(8,NBIT
(N
)/8)
125 CALL UPC
(CVAL
,NBT
,MBAY
(1,LUN
),KBIT
)
126 IF (NBIT
(N
).LE
.64 .AND
. ICBFMS
(CVAL
,NBT
).NE
.0) THEN
134 IBIT
= NBIT
(NVAL
(LUN
))+MBIT
(NVAL
(LUN
))