-
-
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
Decode_cf fails when scale_factor is a length-1 list #4631
Labels
Comments
I guess we need |
But what did we do before? |
I think it just did xr.coding.variables._scale_offset_decoding(np.array([1, 2, 3.]), [5], None, np.float) xarray/xarray/coding/variables.py Line 217 in 49d03d2
|
Ok then I am 👍 on @dcherian's solution. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some datasets I work with have
scale_factor
andadd_offset
encoded as length-1 lists. The following code worked as of Xarray 0.16.1In 0.16.2 (just released) and current master, it fails with this error
I'm very confused, because this feels quite similar to #4471, and I thought it was resolved #4485.
However, the behavior is different with
'scale_factor': np.array([0.01])
. That works fine--no error.How might I end up with a dataset with
scale_factor
as a python list? It happens when I open a netcdf file using theh5netcdf
engine (documented by @gerritholl in #4471 (comment)) and then write it to zarr. The numpy array gets encoded as a list in the zarr json metadata. 🙃This problem would go away if we could resolve the discrepancies between the two engines' treatment of scalar attributes.
The text was updated successfully, but these errors were encountered: