-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
invalid timestamps in the future #975
Comments
This almost certainly related to the fact that datetime64[ns] does not support years outside the years 1678-2262: |
Yes, definitely. However, the documentation states that we should get back a In my example (2) it returned a working |
I tried to look into the logic of decoding datetimes and I am not sure I got it. So the dtype of the dates should be:
(Is it ever a The necessary conversion seems to be determined lazily (which may be the core of my problem above), Try this:
However, when I load these dates from a netCDF file (see the example in the first post) it results in an error. (Thus, the behavior is not exactly the same as when using Another (or the same) problem is that in Here: (https://github.com/pydata/xarray/blob/master/xarray/conventions.py, line 375) |
Yes, checking the first and last elements would be an improvement over our current heuristics. I think you get the dtype selection right (we should write this down!). You can get timedelta64, but only if you have a units attribute that is just "units" not "units since origin". |
As somewhat hinted at above there seem to be several issues here. I tried to look into a solution for checking the first and last element (which seems work for Problem (1) in my original post) but the OverflowError persisted so I looked into this and now my code is a mess but I figured this second problem out. Pandas does not raise an overflow error when adding a
This screws up line 145 in https://github.com/pydata/xarray/blob/master/xarray/conventions.py. |
If I have a netCDF file that has invalid timesteps from the 'future', it is wrongly converted to datetime64[ns].
If I choose chalendar='noleap' the dates wrap around!
If my 'invalid' time is from the 'past' it works as expected:
The text was updated successfully, but these errors were encountered: