-
Notifications
You must be signed in to change notification settings - Fork 284
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
Loss of 'normal numbers' for times cells is limiting #2953
Comments
Yep, this is an implication of using datetimes as cell values. It would be nice if we could use a coordinate in a constraint...
I don't think this works though. The proposal in #1988 would give us Your 2 liner:
could be re-written as (untested)
The easy answer to this is - absolutely not. Behaviour change always has implications, and this was a known implication of moving from a naive numeric representation to a richer datetime one. Happy to close this @pp-mo? |
How about cube.subset(cube.coord('time')[3:]) |
Or t1 = cube.coord('time').cell(2)
new_cube = cube.extract(iris.Constraint(time=lambda t: t > t1)) (works in Iris1.13 with Iris.FUTURE.cell_datetime_objects = True) |
Subset I hadn't thought of + looks like a really neat approach to this specific requirement.
I think this is exactly the case that doesn't work : it works if you have a standard calendar (hence "real" datetimes), but not for e.g. a model calendar : the cell points are then netcdf-datetimes, which don't support comparison operations. |
Alternative methods aside, my original point is that the new way of treating coordinate values as datetimes is rather awkward in these cases, as (some) datetimes just don't provide all the behaviours you need + expect.
As it is not a "richer" tool in this case, I still wonder whether the 'new' behaviour is actually a forward step. Or, is there a case that there is "always" a good way of doing these things in the new regime ? |
I'm pretty sure that has now changed:
To reiterate my statement:
We knew what we were getting into with this change. I don't think there is anything here that makes me question that decision. I'm going to close this one out. Conversation is welcome to continue (and even re-open if we get new information that is likely to make us change that decision). |
We've now deprecated the use of
Iris.FUTURE.cell_datetime_objects = False
(in Iris 2 rc0).
But, when data has non-standard calendars, this is a pain because then comparison between cell points does not work.
This can now get rather ugly (see below).
It also seems to me that the use of cell datetimes is clearly a special case, and maybe shouldn't be the default (let alone the only) behaviour
So, Should we drop this deprecation ?
Example : real user case :
Want to discard the first 3 timepoints of a cube.
WAS:
OR (probably better)
But these methods no longer work.
You need to explicitly "convert to numbers", like this :
Or use slicing instead :
ugh !!
The text was updated successfully, but these errors were encountered: