Leap and non leap years
Hi @jvegas @dmanubens ,
My run a01a (nemo only, forced by the atmosphere) stopped because the DFS4 atmospheric forcing doesn't use leap years. Hence I went to modify my expdef_a01a.conf file:
CALENDAR = noleap
@masif, it is also unclear if I should modify the NEMO namelist as well:
/cfu/autosubmit/a01a/proj/model/setup/namelist.nemo-ORCA1L75-standalone.cfg.sh
nn_leapy = 0 ! Leap year calendar (1) or not (0)
In any case, resubmitting my job with
CALENDAR = noleap
and the updated namelist gives me an error in autosubmit, more precisely in the routine chunk_date_lib.py
File "/usr/lib/python2.7/dist-packages/autosubmit/date/chunk_date_lib.py", line 138, in sub_days year = date.tm_year AttributeError: 'datetime.datetime' object has no attribute 'tm_year'
The chunk of code that causes the crash is the function sub_days of
def sub_days(date, number_of_days, cal): """ Substract days to a date
:param date: base date
:type date: datetime.datetime
:param number_of_days: number of days to substract
:type number_of_days: int
:param cal: calendar to use
:type cal: str
:return: base date minus substracted days
:rtype: datetime.datetime
"""
result = date - relativedelta(days=number_of_days)
if cal == 'noleap':
year = date.tm_year
if date.tm_mon <= 2:
year -= 1
while year >= result.year:
if calendar.isleap(year):
if result.year == year and result > datetime.date(year, 2, 29):
year -= 1
continue
result -= relativedelta(days=1)
year -= 1
if result.month == 2 and result.day == 29:
result -= relativedelta(days=1)
return result
Is any of you able to help me on that? Thanks François