-
-
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
Time decoding has round-off error 0.10.0. Gone now. #1859
Comments
Interesting. This definitely wasn't an intended fix, though, so it would probably still be a good idea to add a test-case covering this behavior so we don't have a regression (there are plans to refactor the encoding/decoding module more in the future). Any interesting in putting together a PR with a test? |
I'll see if I can find the time in the next few days. |
I found out why the issue is absent in the current implementation. Please see #1863 (comment). That PR adds the test you asked for @shoyer. It passes in the current version and fails in |
Note: This problem occurs with version 0.10.0, but is gone when using current
master
(0.10.0+dev44.g0a0593d).Here is a complete example:
https://gist.github.com/j08lue/34498cf17b176d15933e778278ba2921
Problem description
I have this time variable from a netCDF file:
And when I open the file with
xr.open_dataset(..., decode_times=True)
the first time stamp becomes1982-12-31T23:59:59.560122368
, while it should be1983-01-01
. For reference,netCDF4.num2date
gets it right.I tracked the problem down to
xarray.conventions.decode_cf_datetime
. But then also noticed that you in 50b0a69 made major changes to the decoding.So I also tested with current
master
(0.10.0+dev44.g0a0593d) and the problem is gone.Up to you what you make of this. 😄 Maybe you can just close the issue.
Output of
xr.show_versions()
xarray: 0.10.0
pandas: 0.21.1
numpy: 1.13.3
scipy: 1.0.0
netCDF4: 1.3.1
h5netcdf: 0.5.0
Nio: None
bottleneck: 1.2.1
cyordereddict: 1.0.0
dask: 0.16.1
matplotlib: 2.1.1
cartopy: None
seaborn: None
setuptools: 38.2.4
pip: 9.0.1
conda: None
pytest: 3.3.1
IPython: 6.2.1
sphinx: None
In [4]:
The text was updated successfully, but these errors were encountered: