Skip to content

Commit

Permalink
fix correction for no_leap calendar in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Dec 19, 2024
1 parent eb274e1 commit 5013a2e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CIME/SystemTests/system_tests_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,15 @@ def _set_restart_interval(
smon = startdatetime.month
ryr = restdatetime.year
rmon = restdatetime.month
while ryr > syr:
if rmon > 2 and calendar.isleap(ryr):
while ryr > syr and (ryr < restdatetime.year or rmon > 2):
if calendar.isleap(ryr):
dayscorrected += 1
ryr = ryr - 1
if rmon > 2 and smon <= 2:
if rmon > 2 and smon <= 2 or restdatetime.year > syr:
if calendar.isleap(syr):
dayscorrected += 1
restdatetime = restdatetime + timedelta(days=dayscorrected)
logger.info("correcting calendar for no leap {}".format(dayscorrected))
self._rest_time = (
f".{restdatetime.year:04d}-{restdatetime.month:02d}-{restdatetime.day:02d}-"
)
Expand Down

0 comments on commit 5013a2e

Please sign in to comment.