Skip to content

Use cftime library for model calendars #589

@anton-seaice

Description

@anton-seaice

There is a confusing mix of cftime datetime objects and standard python datetime objects used through Payu.

e.g. cftime:

return cftime.datetime(

cftime.datetime object

and datetime:

return datetime.datetime(year=d[0], month=d[1], day=d[2],

init_date = datetime.date(year=setup_nml['year_init'], month=1, day=1)

Python datetime objects only believe in the Gregorian calendar (although the implementation appears more like a proleptic_gregorian ? )

Payu even has functions to make python datetimes pretend to understand other calendars , e.g. :

def date_plus_seconds(init_date, seconds, caltype):

We could (possibly should) move to using cftime everywhere in payu for model time, and only use python datetimes for real world time (e.g. machine time).

Related: #305

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions