source: dynamico_lmdz/aquaplanet/LMDZ5/libf/phymar/fcttim.h @ 4031

Last change on this file since 4031 was 3990, checked in by millour, 8 years ago

An updated LMDZ5 (based on LMDZ rev 2786) to play with.
EM

File size: 1.6 KB
Line 
1!     ------------------------------------------------------------------
2
3! - Time functions
4!   the descriptions are in the annex 1 of the documentation
5
6! TIME
7
8! NDD   : extraxt dd from ccaammdd
9! NMM   : extract mm from ccaammdd
10! NAA   : extract aa from ccaammdd
11! NCCAA : extract ccaa from ccaammdd
12! NAMD  : extract aammdd from ccaammdd
13! NCENT : return centuary of ccaammdd
14! NYEARC: returns year of the centuary from ccaammdd
15! NCONSTRUCT_DATE : returns ccaammdd given centuary,year,month and day
16! NCTH  : turn seconds into hours
17! RTIME : returns the time of the model (in seconds of course!)
18
19INTEGER_M :: NDD,NMM,NCCAA,NAA,NAMD,NCTH,NZZAA,NZZMM,NCENT,NYEARC,&
20&NCONSTRUCT_DATE
21REAL_B :: RJUDAT,RTIME
22INTEGER_M :: KGRDAT,KSEC,KAAAA,KMM,KDD,KSS
23INTEGER_M :: KCENT,KYEARC,KMONTH,KDAY
24
25NDD(KGRDAT)  =MOD(INT(KGRDAT),100)
26NMM(KGRDAT)  =MOD((KGRDAT-NDD(KGRDAT))/100,100)
27NCCAA(KGRDAT)=KGRDAT/10000
28NAA(KGRDAT)=MOD(INT(NCCAA(KGRDAT)),100)
29NAMD(KGRDAT)=MOD(INT(KGRDAT),1000000)
30NCTH(KSEC)=KSEC/3600
31NCENT(KGRDAT)=NCCAA(KGRDAT)/100+MIN(INT(NAA(KGRDAT)),1)
32NYEARC(KGRDAT)=NAA(KGRDAT)+100*(1-MIN(INT(NAA(KGRDAT)),1))
33NCONSTRUCT_DATE(KCENT,KYEARC,KMONTH,KDAY)=&
34&(KCENT-1)*10**6+KYEARC*10**4+KMONTH*10**2+KDAY
35
36NZZAA(KAAAA,KMM)=KAAAA-( (1-SIGN(1,KMM-3))/2 )
37NZZMM(KMM)=KMM+6*(1-SIGN(1,KMM-3))
38RJUDAT(KAAAA,KMM,KDD)=1720994.5_JPRB + REAL(&
39  &2-NZZAA(KAAAA,KMM)/100 + (NZZAA(KAAAA,KMM)/100)/4 &
40&+ INT(365.25_JPRB*REAL(NZZAA(KAAAA,KMM),JPRB))&
41&+ INT(30.601_JPRB*REAL(NZZMM(KMM)+1,JPRB))&
42&+ KDD,JPRB)
43RTIME(KAAAA,KMM,KDD,KSS)=(RJUDAT(KAAAA,KMM,KDD)-2451545._JPRB)&
44    &*RDAY+REAL(KSS,JPRB)
45!    -------------------------------------------------------------
46
Note: See TracBrowser for help on using the repository browser.