NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
getlens.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Read the section lengths of a BUFR message.
3 
4 C> This subroutine reads the lengths of all of the individual
5 C> sections of a given BUFR message, up to a specified point in
6 C> the message.
7 C>
8 C> <p>This subroutine will work on any BUFR message encoded using
9 C> BUFR edition 2, 3, or 4
10 C>
11 C> @author J. Ator
12 C> @date 2005-11-29
13 C>
14 C> @param[in] MBAY - integer(*): BUFR message
15 C> @param[in] LL - integer: Number of last section for
16 C> which the length is to be read.
17 C> In other words, setting LL = N means to
18 C> read and return the lengths of Sections 0
19 C> through N (i.e. LEN0, LEN1,...,LENN).
20 C> Any section lengths that are not specified
21 C> to be read are returned with a default
22 C> placeholder value of -1.
23 C> @param[out] LEN0 - integer: Length (in bytes) of Section 0
24 C> @param[out] LEN1 - integer: Length (in bytes) of Section 1
25 C> @param[out] LEN2 - integer: Length (in bytes) of Section 2
26 C> @param[out] LEN3 - integer: Length (in bytes) of Section 3
27 C> @param[out] LEN4 - integer: Length (in bytes) of Section 4
28 C> @param[out] LEN5 - integer: Length (in bytes) of Section 5
29 C>
30 C> @remarks
31 C> - The start of the BUFR message (i.e. the string 'BUFR') must be
32 C> aligned on the first 4 bytes of MBAY.
33 C>
34 C> <b>Program history log:</b>
35 C> - 2005-11-29 J. Ator -- Original author
36 C>
37  SUBROUTINE getlens(MBAY,LL,LEN0,LEN1,LEN2,LEN3,LEN4,LEN5)
38 
39  dimension mbay(*)
40 
41 C-----------------------------------------------------------------------
42 C-----------------------------------------------------------------------
43 
44  len0 = -1
45  len1 = -1
46  len2 = -1
47  len3 = -1
48  len4 = -1
49  len5 = -1
50 
51  IF(ll.LT.0) RETURN
52  len0 = iupbs01(mbay,'LEN0')
53 
54  IF(ll.LT.1) RETURN
55  len1 = iupbs01(mbay,'LEN1')
56 
57  IF(ll.LT.2) RETURN
58  iad2 = len0 + len1
59  len2 = iupb(mbay,iad2+1,24) * iupbs01(mbay,'ISC2')
60 
61  IF(ll.LT.3) RETURN
62  iad3 = iad2 + len2
63  len3 = iupb(mbay,iad3+1,24)
64 
65  IF(ll.LT.4) RETURN
66  iad4 = iad3 + len3
67  len4 = iupb(mbay,iad4+1,24)
68 
69  IF(ll.LT.5) RETURN
70  len5 = 4
71 
72  RETURN
73  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
function iupbs01(MBAY, S01MNEM)
This function returns a specified value from within Section 0 or Section 1 of a BUFR message...
Definition: iupbs01.f:72