-
-
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
Implement shift for CFTimeIndex #2244
Comments
Submitted issue brought up in this thread |
@aidanheerdegen thanks, I agree an implementation of
Note, however, that currently the index type is not preserved under this sort of arithmetic (which we might consider a separate issue). This can be alleviated by casting the result as a
|
Great! Thanks @spencerkclark I agree this is an excellent work around. One of the most frustrating aspect of using an otherwise brilliant tool like I am often in the position of recommending software solutions to scientists who need to analyse their data, and the date issue with |
Code Sample
Problem description
I am trying to shift a time index as I need to align datasets to a common start point.
Directly incrementing one of the
CFTimeIndex
values works:Trying to use
shift
does not:If I want to shift a time index is the only way currently is to loop over all the individual elements of the index and add a time offset to each.
Expected Output
I would expect to have CFTimeIndex shifted by the desired time delta.
Output of
xr.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Linux
OS-release: 3.10.0-693.17.1.el6.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: C
LOCALE: None.None
xarray: 0.10.7
pandas: 0.23.1
numpy: 1.14.5
scipy: 1.1.0
netCDF4: 1.3.1
h5netcdf: 0.5.1
h5py: 2.8.0
Nio: None
zarr: 2.2.0
bottleneck: 1.2.1
cyordereddict: None
dask: 0.17.5
distributed: 1.21.8
matplotlib: 1.5.3
cartopy: 0.16.0
seaborn: 0.8.1
setuptools: 39.2.0
pip: 9.0.3
conda: None
pytest: 3.6.1
IPython: 6.4.0
sphinx: None
The text was updated successfully, but these errors were encountered: