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