-
-
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
"Timestamp subtraction must have the same timezones or no timezones" when saving a NetCDF #2649
Comments
@matteodefelice thanks for the clear report. This is definitely a regression. See #2651 for a possible fix. |
Thanks, I have applied the fix and now it works. |
For reference, the issue here appears to be that the time variable's
And here is the relevant description from CF conventions:
Given that xarray uses timezone agnostic |
I tried to follow the discussion above but I still have no clue how to fix this issue. Could you give an example? |
This was an internal bug in xarray introduced in version 0.11.2, which through #2651 should be fixed in the next release. Probably the cleanest way to work around it for now would be to temporarily downgrade to xarray 0.11.0. If there is something in xarray > 0.11.0 that you need, another option would be to install the master (unreleased) version of xarray, which includes the bug fix in #2651. Finally, a cruder workaround (if you want to stick with xarray 0.11.2) in the case that time is encoded with the UTC time zone (and not some other time zone) would be to drop the time zone from the units encoding, e.g. with the example file shared above:
|
I have an issue when saving a Dataset to NetCDF. This is the example NetCDF I am using.
Then I get:
I have tried with Python 3.7 and 3.6. I have also installed the latest version of xarray hoping that this issue was linked with #2630. Apparently, with other similar NetCDFs I don't get the error but however this is not supposed to happen, given that the same exact code was working a couple of months ago.
xarray: 0.11.1+9.g06244df
pandas: 0.23.4
numpy: 1.15.4
scipy: 1.1.0
netCDF4: 1.4.2
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.0.3.4
PseudonetCDF: None
rasterio: None
cfgrib: 0.9.5.1
iris: None
bottleneck: None
cyordereddict: None
dask: None
distributed: None
matplotlib: 3.0.2
cartopy: 0.17.0
seaborn: None
setuptools: 40.6.3
pip: 18.1
conda: None
pytest: None
IPython: 7.2.0
sphinx: None
The text was updated successfully, but these errors were encountered: