NCEPLIBS-bufr 11.7.1
getlens.f
Go to the documentation of this file.
1C> @file
2C> @brief Read the section lengths of a BUFR message.
3
4C> This subroutine reads the lengths of all of the individual
5C> sections of a given BUFR message, up to a specified point in
6C> the message.
7C>
8C> <p>This subroutine will work on any BUFR message encoded using
9C> BUFR edition 2, 3, or 4
10C>
11C> @author J. Ator
12C> @date 2005-11-29
13C>
14C> @param[in] MBAY -- integer(*): BUFR message
15C> @param[in] LL -- integer: Number of last section for
16C> which the length is to be read.
17C> In other words, setting LL = N means to
18C> read and return the lengths of Sections 0
19C> through N (i.e. LEN0, LEN1,...,LENN).
20C> Any section lengths that are not specified
21C> to be read are returned with a default
22C> placeholder value of -1.
23C> @param[out] LEN0 -- integer: Length (in bytes) of Section 0
24C> @param[out] LEN1 -- integer: Length (in bytes) of Section 1
25C> @param[out] LEN2 -- integer: Length (in bytes) of Section 2
26C> @param[out] LEN3 -- integer: Length (in bytes) of Section 3
27C> @param[out] LEN4 -- integer: Length (in bytes) of Section 4
28C> @param[out] LEN5 -- integer: Length (in bytes) of Section 5
29C>
30C> @remarks
31C> - The start of the BUFR message (i.e. the string 'BUFR') must be
32C> aligned on the first 4 bytes of MBAY.
33C>
34C> <b>Program history log:</b>
35C> | Date | Programmer | Comments |
36C> | -----|------------|----------|
37C> | 2005-11-29 | J. Ator | Original author |
38C>
39 SUBROUTINE getlens(MBAY,LL,LEN0,LEN1,LEN2,LEN3,LEN4,LEN5)
40
41 dimension mbay(*)
42
43C-----------------------------------------------------------------------
44C-----------------------------------------------------------------------
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
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:40
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: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:74