home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 292550002

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
292550002 MDU6SXNzdWUyOTI1NTAwMDI= 1864 BUG: ds['...'].sel(...).values throws exception for a ds loaded from file 7441788 closed 0     1 2018-01-29T20:31:52Z 2018-01-30T09:19:09Z 2018-01-30T09:19:09Z CONTRIBUTOR      

```python import xarray as xr ds = xr.Dataset(data_vars={'foo': xr.DataArray([1.], dims='abc', coords={'abc': ['a']})}) ds.to_netcdf(path='ds.nc', engine='h5netcdf') ds1 = xr.open_dataset('ds.nc', engine='h5netcdf')

ds1['foo'].values # uncomment to eliminate exception

ds1['foo'].sel(abc=['a']).values # throws "TypeError: PointSelection getitem only works with bool arrays" ```

Problem description

Accessing the DataArray's .sel() before .values leads to TypeError: PointSelection __getitem__ only works with bool arrays. Accessing the DataArray's .values before the .sel().values eliminates the error.

Expected Output

array([ 1.])

Output of xr.show_versions()

INSTALLED VERSIONS

commit: None python: 3.6.4.final.0 python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 62 Stepping 4, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: None.None

xarray: 0.10.0 pandas: 0.22.0 numpy: 1.13.3 scipy: 1.0.0 netCDF4: None h5netcdf: 0.5.0 Nio: None bottleneck: 1.2.1 cyordereddict: None dask: 0.16.1 matplotlib: 2.1.2 cartopy: None seaborn: 0.8.1 setuptools: 38.4.0 pip: 9.0.1 conda: 4.3.33 pytest: 3.3.2 IPython: 6.2.1 sphinx: 1.6.6

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1864/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
  • 1 row from issue in issue_comments
Powered by Datasette · Queries took 0.52ms · About: xarray-datasette