Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manipulation of date & time #248

Merged
merged 6 commits into from
May 20, 2021
Merged

Manipulation of date & time #248

merged 6 commits into from
May 20, 2021

Conversation

m-mohr
Copy link
Member

@m-mohr m-mohr commented May 11, 2021

Adds a new process date_shift, see #247.

Took the simplest path for now...

@m-mohr m-mohr added this to the 1.1.0 milestone May 11, 2021
@m-mohr m-mohr requested a review from soxofaan May 11, 2021 13:09
@m-mohr m-mohr changed the title Date & Time process for date manipulation #247 Manipulation of date & time May 11, 2021
@m-mohr m-mohr mentioned this pull request May 11, 2021
@m-mohr m-mohr linked an issue May 11, 2021 that may be closed by this pull request
proposals/date_shfit.json Outdated Show resolved Hide resolved
proposals/date_shfit.json Outdated Show resolved Hide resolved
proposals/date_shfit.json Outdated Show resolved Hide resolved
proposals/date_shfit.json Outdated Show resolved Hide resolved
@m-mohr
Copy link
Member Author

m-mohr commented May 19, 2021

I've pushed a new commit which improve date_shift and adds implementation details, incl. list of supporting libraries.
Leap seconds are better described, more examples given and it should be better structured in general.
The supporting libraries have been checked to comply to this specification, except for dateutil. Could you confirm that, @soxofaan ?

From my side the only open points are the parameter names then?

meta/implementation.md Outdated Show resolved Hide resolved
meta/implementation.md Outdated Show resolved Hide resolved
meta/implementation.md Outdated Show resolved Hide resolved
proposals/date_shift.json Outdated Show resolved Hide resolved
@soxofaan
Copy link
Member

dateutil. Could you confirm that, @soxofaan ?

yes:

>>> from datetime import datetime
>>> from dateutil.relativedelta import relativedelta
>>> datetime(2021, 1, 31) + relativedelta(months=1)
datetime.datetime(2021, 2, 28, 0, 0)
>>> datetime(2020, 1, 31) + relativedelta(months=1)
datetime.datetime(2020, 2, 29, 0, 0)
>>> datetime(2020,2, 29) + relativedelta(years=1)
datetime.datetime(2021, 2, 28, 0, 0)

@soxofaan
Copy link
Member

From my side the only open points are the parameter names then?

yes I would prefer something more self-descriptive than date_shift(data, value, unit). Especially the data looks like a typo to me

@m-mohr
Copy link
Member Author

m-mohr commented May 20, 2021

yes:

Great, thanks. Could you also quickly verify that the following works?

{ "description": "The process skips over the leap second `2016-12-31T23:59:60Z`.", "arguments": { "data": "2016-12-31T23:59:59Z", "value": 1, "unit": "second" }, "returns": "2017-01-01T00:00:00Z" },

@soxofaan
Copy link
Member

indeed, leap seconds are ignored (or even considered invalid)

>>> datetime(2016, 12, 31, 23,59, 59) + relativedelta(seconds=1)
datetime.datetime(2017, 1, 1, 0, 0)
>>> dateutil.parser.parse("2016-12-31T23:59:60Z")
...
ValueError: second must be in 0..59

@m-mohr m-mohr merged commit a677258 into draft May 20, 2021
@m-mohr m-mohr deleted the date-time branch May 20, 2021 13:18
@m-mohr m-mohr modified the milestones: 1.2.0, 1.1.0 May 20, 2021
soxofaan added a commit to Open-EO/openeo-python-driver that referenced this pull request Jun 22, 2021
soxofaan added a commit to Open-EO/openeo-python-client that referenced this pull request Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Date Math processes
2 participants