-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Unexpected type conversion in variables with _FillValue #6055
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 might be unfixable. The problem is that xarray represents both xarray/xarray/coding/variables.py Lines 133 to 141 in a923833
Setting |
@dcherian Chiming in as the author of TileDB-Inc/TileDB-CF-Py#117. To help ensure the tiledb backend matches the behavior of
Note that Update Okay, I think I understand why. In |
For future searchers: @jp-dark just added a feature to the upcoming release of the tiledb backend introducing an argument |
Well aged issue here, adding some more details.
<class 'netCDF4._netCDF4.Variable'>
int16 var(index)
unlimited dimensions:
current shape = (4,)
filling on, default _FillValue of -32767 used
[5 6 7 --]
<class 'netCDF4._netCDF4.Variable'>
int16 var(index)
unlimited dimensions:
current shape = (4,)
filling off
[5 6 7 0]
<class 'netCDF4._netCDF4.Variable'>
int16 var(index)
_FillValue: 20
unlimited dimensions:
current shape = (4,)
filling on
[5 6 7 --] Only in case 3 xarray applies the CF-Masking as the Closing this issue, please comment on #2742. |
What happened:
When opening a dataset with an int16 variable with the
_FillValue
attribute, the variable is converted from type int16 to float32. This was originally reported to the TileDB-CF-Py Git repo that contains a TileDB backend for xarray. See TileDB-CF-Py issue #117.What you expected to happen:
I would expect the type to remain the same when applying the _FillValue.
Minimal Complete Verifiable Example:
Original example from TileDB-CF-Py issue #117 using the TileDB backend.
NetCDF example with the same behavior:
Anything else we need to know?:
conventions.decode_cf_variables
call in theopen_dataset
method ofStoreBackendEntrypoint
.mask_and_scale=False
._FillValue
attribute for variables from the TileDB backend.Environment:
I was able to reproduce this with both xarray 0.19.0 and 0.20.1
The text was updated successfully, but these errors were encountered: