Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CIME/SystemTests/system_tests_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ def _leap_year_correction(startdatetime, restdatetime):
"""
Compute correction needed for restdate time if model is using NO_LEAP calendar

>>> SystemTestsCommon._leap_year_correction(datetime.strptime("00031231","%Y%m%d"), datetime.strptime("00040101","%Y%m%d"))
datetime.timedelta(0)
>>> SystemTestsCommon._leap_year_correction(datetime.strptime("20000225","%Y%m%d"), datetime.strptime("20000301","%Y%m%d"))
datetime.timedelta(days=1)
>>> SystemTestsCommon._leap_year_correction(datetime.strptime("20010225","%Y%m%d"), datetime.strptime("20010301","%Y%m%d"))
Expand All @@ -266,7 +268,7 @@ def _leap_year_correction(startdatetime, restdatetime):
if calendar.isleap(ryr):
dayscorrected += 1
ryr = ryr + 1
if rmon > 2 and smon <= 2 or restdatetime.year > syr:
if rmon > 2 and (smon <= 2 or restdatetime.year > syr):
if calendar.isleap(ryr):
dayscorrected += 1
logger.info("correcting calendar for no leap {}".format(dayscorrected))
Expand Down