NCEPLIBS-bufr  11.6.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> | Date | Programmer | Comments |
36 C> | -----|------------|----------|
37 C> | 2005-11-29 | J. Ator | Original author |
38 C>
39  SUBROUTINE getlens(MBAY,LL,LEN0,LEN1,LEN2,LEN3,LEN4,LEN5)
40 
41  dimension mbay(*)
42 
43 C-----------------------------------------------------------------------
44 C-----------------------------------------------------------------------
45 
46  len0 = -1
47  len1 = -1
48  len2 = -1
49  len3 = -1
50  len4 = -1
51  len5 = -1
52 
53  IF(ll.LT.0) RETURN
54  len0 = iupbs01(mbay,'LEN0')
55 
56  IF(ll.LT.1) RETURN
57  len1 = iupbs01(mbay,'LEN1')
58 
59  IF(ll.LT.2) RETURN
60  iad2 = len0 + len1
61  len2 = iupb(mbay,iad2+1,24) * iupbs01(mbay,'ISC2')
62 
63  IF(ll.LT.3) RETURN
64  iad3 = iad2 + len2
65  len3 = iupb(mbay,iad3+1,24)
66 
67  IF(ll.LT.4) RETURN
68  iad4 = iad3 + len3
69  len4 = iupb(mbay,iad4+1,24)
70 
71  IF(ll.LT.5) RETURN
72  len5 = 4
73 
74  RETURN
75  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:39
function iupbs01(MBAY, S01MNEM)
This function returns a specified value from within Section 0 or Section 1 of a BUFR message...
Definition: iupbs01.f:73