NCEPLIBS-bufr  11.7.0
 All Data Structures Files Functions Variables Pages
iupvs01.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Read a data value from Section 0 or Section 1 of a BUFR
3 C> message.
4 
5 C> This function returns a specified value from within Section 0 or
6 C> Section 1 of a BUFR message.
7 C>
8 C> <p>This function will work on any BUFR message encoded using BUFR
9 C> edition 2, 3, or 4. It is similar to function iupbs01(), except
10 C> that iupbs01() operates on a BUFR message passed in via a memory
11 C> array, whereas this function operates on the BUFR message that was
12 C> read into internal arrays via the most recent call to any of the
13 C> other [message-reading subroutines](@ref hierarchy) for a specified
14 C> Fortran logical unit.
15 C>
16 C> @author J. Ator
17 C> @date 2005-11-29
18 C>
19 C> @param[in] LUNIT -- integer: Fortran logical unit number for
20 C> BUFR file
21 C> @param[in] S01MNEM -- character*(*): Value to be read from
22 C> Section 0 or Section 1 of BUFR message in
23 C> internal arrays for LUNIT
24 C> - 'LENM' = Length (in bytes) of BUFR message
25 C> - 'LEN0' = Length (in bytes) of Section 0
26 C> - 'LEN1' = Length (in bytes) of Section 1
27 C> - 'BEN' = BUFR edition number
28 C> - 'BMT' = BUFR master table
29 C> - 'OGCE' = Originating center
30 C> - 'GSES' = Originating subcenter
31 C> - 'USN' = Update sequence number
32 C> - 'ISC2' = Flag indicating absence/presence of
33 C> (optional) Section 2 in BUFR message:
34 C> - 0 = Section 2 absent
35 C> - 1 = Section 2 present
36 C> - 'MTYP' = Data category
37 C> - 'MSBTI' = Data subcategory (international)
38 C> - 'MSBT' = Data subcategory (local)
39 C> - 'MTV' = Version number of master table
40 C> - 'MTVL' = Version number of local tables
41 C> - 'YCEN' = Year of century (1-100)
42 C> - 'CENT' = Century (e.g., 20 for years 1901-2000,
43 C> 21 for years 2001-2100)
44 C> - 'YEAR' = Year (4-digit)
45 C> - 'MNTH' = Month
46 C> - 'DAYS' = Day
47 C> - 'HOUR' = Hour
48 C> - 'MINU' = Minute
49 C> - 'SECO' = Second
50 C> @returns iupvs01 -- integer: Value corresponding to S01MNEM
51 C> - -1 = S01MNEM was invalid for the edition of BUFR
52 C> message in internal arrays for LUNIT, or some
53 C> other error occurred
54 C>
55 C> @remarks
56 C> - Values corresponding to S01MNEM = 'GSES' can only be read from
57 C> BUFR messages encoded using BUFR edition 3 or 4.
58 C> - Values corresponding to S01MNEM = 'YCEN' or 'CENT' can only be
59 C> read from BUFR messages encoded using BUFR edition 2 or 3.
60 C> - When reading from BUFR messages encoded using BUFR edition 2
61 C> or 3, values corresponding to S01MNEM = 'YEAR' will be
62 C> calculated internally using the values for 'YCEN' and 'CENT',
63 C> or inferred using a windowing technique
64 C> - Values corresponding to S01MNEM = 'SECO' or 'MSBTI' can only
65 C> be read from BUFR messages encoded using BUFR edition 4.
66 C>
67 C> <b>Program history log:</b>
68 C> | Date | Programmer | Comments |
69 C> | -----|------------|----------|
70 C> | 2005-11-29 | J. Ator | Original author |
71 C> | 2014-12-10 | J. Ator | Use modules instead of COMMON blocks |
72 C>
73  FUNCTION iupvs01(LUNIT,S01MNEM)
74 
75  USE moda_bitbuf
76 
77  CHARACTER*(*) s01mnem
78 
79 C-----------------------------------------------------------------------
80 C-----------------------------------------------------------------------
81 
82 C CHECK THE FILE STATUS
83 C ---------------------
84 
85  CALL status(lunit,lun,ilst,imst)
86  IF(ilst.EQ.0) goto 900
87  IF(ilst.GT.0) goto 901
88  IF(imst.EQ.0) goto 902
89 
90 C UNPACK THE REQUESTED VALUE
91 C --------------------------
92 
93  iupvs01 = iupbs01(mbay(1,lun),s01mnem)
94 
95 C EXITS
96 C -----
97 
98  RETURN
99 900 CALL bort('BUFRLIB: IUPVS01 - INPUT BUFR FILE IS CLOSED, IT '//
100  . 'MUST BE OPEN FOR INPUT')
101 901 CALL bort('BUFRLIB: IUPVS01 - INPUT BUFR FILE IS OPEN FOR '//
102  . 'OUTPUT, IT MUST BE OPEN FOR INPUT')
103 902 CALL bort('BUFRLIB: IUPVS01 - A MESSAGE MUST BE OPEN IN INPUT '//
104  . 'BUFR FILE, NONE ARE')
105  END
subroutine status(LUNIT, LUN, IL, IM)
This subroutine checks whether a specified Fortran logical unit number is currently connected to the ...
Definition: status.f:55
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:22
This module contains array and variable declarations used to store BUFR messages internally for multi...
Definition: moda_bitbuf.F:10
function iupvs01(LUNIT, S01MNEM)
This function returns a specified value from within Section 0 or Section 1 of a BUFR message...
Definition: iupvs01.f:73
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