1 | ! (C) Copyright 1989- ECMWF. |
---|
2 | ! (C) Copyright 1989- Meteo-France. |
---|
3 | ! |
---|
4 | ! This software is licensed under the terms of the Apache Licence Version 2.0 |
---|
5 | ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
---|
6 | ! |
---|
7 | ! In applying this licence, ECMWF does not waive the privileges and immunities |
---|
8 | ! granted to it by virtue of its status as an intergovernmental organisation |
---|
9 | ! nor does it submit to any jurisdiction. |
---|
10 | |
---|
11 | ! ------------------------------------------------------------------ |
---|
12 | |
---|
13 | ! - Time functions |
---|
14 | ! the descriptions are in the annex 1 of the documentation |
---|
15 | |
---|
16 | ! TIME |
---|
17 | |
---|
18 | ! NDD : extraxt dd from ccaammdd |
---|
19 | ! NMM : extract mm from ccaammdd |
---|
20 | ! NAA : extract aa from ccaammdd |
---|
21 | ! NCCAA : extract ccaa from ccaammdd |
---|
22 | ! NAMD : extract aammdd from ccaammdd |
---|
23 | ! NCENT : return centuary of ccaammdd |
---|
24 | ! NYEARC: returns year of the centuary from ccaammdd |
---|
25 | ! NCONSTRUCT_DATE : returns ccaammdd given centuary,year,month and day |
---|
26 | ! NCTH : turn seconds into hours |
---|
27 | ! RTIME : returns the time of the model (in seconds of course!) |
---|
28 | ! RINCDAY : length of a day (in seconds) |
---|
29 | |
---|
30 | INTEGER(KIND=JPIM) :: NDD,NMM,NCCAA,NAA,NAMD,NCTH,NZZAA,NZZMM,NCENT,NYEARC,& |
---|
31 | &NCONSTRUCT_DATE |
---|
32 | REAL(KIND=JPRD) :: RJUDAT,RTIME |
---|
33 | REAL(KIND=JPRB) :: RINCDAY |
---|
34 | INTEGER(KIND=JPIM) :: KGRDAT,KSEC,KAAAA,KMM,KDD,KSS |
---|
35 | INTEGER(KIND=JPIM) :: KCENT,KYEARC,KMONTH,KDAY |
---|
36 | |
---|
37 | NDD(KGRDAT) =MOD(KGRDAT,100) |
---|
38 | NMM(KGRDAT) =MOD((KGRDAT-NDD(KGRDAT))/100,100) |
---|
39 | NCCAA(KGRDAT)=KGRDAT/10000 |
---|
40 | NAA(KGRDAT)=MOD(NCCAA(KGRDAT),100) |
---|
41 | NAMD(KGRDAT)=MOD(KGRDAT,1000000) |
---|
42 | NCTH(KSEC)=KSEC/3600 |
---|
43 | NCENT(KGRDAT)=NCCAA(KGRDAT)/100+MIN(NAA(KGRDAT),1) |
---|
44 | NYEARC(KGRDAT)=NAA(KGRDAT)+100*(1-MIN(NAA(KGRDAT),1)) |
---|
45 | NCONSTRUCT_DATE(KCENT,KYEARC,KMONTH,KDAY)=& |
---|
46 | &(KCENT-1)*10**6+KYEARC*10**4+KMONTH*10**2+KDAY |
---|
47 | |
---|
48 | NZZAA(KAAAA,KMM)=KAAAA-( (1-SIGN(1,KMM-3))/2 ) |
---|
49 | NZZMM(KMM)=KMM+6*(1-SIGN(1,KMM-3)) |
---|
50 | RJUDAT(KAAAA,KMM,KDD)=1720994.5_JPRD + REAL(& |
---|
51 | &2-NZZAA(KAAAA,KMM)/100 + (NZZAA(KAAAA,KMM)/100)/4 & |
---|
52 | &+ INT(365.25_JPRD*REAL(NZZAA(KAAAA,KMM),JPRD))& |
---|
53 | &+ INT(30.601_JPRD*REAL(NZZMM(KMM)+1,JPRD))& |
---|
54 | &+ KDD,JPRD) |
---|
55 | RTIME(KAAAA,KMM,KDD,KSS,RINCDAY)=(RJUDAT(KAAAA,KMM,KDD)-2451545._JPRD)& |
---|
56 | &*RINCDAY+REAL(KSS,JPRD) |
---|
57 | ! ------------------------------------------------------------- |
---|