-
Notifications
You must be signed in to change notification settings - Fork 94
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
final cycle point offset giving wrong result #4908
Comments
I think this is an isodatetime bug: >>> from metomi.isodatetime.data import *
>>> a = TimePoint(year=2021, month_of_year=7)
2021-07-01T00Z
>>> b = Duration(months=6, days=-1)
P6M-1D
>>> a + b
2021-12-30T00Z Note: >>> a + Duration(months=6) - Duration(days=1)
2021-12-31T00Z # correct answer |
I've flip-flopped on this one, isodatetime is arguably doing the right thing, Cylc just needs to handle the two durations independently rather than merging them together. |
But surely in isodatetime
should give the same result as
? |
Actually in the case of
which would explain the answer of Edit: yes
|
I'm not sure about that, you could argue both ways. You're asking isodatetime to subtract one day from a month. |
Ok, ignore the subtraction, this problem still occurs for two additions:
(I've used shorthand to represent the The problem seems to be isodatetime applies the additions in order of smallest unit to largest, which is opposite to their representation ( |
I have debugged a workflow with
and found that Cylc does indeed convert the expression cylc-flow/cylc/flow/time_parser.py Line 378 in e4659ad
However it also converts the reverse
|
Fix conjugate duration bug * Closes cylc#4908 * Fix bug where specifying multiple datetime offsets would not obey the given order.
In this example the final cycle point ends up on the 30th of December rather than the 31st as expected:
This is surprising given isodatetime yields the 31st:
Swap months for years and the calculation comes out correctly:
Pull requests welcome!
This is an Open Source project - please consider contributing a bug fix
yourself (please read
CONTRIBUTING.md
before starting any work though).The text was updated successfully, but these errors were encountered: