[1989] | 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 | |
---|
| 19 | INTEGER(KIND=JPIM) :: NDD,NMM,NCCAA,NAA,NAMD,NCTH,NZZAA,NZZMM,NCENT,NYEARC,& |
---|
| 20 | &NCONSTRUCT_DATE |
---|
| 21 | REAL(KIND=JPRB) :: RJUDAT,RTIME |
---|
| 22 | INTEGER(KIND=JPIM) :: KGRDAT,KSEC,KAAAA,KMM,KDD,KSS |
---|
| 23 | INTEGER(KIND=JPIM) :: KCENT,KYEARC,KMONTH,KDAY |
---|
| 24 | |
---|
| 25 | NDD(KGRDAT) =MOD(KGRDAT,100) |
---|
| 26 | NMM(KGRDAT) =MOD((KGRDAT-NDD(KGRDAT))/100,100) |
---|
| 27 | NCCAA(KGRDAT)=KGRDAT/10000 |
---|
| 28 | NAA(KGRDAT)=MOD(NCCAA(KGRDAT),100) |
---|
| 29 | NAMD(KGRDAT)=MOD(KGRDAT,1000000) |
---|
| 30 | NCTH(KSEC)=KSEC/3600 |
---|
| 31 | NCENT(KGRDAT)=NCCAA(KGRDAT)/100+MIN(NAA(KGRDAT),1) |
---|
| 32 | NYEARC(KGRDAT)=NAA(KGRDAT)+100*(1-MIN(NAA(KGRDAT),1)) |
---|
| 33 | NCONSTRUCT_DATE(KCENT,KYEARC,KMONTH,KDAY)=& |
---|
| 34 | &(KCENT-1)*10**6+KYEARC*10**4+KMONTH*10**2+KDAY |
---|
| 35 | |
---|
| 36 | NZZAA(KAAAA,KMM)=KAAAA-( (1-SIGN(1,KMM-3))/2 ) |
---|
| 37 | NZZMM(KMM)=KMM+6*(1-SIGN(1,KMM-3)) |
---|
| 38 | RJUDAT(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) |
---|
| 43 | RTIME(KAAAA,KMM,KDD,KSS)=(RJUDAT(KAAAA,KMM,KDD)-2451545._JPRB)& |
---|
| 44 | &*RDAY+REAL(KSS,JPRB) |
---|
| 45 | ! ------------------------------------------------------------- |
---|
| 46 | |
---|