-
Notifications
You must be signed in to change notification settings - Fork 286
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
unify_time_units()
prevents concatenation due to inconsistent dtype
#5372
Comments
This seems familiar… #3213 |
Closed by #5412 |
Thanks for the fix. It's unfortunate that this issue has been reported for over 10 years. |
Hi @am-thyst, I'm afraid this is the unfortunate reality. The SciTools packages have around 10 regular maintainers (as usual balancing with other responsibilities too), and we prioritise as best we can; this leaves many bugs and good ideas that cannot be worked on with the available resource. I expect we have enough work for 20 maintainers working near full-time, but realistically the current situation is here to stay and we set our expectations accordingly. I can understand that this might not meet yours and others' needs, and we will always strive to do better, but I want to be honest with you about the situation. |
🐛 Bug Report
Thanks to @HelenRJohnson for spotting this.
Using
iris.util.unify_time_units()
on aCubeList
where the time units have an integerdtype
prevents theCubeList
from being concatenated:Explanation
This is because
unify_time_units()
converts all time units to match the first one. cf-units will not convert something if it is already equal, so the first time unit does not undergo conversion. Meanwhile all the other time units are coerced todtype="float64"
, to avoid problems with partial days etc. So the end result is that the first time unit remains an integerdtype
while all the others are floats, and this is something that is checked when preparing for concatenation.Proposed solution
Force all time coordinates to be
dtype=float64
at the start of theunify_time_units()
process, and advertise this behaviour in the docstring. We should include tests for the new lines, too. I tested this with the below and it fixed my example.How To Reproduce
Steps to reproduce the behaviour:
CubeList
with multipleCube
s, which can be concatenated together.Each
Cube
should include a time coordinate, usingdtype=int
for the points.Make sure the final
Cube
's time coordinate has a different epoch to the others (prevents successful concatenation).iris.util.unify_time_units()
to theCubeList
.CubeList.concatenate_cube()
on thisCubeList
.Expected behaviour
Should produce a single concatenated
Cube
.Environment
v3.6.1
The text was updated successfully, but these errors were encountered: