1 | 176,191c176,191 |
---|
2 | < ! TBH: TODO: Replace this hack with run-time decision based on |
---|
3 | < ! TBH: TODO: passed-in calendar. |
---|
4 | < #ifdef NO_LEAP_CALENDAR |
---|
5 | < num_days = 28 ! By default, February has 28 days ... |
---|
6 | < #else |
---|
7 | < num_days = 28 ! By default, February has 28 days ... |
---|
8 | < IF (MOD(year,4).eq.0) THEN |
---|
9 | < num_days = 29 ! But every four years, it has 29 days ... |
---|
10 | < IF (MOD(year,100).eq.0) THEN |
---|
11 | < num_days = 28 ! Except every 100 years, when it has 28 days ... |
---|
12 | < IF (MOD(year,400).eq.0) THEN |
---|
13 | < num_days = 29 ! Except every 400 years, when it has 29 days. |
---|
14 | < END IF |
---|
15 | < END IF |
---|
16 | < END IF |
---|
17 | < #endif |
---|
18 | --- |
---|
19 | > !#ifdef NO_LEAP_CALENDAR |
---|
20 | > ! num_days = 28 ! By default, February has 28 days ... |
---|
21 | > !#else |
---|
22 | > ! num_days = 28 ! By default, February has 28 days ... |
---|
23 | > ! IF (MOD(year,4).eq.0) THEN |
---|
24 | > ! num_days = 29 ! But every four years, it has 29 days ... |
---|
25 | > ! IF (MOD(year,100).eq.0) THEN |
---|
26 | > ! num_days = 28 ! Except every 100 years, when it has 28 days ... |
---|
27 | > ! IF (MOD(year,400).eq.0) THEN |
---|
28 | > ! num_days = 29 ! Except every 400 years, when it has 29 days. |
---|
29 | > ! END IF |
---|
30 | > ! END IF |
---|
31 | > ! END IF |
---|
32 | > !#endif |
---|
33 | > num_days = 1 |
---|
34 | > ! just to keep continuity |
---|
35 | 201,206c201,207 |
---|
36 | < INTEGER :: nfeb |
---|
37 | < IF ( nfeb( year ) .EQ. 29 ) THEN |
---|
38 | < num_diy = 366 |
---|
39 | < ELSE |
---|
40 | < num_diy = 365 |
---|
41 | < ENDIF |
---|
42 | --- |
---|
43 | > ! INTEGER :: nfeb |
---|
44 | > ! IF ( nfeb( year ) .EQ. 29 ) THEN |
---|
45 | > ! num_diy = 366 |
---|
46 | > ! ELSE |
---|
47 | > ! num_diy = 365 |
---|
48 | > ! ENDIF |
---|
49 | > num_diy = 669 |
---|
50 | 266,284c267,285 |
---|
51 | < !$$$ useful, but not used at the moment... |
---|
52 | < SUBROUTINE compute_dayinyear(YR,MM,DD,dayinyear) |
---|
53 | < use ESMF_CalendarMod |
---|
54 | < IMPLICIT NONE |
---|
55 | < INTEGER, INTENT(IN) :: YR,MM,DD ! DD is day of month |
---|
56 | < INTEGER, INTENT(OUT) :: dayinyear |
---|
57 | < INTEGER i |
---|
58 | < integer nfeb |
---|
59 | < |
---|
60 | < dayinyear = 0 |
---|
61 | < DO i = 1,MM-1 |
---|
62 | < if (i.eq.2) then |
---|
63 | < dayinyear = dayinyear + nfeb(YR) |
---|
64 | < else |
---|
65 | < dayinyear = dayinyear + mday(i) |
---|
66 | < endif |
---|
67 | < ENDDO |
---|
68 | < dayinyear = dayinyear + DD |
---|
69 | < END SUBROUTINE compute_dayinyear |
---|
70 | --- |
---|
71 | > !!$$$ useful, but not used at the moment... |
---|
72 | > !SUBROUTINE compute_dayinyear(YR,MM,DD,dayinyear) |
---|
73 | > ! use ESMF_CalendarMod |
---|
74 | > !IMPLICIT NONE |
---|
75 | > ! INTEGER, INTENT(IN) :: YR,MM,DD ! DD is day of month |
---|
76 | > ! INTEGER, INTENT(OUT) :: dayinyear |
---|
77 | > ! INTEGER i |
---|
78 | > ! integer nfeb |
---|
79 | > ! |
---|
80 | > ! dayinyear = 0 |
---|
81 | > ! DO i = 1,MM-1 |
---|
82 | > ! if (i.eq.2) then |
---|
83 | > ! dayinyear = dayinyear + nfeb(YR) |
---|
84 | > ! else |
---|
85 | > ! dayinyear = dayinyear + mday(i) |
---|
86 | > ! endif |
---|
87 | > ! ENDDO |
---|
88 | > ! dayinyear = dayinyear + DD |
---|
89 | > !END SUBROUTINE compute_dayinyear |
---|
90 | 300,302c301,303 |
---|
91 | < IF ( nfeb(time%YR) == 29 ) THEN |
---|
92 | < MMbdys => monthbdysleap |
---|
93 | < ELSE |
---|
94 | --- |
---|
95 | > ! IF ( nfeb(time%YR) == 29 ) THEN |
---|
96 | > ! MMbdys => monthbdysleap |
---|
97 | > ! ELSE |
---|
98 | 304c305 |
---|
99 | < ENDIF |
---|
100 | --- |
---|
101 | > ! ENDIF |
---|
102 | 333,334c334,335 |
---|
103 | < !$$$ fix this so init just points MMbdys to the one we want for this calendar? |
---|
104 | < IF ( nfeb(time%YR) == 29 ) THEN |
---|
105 | --- |
---|
106 | > !!$$$ fix this so init just points MMbdys to the one we want for this calendar? |
---|
107 | > ! IF ( nfeb(time%YR) == 29 ) THEN |
---|
108 | 336,338c337,339 |
---|
109 | < ELSE |
---|
110 | < MMbdys => monthbdys |
---|
111 | < ENDIF |
---|
112 | --- |
---|
113 | > ! ELSE |
---|
114 | > ! MMbdys => monthbdys |
---|
115 | > ! ENDIF |
---|
116 | 373,376c374,377 |
---|
117 | < IF ( nfeb(time%YR) == 29 ) THEN |
---|
118 | < ! PRINT *,'DEBUG: timeaddmonths(): leap year' |
---|
119 | < MMbdys => monthbdysleap |
---|
120 | < ELSE |
---|
121 | --- |
---|
122 | > ! IF ( nfeb(time%YR) == 29 ) THEN |
---|
123 | > !! PRINT *,'DEBUG: timeaddmonths(): leap year' |
---|
124 | > ! MMbdys => monthbdysleap |
---|
125 | > ! ELSE |
---|
126 | 379c380 |
---|
127 | < ENDIF |
---|
128 | --- |
---|
129 | > ! ENDIF |
---|
130 | 403,406c404,407 |
---|
131 | < IF ( nfeb(time%YR) == 29 ) THEN |
---|
132 | < time%basetime%S = time%basetime%S + & |
---|
133 | < ( INT( mdayleap(MM), ESMF_KIND_I8 ) * SECONDS_PER_DAY ) |
---|
134 | < ELSE |
---|
135 | --- |
---|
136 | > ! IF ( nfeb(time%YR) == 29 ) THEN |
---|
137 | > ! time%basetime%S = time%basetime%S + & |
---|
138 | > ! ( INT( mdayleap(MM), ESMF_KIND_I8 ) * SECONDS_PER_DAY ) |
---|
139 | > ! ELSE |
---|
140 | 409c410 |
---|
141 | < ENDIF |
---|
142 | --- |
---|
143 | > ! ENDIF |
---|
144 | 433,436c434,437 |
---|
145 | < IF ( nfeb(time%YR) == 29 ) THEN |
---|
146 | < time%basetime%S = time%basetime%S - & |
---|
147 | < ( INT( mdayleap(MM), ESMF_KIND_I8 ) * SECONDS_PER_DAY ) |
---|
148 | < ELSE |
---|
149 | --- |
---|
150 | > ! IF ( nfeb(time%YR) == 29 ) THEN |
---|
151 | > ! time%basetime%S = time%basetime%S - & |
---|
152 | > ! ( INT( mdayleap(MM), ESMF_KIND_I8 ) * SECONDS_PER_DAY ) |
---|
153 | > ! ELSE |
---|
154 | 439c440 |
---|
155 | < ENDIF |
---|
156 | --- |
---|
157 | > ! ENDIF |
---|