Skip to content

Supporting datetime.timedelta and np.timedelta64 in parcels' arguments #2176

@VeckoTheGecko

Description

@VeckoTheGecko

Python offers two different types of timedelta objects - datetime.timedelta and numpy.timedelta64.

From a public facing API POV, I think it would be good to be able to support both of these types for the params:

  • outputdt in ParticleFile
  • runtime, dt in ParticleSet.execute

From what I can tell 1, I think we should convert these under the hood to a numpy timedelta object for use internally.

Supporting both in the public API allows runtime=timedelta(days=2, hours=2) which I think is nice API from a user POV.

Footnotes

  1. I still need to work out exactly the motivation and workings of numpy datetime/timedelta objects (link)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions