NCEPLIBS-bufr  11.6.0
 All Data Structures Files Functions Variables Pages
iupbs3.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Read a data value from Section 3 of a BUFR message.
3 
4 C> This function returns a specified value from within Section 3
5 C> of a BUFR message.
6 C>
7 C> @author J. Ator
8 C> @date 2009-03-23
9 C>
10 C> @param[in] MBAY -- integer(*): BUFR message
11 C> @param[in] S3MNEM -- character*(*): Value to be read from
12 C> Section 3 of MBAY
13 C> - 'NSUB' = Number of data subsets
14 C> - 'IOBS' = Flag indicating whether the
15 C> message contains observed data:
16 C> - 0 = No
17 C> - 1 = Yes
18 C> - 'ICMP' = Flag indicating whether the
19 C> message contains compressed data:
20 C> - 0 = No
21 C> - 1 = Yes
22 C> @returns iupbs3 -- integer: Value corresponding to S3MNEM
23 C> - -1 = S3MNEM was invalid
24 C>
25 C> @remarks
26 C> - The start of the BUFR message (i.e. the string 'BUFR') must be
27 C> aligned on the first 4 bytes of MBAY.
28 C>
29 C> <b>Program history log:</b>
30 C> | Date | Programmer | Comments |
31 C> | -----|------------|----------|
32 C> | 2009-03-23 | J. Ator | Original author |
33 C>
34  FUNCTION iupbs3(MBAY,S3MNEM)
35 
36  dimension mbay(*)
37 
38  character*(*) s3mnem
39 
40 C-----------------------------------------------------------------------
41 C-----------------------------------------------------------------------
42 
43 C Call subroutine WRDLEN to initialize some important information
44 C about the local machine, just in case subroutine OPENBF hasn't
45 C been called yet.
46 
47  CALL wrdlen
48 
49 C Skip to the beginning of Section 3.
50 
51  CALL getlens(mbay,3,len0,len1,len2,len3,l4,l5)
52  ipt = len0 + len1 + len2
53 
54 C Unpack the requested value.
55 
56  IF(s3mnem.EQ.'NSUB') THEN
57  iupbs3 = iupb(mbay,ipt+5,16)
58  ELSE IF( (s3mnem.EQ.'IOBS') .OR. (s3mnem.EQ.'ICMP') ) THEN
59  ival = iupb(mbay,ipt+7,8)
60  IF(s3mnem.EQ.'IOBS') THEN
61  imask = 128
62  ELSE
63  imask = 64
64  ENDIF
65  iupbs3 = min(1,iand(ival,imask))
66  ELSE
67  iupbs3 = -1
68  ENDIF
69 
70  RETURN
71  END
function iupbs3(MBAY, S3MNEM)
This function returns a specified value from within Section 3 of a BUFR message.
Definition: iupbs3.f:34
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
subroutine wrdlen
This subroutine figures out some important information about the local machine on which the BUFRLIB s...
Definition: wrdlen.F:35