-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Cannot Save NetCDF: Conflicting _FillValue and Missing_Value #7191
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
@WillyChap Could you inspect the contents of Disclaimer: This is from the top of my head, so mistakes are likely. |
I'm also not sure why |
@kmuehlbauer it looks like encoding is empty. print(DS_cera0.encoding)
# {} |
And on the variable? Please also have a look at the docs on to_netcdf regarding encoding-kwarg. |
@dopplershift equivalence is checked here, there is also the error origination from. xarray/xarray/coding/variables.py Lines 153 to 163 in 3c98ec7
|
@kmuehlbauer However, these variables were set to contrasting values after an xarray subset or save. See workflow below. It appears that to_netcdf will assign fn_E20c_VP=sorted(glob.glob('/Users/wchapman/Downloads/uvwndNOAA/uwnd*.nc'))
DSorig = xr.open_dataset(fn_E20c_VP[0])
DSorig.uwnd.encoding
Subset and Save: fn_E20c_VP=sorted(glob.glob('/Users/wchapman/Downloads/uvwndNOAA/uwnd*.nc'))
DS_subset = DSorig.sel(level=300)
DS_subset.to_netcdf('/Users/wchapman/Downloads/test_behavior.nc')
DS_subset.uwnd.encoding
Re-open newly saved file and inspect : DS_subset_aftersave = xr.open_dataset('/Users/wchapman/Downloads/test_behavior.nc')
DS_subset_aftersave.uwnd.encoding
|
Xarray has only one way to represent both concepts:
This seems like a bug. Can you open a new issue with a minimum reproducible example that uses random data please? |
Closing in favor of the more current #7722. |
What is your issue?
This seems to be an issue only with netcdf files that I have first opened altered and then saved with xarray. Also, this could be related to: #997 but seems to have different bug characteristics. However, I am unable to save to netcdf due to apparent conflicts in the masking attribute variables, which don't exist in the file.
xarray package version:
I am unable to save to netcdf due to error:
Though variable uwnd has neither attrs "_FillValue" or "missing_value".
Manually setting those variables does not remove the error.
h5netcdf engine shows the same behavior.
The text was updated successfully, but these errors were encountered: