issues: 281897468
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
281897468 | MDU6SXNzdWUyODE4OTc0Njg= | 1778 | ValueError on empty selection with dask based DataArrays | 3169620 | closed | 0 | 3801867 | 2 | 2017-12-13T21:09:42Z | 2019-07-12T13:41:08Z | 2019-07-12T13:41:08Z | CONTRIBUTOR | Code Sample, a copy-pastable example if possible```python import xarray as xr import numpy as np da = xr.DataArray(np.random.rand(15), dims=['latitude'], coords={'latitude':np.linspace(90, -90, 15)}) This gives an empty latitude sliceprint(da.sel(latitude=slice(20, 60))) After converting the DataArray to dask...da=da.chunk() ...this throws a ValueError due to 'conflicting sizes'print(da.sel(latitude=slice(20, 60))) ``` Problem descriptionI would expect the dask based DataArray to return an empty slice just as the numpy one does. Although arguably it would be nicer if both returned the latitude values between 20 and 60 - regardless of the direction of the coordinate. Perhaps the sel method could check whether the coordinate is increasing or decreasing? Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/1778/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |