NCEPLIBS-bufr  12.0.1
upds3.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Read data descriptors from Section 3 of a BUFR message.
3 C>
4 C> @author J. Ator @date 2003-11-04
5 
6 C> This subroutine returns the sequence of data descriptors
7 C> contained within Section 3 of a BUFR message.
8 C>
9 C> @remarks
10 C> - The start of the BUFR message (i.e. the string 'BUFR') must be
11 C> aligned on the first 4 bytes of MBAY.
12 C> - This subroutine does not recursively resolve any Table D
13 C> descriptors from within Section 3; rather, what is returned in
14 C> CDS3 is the exact list of data descriptors as it appears within
15 C> Section 3 of MBAY.
16 C>
17 C> @param[in] MBAY - integer(*): BUFR message.
18 C> @param[in] LCDS3 - integer: Dimensioned size (in integers) of CDS3 in the calling
19 C> program; used by the subroutine to ensure that it doesn't overflow the CDS3 array.
20 C> @param[out] CDS3 - character*6(*): Data descriptor sequence within Section 3 of MBAY.
21 C> @param[out] NDS3 - integer: Number of data descriptors in CDS3.
22 C>
23 C> @author J. Ator @date 2003-11-04
24 
25  RECURSIVE SUBROUTINE upds3(MBAY,LCDS3,CDS3,NDS3)
26 
27  USE modv_im8b
28 
29  dimension mbay(*)
30 
31  CHARACTER*6 cds3(*), adn30
32 
33 C-----------------------------------------------------------------------
34 C-----------------------------------------------------------------------
35 
36 C Check for I8 integers.
37 
38  IF(im8b) THEN
39  im8b=.false.
40 
41  CALL x84(lcds3,my_lcds3,1)
42  CALL upds3(mbay,my_lcds3,cds3,nds3)
43  CALL x48(nds3,nds3,1)
44 
45  im8b=.true.
46  RETURN
47  ENDIF
48 
49 C Call subroutine WRDLEN to initialize some important information
50 C about the local machine, just in case subroutine OPENBF hasn't
51 C been called yet.
52 
53  CALL wrdlen
54 
55 C Skip to the beginning of Section 3.
56 
57  CALL getlens(mbay,3,len0,len1,len2,len3,l4,l5)
58  ipt = len0 + len1 + len2
59 
60 C Unpack the Section 3 descriptors.
61 
62  nds3 = 0
63  DO jj = 8,(len3-1),2
64  nds3 = nds3 + 1
65  IF(nds3.GT.lcds3) GOTO 900
66  cds3(nds3) = adn30(iupb(mbay,ipt+jj,16),6)
67  ENDDO
68 
69  RETURN
70 900 CALL bort('BUFRLIB: UPDS3 - OVERFLOW OF OUTPUT DESCRIPTOR '//
71  . 'ARRAY; TRY A LARGER DIMENSION FOR THIS ARRAY')
72  END
character *(*) function adn30(IDN, L30)
Convert a WMO bit-wise representation of an FXY value to a character string of length 5 or 6.
Definition: adn30.f:23
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18
recursive subroutine getlens(MBAY, LL, LEN0, LEN1, LEN2, LEN3, LEN4, LEN5)
This subroutine reads the lengths of all of the individual sections of a given BUFR message,...
Definition: getlens.f:36
recursive function iupb(MBAY, NBYT, NBIT)
Decode an integer value from an integer array.
Definition: iupb.f:21
This module declares and initializes the IM8B variable.
logical, public im8b
Status indicator to keep track of whether all future calls to BUFRLIB subroutines and functions from ...
recursive subroutine upds3(MBAY, LCDS3, CDS3, NDS3)
This subroutine returns the sequence of data descriptors contained within Section 3 of a BUFR message...
Definition: upds3.f:26
subroutine wrdlen
Determine important information about the local machine.
Definition: wrdlen.F:25
subroutine x48(IIN4, IOUT8, NVAL)
Encode one or more 4-byte integer values as 8-byte integer values.
Definition: x48.F:19
subroutine x84(IIN8, IOUT4, NVAL)
Encode one or more 8-byte integer values as 4-byte integer values.
Definition: x84.F:19