-
Notifications
You must be signed in to change notification settings - Fork 5
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
Negative date handling #127
Comments
In the example, you save the dates as strings and have some of them be negative. I don't think that case is handled, I don't think any Python libraries handle negative dates in the way you want e.g.
If you get rid of the negative dates, it saves without an issue. Do you know of a library which can handle negative dates properly? |
Hi, ah, thanks for the investigation! There are several python libraries which are just fine with negative dates, for example, numpy does it: In [1]: import numpy as np
In [2]: np.datetime64('-0001-01-01', 's')
Out[2]: numpy.datetime64('-001-01-01T00:00:00') Also, xarray can use the Cheers, |
Ok so the problem is here Line 48 in e21bda1
|
Perhaps we use |
xclim has a
https://xclim.readthedocs.io/en/stable/api.html#calendar-handling-utilities |
Great find. We don't want all the extra deps which come with |
When I try to save a dataset with a cftime axis to CSV, it fails with
ValueError: Ambiguous time values with time_axis = 'None'
It would be great if cftime would also just work with CSV, considering that the CSV format allows dates outside the range of pandas standard
np.datetime64[ns]
.I can reproduce the problem using a dataset from CMIP, I have attached a notebook which reproduces the error (in a zip to appease github). Using something with dates going back only to 1850, this works nicely.
Maybe I am also doing cftime axes wrong.
reproduce_scmdata_cftime_csv_bug.zip
The text was updated successfully, but these errors were encountered: