Payu potentially miscalculating a leap year

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

If it is payu I’m surprised it hasn’t been noticed before.

This seems to the relevant section in the payu code

which then calls dateutil.relativedelta.relativedelta

As long as the calendar type isn’t NOLEAP it should rely completely on the dateutil library.

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.