id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 1171069302,PR_kwDOAMm_X840iQxK,6368,"#6367 Fix for time units checking could produce ""unhashable type"" error",212077,closed,0,,,2,2022-03-16T14:02:56Z,2022-03-18T21:21:20Z,2022-03-18T21:18:52Z,CONTRIBUTOR,,0,pydata/xarray/pulls/6368," - [x] Closes #6367 ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/6368/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 1170989744,I_kwDOAMm_X85Fy-Kw,6367,unhashable type: 'numpy.ndarray' if 'units' attribute is numpy array in NetCDF file,212077,closed,0,,,0,2022-03-16T12:59:25Z,2022-03-18T21:18:51Z,2022-03-18T21:18:51Z,CONTRIBUTOR,,,,"### What happened? Calling `load_dataset()` for a file with variable with the 'units' attribute being numpy.ndarray as following: ```py {'paramId': array([3015], dtype=int64), 'typeOfLevel': 'heightAboveGround', 'gridType': 'regular_ll', 'bottomLevel': array([2], dtype=int64), 'cfVarName': 'tmax', 'missingValue': array([9999], dtype=int64), 'name': 'Maximum temperature', 'scaledValueOfFirstFixedSurface': array([2], dtype=int64), 'scaledValueOfSecondFixedSurface': array([0], dtype=int64), 'shortName': 'tmax', 'topLevel': array([2], dtype=int64), 'units': array(['˚C'], dtype=object), 'max': array(['47.22 ˚C'], dtype=object), 'min': array(['-59.20 ˚C'], dtype=object), 'comment': 'Daily max'} ``` Causes error ""unhashable type: 'numpy.ndarray'"" https://github.com/pydata/xarray/blob/95bb9ae4233c16639682a532c14b26a3ea2728f3/xarray/coding/times.py#L698, because attrs['units'] is a numpy.ndarray. ### What did you expect to happen? I guess another check could be added to ignore the attribute if its value is unhashable ### Minimal Complete Verifiable Example _No response_ ### Relevant log output _No response_ ### Anything else we need to know? _No response_ ### Environment xr.show_versions() INSTALLED VERSIONS ------------------ commit: None python: 3.7.3 | packaged by conda-forge | (default, Jul 1 2019, 22:01:29) [MSC v.1900 64 bit (AMD64)] python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 85 Stepping 4, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: (None, None) libhdf5: 1.10.6 libnetcdf: 4.7.4 xarray: 0.19.0 pandas: 1.3.2 numpy: 1.21.5 scipy: 1.6.0 netCDF4: 1.5.6 pydap: None h5netcdf: 0.11.0 h5py: 3.2.1 Nio: None zarr: None cftime: 1.5.2 nc_time_axis: None PseudoNetCDF: None rasterio: 1.1.7 cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: 3.5.1 cartopy: 0.18.0 seaborn: None numbagg: None pint: None setuptools: 59.8.0 pip: 21.0.1 conda: None pytest: 6.2.5 IPython: None sphinx: 4.1.0 ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/6367/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue