-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
handle default fill value #2742
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
Xarray's handling of missing values should be consistent with netCDF4-Python. In theory, both follow CF conventions. I wonder if this is due to numeric overflow of some sort? It would definitely definitely be helpful to have a file which reproduces this behavior so we can debug what's going on. Also, please share the output of |
Thanks for the response. The file is now available here: http://www.marine.csiro.au/cgi-bin/marlin-dl/Investigator_NF/in2018_v06/data/in2018_v06_ADCP_nc.zip I used the one titled 'in2018_v06_os150nb.nc' in my examples but both files display the same behaviour. The output from xarray.show_versions() is below: INSTALLED VERSIONScommit: None xarray: 0.11.3 |
xarray it's assuming that The |
If a variable does not define a _FillValue value the 'default fill value' is normally used where data is masked. The default netCDF4 library does this by default and can be controlled with the set_auto_mask() function.
For example loading a NetCDF with no explicit fill value set:
The resulting array is a masked array where missing values are masked. You can see the default fill value has been given in the variable output.
When loading the same NetCDF with xarray that fill value gets used where the values would be masked by NetCDF4.
While this behaviour is correct in the sense that xarray has followed the NetCDF specification it's now no longer clear that those values were missing in the original NetCDF.
The attributes don't mention the fill value so even though this is outside the specified data range one could be forgiven for thinking that's the actual value in the DataArray. It's especially confusing when you've asked to have CF decoded and these values are still present.
Further more if you look at the encoding for this DataArray you can see that it incorrectly states that the _FillVaule is the missing_value:
Unless I'm missing something I think this behaviour should be changed to either:
or
Note that the NetCDF file I've used here isn't publicly available yet but I can add a link to it soon once it is.
The text was updated successfully, but these errors were encountered: