updated top-level README and version_decl for V4.5 (#1847)
[WRF.git] / var / external / bufr / igetdate.f
blob2f01b6a5a5fdc71c398b0ed2cca1f1053f5d7b01
1 FUNCTION IGETDATE(MBAY,IYR,IMO,IDY,IHR)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
5 C SUBPROGRAM: IGETDATE
6 C PRGMMR: ATOR ORG: NP12 DATE: 2005-11-29
8 C ABSTRACT: THIS FUNCTION UNPACKS AND RETURNS THE SECTION 1 DATE-TIME
9 C FROM THE BUFR MESSAGE STORED IN ARRAY MBAY. IT WILL WORK ON ANY
10 C MESSAGE ENCODED USING BUFR EDITION 2, 3 OR 4. THE START OF THE
11 C BUFR MESSAGE, (I.E. THE STRING "BUFR") MUST BE ALIGNED ON THE FIRST
12 C FOUR BYTES OF MBAY.
14 C PROGRAM HISTORY LOG:
15 C 2005-11-29 J. ATOR -- ORIGINAL AUTHOR
17 C USAGE: IGETDATE (MBAY, IYR, IMO, IDY, IHR)
18 C INPUT ARGUMENT LIST:
19 C MBAY - INTEGER: *-WORD PACKED BINARY ARRAY CONTAINING
20 C BUFR MESSAGE
22 C OUTPUT ARGUMENT LIST:
23 C IYR - INTEGER: SECTION 1 YEAR (YYYY OR YY, DEPENDING ON
24 C DATELEN() VALUE)
25 C IMO - INTEGER: SECTION 1 MONTH (MM)
26 C IDY - INTEGER: SECTION 1 DAY (DD)
27 C IHR - INTEGER: SECTION 1 HOUR (HH)
28 C IGETDATE - INTEGER: SECTION 1 DATE-TIME (YYYYMMDDHH OR YYMMDDHH,
29 C DEPENDING ON DATELEN() VALUE)
31 C REMARKS:
32 C THIS ROUTINE CALLS: IUPBS01
33 C THIS ROUTINE IS CALLED BY: CKTABA DATEBF DUMPBF
34 C Normally not called by application
35 C programs but it could be.
37 C ATTRIBUTES:
38 C LANGUAGE: FORTRAN 77
39 C MACHINE: PORTABLE TO ALL PLATFORMS
41 C$$$
43 COMMON /DATELN/ LENDAT
45 DIMENSION MBAY(*)
47 C-----------------------------------------------------------------------
48 C-----------------------------------------------------------------------
50 IYR = IUPBS01(MBAY,'YEAR')
51 IMO = IUPBS01(MBAY,'MNTH')
52 IDY = IUPBS01(MBAY,'DAYS')
53 IHR = IUPBS01(MBAY,'HOUR')
54 IF(LENDAT.NE.10) THEN
55 IYR = MOD(IYR,100)
56 ENDIF
57 IGETDATE = (IYR*1000000) + (IMO*10000) + (IDY*100) + IHR
59 RETURN
60 END