Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • autosubmit autosubmit
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 338
    • Issues 338
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 21
    • Merge requests 21
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Earth SciencesEarth Sciences
  • autosubmitautosubmit
  • Issues
  • #48
Closed
Open
Issue created Aug 26, 2015 by François Massonnet@fmassonnet

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

Assignee
Assign to
Time tracking