Skip to content

Commit

Permalink
pydata#6367 Fix for time units checking could produce "unhashable typ…
Browse files Browse the repository at this point in the history
…e" error
  • Loading branch information
Oleh Khoma-ext committed Mar 16, 2022
1 parent 95bb9ae commit 1348e93
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion xarray/coding/times.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@ def encode(self, variable, name=None):
def decode(self, variable, name=None):
dims, data, attrs, encoding = unpack_for_decoding(variable)

if "units" in attrs and attrs["units"] in TIME_UNITS:
units = attrs.get("units")
if isinstance(units, str) and units in TIME_UNITS:
units = pop_to(attrs, encoding, "units")
transform = partial(decode_cf_timedelta, units=units)
dtype = np.dtype("timedelta64[ns]")
Expand Down

0 comments on commit 1348e93

Please sign in to comment.