You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To support years before 1679 and after 2262, dates are converted to cftime objects.
Turns out this isn't ideal, as cftime objects are not nearly as ubiquitous as the np.datetime64[ns] dtype. Currently, neither plotting nor resampling will work out of the box.
I suggest we do the same: I estimate that over 90% of use cases are within the mentioned bounds.
As far as I can tell, there are no good & consistent solutions (yet) for date ranges outside of those bounds: pandas seems pretty stuck to nanosecond resolution. cftime functionality will be expanded to support plotting, but will likely remain a "second-rate" citizen for quite some time. (Just to name an example: lack of real pandas support will mean that xarray's .to_dataframe() method probably be complicated.)
Defaulting to np.datetime64[ns] introduces the least complexity in the most cases: if you're dealing with long timespans, you're going to run into trouble somewhere else anyway.
Concretely, my idea is:
If within bounds, return np.datetime64
Else, return cftime, since it supports a good bit of xarray functionality (with 0.12 release)
In GitLab by @Huite on Mar 10, 2019, 15:21
To support years before 1679 and after 2262, dates are converted to
cftime
objects.Turns out this isn't ideal, as cftime objects are not nearly as ubiquitous as the
np.datetime64[ns]
dtype. Currently, neither plotting nor resampling will work out of the box.The xarray docs mention that for suitable dates, it defaults to
np.datetime64[ns]
, since this integrates nicely with e.g. pandas or matplotlib.http://xarray.pydata.org/en/stable/time-series.html#creating-datetime64-data
Mentioned there, the following issues address some problems:
I suggest we do the same: I estimate that over 90% of use cases are within the mentioned bounds.
As far as I can tell, there are no good & consistent solutions (yet) for date ranges outside of those bounds: pandas seems pretty stuck to nanosecond resolution.
cftime
functionality will be expanded to support plotting, but will likely remain a "second-rate" citizen for quite some time. (Just to name an example: lack of real pandas support will mean that xarray's.to_dataframe()
method probably be complicated.)Defaulting to
np.datetime64[ns]
introduces the least complexity in the most cases: if you're dealing with long timespans, you're going to run into trouble somewhere else anyway.Concretely, my idea is:
use_cftime
option toidf.load
, similar to: Add use_cftime option to open_dataset pydata/xarray#2759, so all DataArrays have consistent datetimes, when you're working with long timespans.The text was updated successfully, but these errors were encountered: