-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
xr.open_dataset(f1).to_netcdf(file2) is not idempotent #2871
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
Comments
I think this could be fixed by making xarray/xarray/coding/variables.py Line 142 in 23d54a8
Right now, it only uses |
Indeed it works. Thanks. My quick fix:
I also figured out how to write back floating point values: |
Yes, this is a challenging design problem and the current state of affairs is definitely not ideal. If you have ideas about how to reveal the presence of an |
After rethinking the issue, I would drop it: one can simply pass
|
Just to correct something here, Near the bottom is a specific note about removing the deprecation. |
* More support for missing_value. Fixes #2871 * lint fixes. * Use not equivalent instead of not equals check. * lint fix. * if → elif so we don't call fillna twice * Better fix.
Here is the original (much truncated) file.
Python code:
File written to disk:
To confuse matter more, I am getting a warning:
This might make sense, since
tmpk
after decoding has datatypefloat32
, however somehow the original variable type andscale_factor
are preserved, butmissing_value
attribute disappears and value written back is wrong: 0.I want to write back
tmpk
as float number and let zlib worry about disk space.xr.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.7.1 | packaged by conda-forge | (default, Feb 18 2019, 01:42:00)
[GCC 7.3.0]
python-bits: 64
OS: Linux
OS-release: 3.10.0-957.5.1.el7.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
libhdf5: 1.10.4
libnetcdf: 4.6.2
xarray: 0.12.0
pandas: 0.24.2
numpy: 1.15.4
scipy: 1.2.1
netCDF4: 1.5.0
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.0.3.4
nc_time_axis: None
PseudonetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 1.1.4
distributed: 1.26.0
matplotlib: 3.0.3
cartopy: 0.17.0
seaborn: 0.9.0
setuptools: 40.8.0
pip: 19.0.3
conda: 4.6.10
pytest: 4.3.1
IPython: 7.4.0
sphinx: 1.8.5
The text was updated successfully, but these errors were encountered: