holger
(Holger Wolff, CLEX CMS)
13 July 2023 02:03
1
I have a student who is running ACCESS-ESM in a paleoclimate simulation. She starts at a virtual year 101, and the model runs fine until the year 400.
In the year 400, at the very end, oasis capitulates with the error message:
oasis_advance_run at 31536000 31536000 ERROR: t_surf
oasis_advance_run ERROR model time beyond namcouple maxtime 31536000
31536000
oasis_advance_run abort by model : 2 proc : 0
31,536,000 seconds is exactly 365 days, but the year 400 is a leap year (divisible by 400), and so the submodels want to keep going just one more day.
Has anyone else experienced this?
Thanks
Holger
1 Like
Aidan
(Aidan Heerdegen, ACCESS-NRI Release Team Lead)
13 July 2023 06:11
2
If it is payu
I’m surprised it hasn’t been noticed before.
This seems to the relevant section in the payu
code
run_runtime = cal.runtime_from_date(
run_start_date,
self.expt.runtime['years'],
self.expt.runtime['months'],
self.expt.runtime['days'],
self.expt.runtime.get('seconds', 0),
caltype)
which then calls dateutil.relativedelta.relativedelta
def runtime_from_date(start_date, years, months, days, seconds, caltype):
"""
Get the number of seconds from start date to start date + date_delta.
Ignores Feb 29 for caltype == NOLEAP.
"""
end_date = start_date + relativedelta(years=years, months=months,
days=days)
runtime = end_date - start_date
if caltype == NOLEAP:
runtime -= get_leapdays(start_date, end_date)
return int(runtime.total_seconds() + seconds)
As long as the calendar type isn’t NOLEAP
it should rely completely on the dateutil
library.
holger
(Holger Wolff, CLEX CMS)
13 July 2023 06:30
3
It should. But it doesn’t.
I’ve tested it:
from datetime import datetime
from dateutil.relativedelta import relativedelta
start = datetime(year=400, month=1, day=1)
end = start + relativedelta(years=1, months=0, days=0)
print(int((end-start).total_seconds())) # prints 31622400
But the namcouple file in the work
directory the value is clearly set to 31536000
The first code snippet of your answer is surrounded by an if
clause:
if self.expt.runtime:
run_runtime = cal.runtime_from_date(
run_start_date,
self.expt.runtime['years'],
self.expt.runtime['months'],
self.expt.runtime['days'],
self.expt.runtime.get('seconds', 0),
caltype
)
else:
run_runtime = cpl_nml[cpl_group]['runtime']
I couldn’t figure out what self.expt
is in this regard, or what cpl_nml[cpl_group]['runtime']
is for that matter.