home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 1170989744

This data as json

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
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

Links from other tables

  • 2 rows from issues_id in issues_labels
  • 0 rows from issue in issue_comments
Powered by Datasette · Queries took 0.687ms · About: xarray-datasette