NCEPLIBS-bufr  12.0.0
igetdate.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Read the date-time from Section 1 of a BUFR message.
3 C>
4 C> @author J. Ator @date 2005-11-29
5 
6 C> This function returns the date-time from within Section 1 of a
7 C> BUFR message.
8 C>
9 C> The function will work on any BUFR message encoded using BUFR
10 C> edition 2, 3, or 4.
11 C>
12 C> @param[in] MBAY -- integer(*): BUFR message
13 C> @param[out] IYR -- integer: Year stored within Section 1 of MBAY,
14 C> in format of either YY or YYYY, depending on
15 C> the most recent call to subroutine datelen()
16 C> @param[out] IMO -- integer: Month stored within Section 1 of MBAY
17 C> @param[out] IDY -- integer: Day stored within Section 1 of MBAY
18 C> @param[out] IHR -- integer: Hour stored within Section 1 of MBAY
19 C> @returns igetdate -- integer: Date-time stored within Section 1
20 C> of MBAY, in format of either YYMMDDHH or
21 C> YYYYMMDDHH, depending on the most
22 C> recent call to subroutine datelen()
23 C>
24 C> @remarks
25 C> - The start of the BUFR message (i.e. the string 'BUFR') must be
26 C> aligned on the first 4 bytes of MBAY.
27 C>
28 C> @author J. Ator @date 2005-11-29
29  RECURSIVE FUNCTION igetdate(MBAY,IYR,IMO,IDY,IHR) RESULT(IRET)
30 
31  USE modv_im8b
32 
33  COMMON /dateln/ lendat
34 
35  dimension mbay(*)
36 
37 C-----------------------------------------------------------------------
38 C-----------------------------------------------------------------------
39 
40 C Check for I8 integers.
41 
42  IF(im8b) THEN
43  im8b=.false.
44 
45  iret=igetdate(mbay,iyr,imo,idy,ihr)
46  CALL x48(iyr,iyr,1)
47  CALL x48(imo,imo,1)
48  CALL x48(idy,idy,1)
49  CALL x48(ihr,ihr,1)
50 
51  im8b=.true.
52  RETURN
53  ENDIF
54 
55  iyr = iupbs01(mbay,'YEAR')
56  imo = iupbs01(mbay,'MNTH')
57  idy = iupbs01(mbay,'DAYS')
58  ihr = iupbs01(mbay,'HOUR')
59  IF(lendat.NE.10) THEN
60  iyr = mod(iyr,100)
61  ENDIF
62  iret = (iyr*1000000) + (imo*10000) + (idy*100) + ihr
63 
64  RETURN
65  END
recursive function igetdate(MBAY, IYR, IMO, IDY, IHR)
This function returns the date-time from within Section 1 of a BUFR message.
Definition: igetdate.f:30
recursive function iupbs01(MBAY, S01MNEM)
Read a data value from Section 0 or Section 1 of a BUFR message.
Definition: iupbs01.f:69
This module declares and initializes the IM8B variable.
logical, public im8b
Status indicator to keep track of whether all future calls to BUFRLIB subroutines and functions from ...
subroutine x48(IIN4, IOUT8, NVAL)
Encode one or more 4-byte integer values as 8-byte integer values.
Definition: x48.F:19