NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
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 
4 C> This subroutine returns the sequence of data descriptors
5 C> contained within Section 3 of a BUFR message.
6 C>
7 C> @author J. Ator
8 C> @date 2003-11-04
9 C>
10 C> @param[in] MBAY - integer(*): BUFR message
11 C> @param[in] LCDS3 - integer: Dimensioned size of CDS3;
12 C> used by the subroutine to ensure that
13 C> it doesn't overflow the CDS3 array
14 C> @param[out] CDS3 - character*6(*): Data descriptor sequence
15 C> within Section 3 of MBAY
16 C> @param[out] NDS3 - integer: Number of data descriptors in CDS3
17 C>
18 C> @remarks
19 C> - The start of the BUFR message (i.e. the string 'BUFR') must be
20 C> aligned on the first 4 bytes of MBAY.
21 C> - This subroutine does not recursively resolve any Table D
22 C> descriptors from within Section 3; rather, what is returned in
23 C> CDS3 is the exact list of data descriptors as it appears within
24 C> Section 3 of MBAY.
25 C>
26 C> <b>Program history log:</b>
27 C> - 2003-11-04 J. Ator -- Original author
28 C> - 2004-08-18 J. Ator -- Removed IFIRST check, since wrdlen() now
29 C> keeps track of whether it has been called
30 C> - 2005-11-29 J. Ator -- Use getlens()
31 C> - 2009-03-23 J. Ator -- Added LCDS3 argument and check
32 C>
33  SUBROUTINE upds3(MBAY,LCDS3,CDS3,NDS3)
34 
35  dimension mbay(*)
36 
37  CHARACTER*6 cds3(*), adn30
38 
39 C-----------------------------------------------------------------------
40 C-----------------------------------------------------------------------
41 
42 C Call subroutine WRDLEN to initialize some important information
43 C about the local machine, just in case subroutine OPENBF hasn't
44 C been called yet.
45 
46  CALL wrdlen
47 
48 C Skip to the beginning of Section 3.
49 
50  CALL getlens(mbay,3,len0,len1,len2,len3,l4,l5)
51  ipt = len0 + len1 + len2
52 
53 C Unpack the Section 3 descriptors.
54 
55  nds3 = 0
56  DO jj = 8,(len3-1),2
57  nds3 = nds3 + 1
58  IF(nds3.GT.lcds3) goto 900
59  cds3(nds3) = adn30(iupb(mbay,ipt+jj,16),6)
60  ENDDO
61 
62  RETURN
63 900 CALL bort('BUFRLIB: UPDS3 - OVERFLOW OF OUTPUT DESCRIPTOR '//
64  . 'ARRAY; TRY A LARGER DIMENSION FOR THIS ARRAY')
65  END
function iupb(MBAY, NBYT, NBIT)
THIS FUNCTION UNPACKS AND RETURNS A BINARY INTEGER WORD CONTAINED WITHIN NBIT BITS OF A BUFR MESSAGE ...
Definition: iupb.f:36
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:37
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:33
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
subroutine wrdlen
This subroutine figures out some important information about the local machine on which the BUFRLIB s...
Definition: wrdlen.F:43
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23