home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 802058819

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/4663#issuecomment-802058819 https://api.github.com/repos/pydata/xarray/issues/4663 802058819 MDEyOklzc3VlQ29tbWVudDgwMjA1ODgxOQ== 2448579 2021-03-18T16:15:19Z 2021-03-18T16:15:19Z MEMBER

I would start by trying to fix

``` python import dask.array as da import numpy as np from xarray.tests import raise_if_dask_computes

with raise_if_dask_computes(max_computes=0): ds = xr.Dataset( dict( a=("x", da.from_array(np.random.randint(0, 100, 100))), b=(("x", "y"), da.random.random((100, 10))), ) ) ds.b.sel(x=ds.a.data) ```

specifically this np.asarray call ~/work/python/xarray/xarray/core/dataset.py in _validate_indexers(self, indexers, missing_dims) 1960 yield k, np.empty((0,), dtype="int64") 1961 else: -> 1962 v = np.asarray(v) 1963 1964 if v.dtype.kind in "US":

Then the next issue is the multiple computes that happen when we pass a DataArray instead of a dask.array (ds.b.sel(x=ds.a)) In general, I guess we can only support this for unindexed dimensions since we wouldn't know what index labels to use without computing the indexer array. This seems to be the case in that colab notebook.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  759709924
Powered by Datasette · Queries took 0.955ms · About: xarray-datasette