Skip to content

Commit

Permalink
Fix logic bug - add_offset is in encoding, not attrs. (#6851)
Browse files Browse the repository at this point in the history
  • Loading branch information
mankoff authored Aug 1, 2022
1 parent 88ac949 commit 3c98ec7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion xarray/coding/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def decode(self, variable, name=None):
if "scale_factor" in attrs or "add_offset" in attrs:
scale_factor = pop_to(attrs, encoding, "scale_factor", name=name)
add_offset = pop_to(attrs, encoding, "add_offset", name=name)
dtype = _choose_float_dtype(data.dtype, "add_offset" in attrs)
dtype = _choose_float_dtype(data.dtype, "add_offset" in encoding)
if np.ndim(scale_factor) > 0:
scale_factor = np.asarray(scale_factor).item()
if np.ndim(add_offset) > 0:
Expand Down

0 comments on commit 3c98ec7

Please sign in to comment.