issues: 306047853
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
306047853 | MDU6SXNzdWUzMDYwNDc4NTM= | 1996 | Issue selecting time slices | 6980561 | closed | 0 | 1 | 2018-03-16T19:19:05Z | 2018-04-14T14:16:00Z | 2018-03-17T18:09:30Z | NONE | Selecting time slices of dataset using dataset's own dimensionThis might not be the correct place for this issue, but I was somewhat surprised to find that I couldn't use a dataset's own time dimension to index. The Working example```python import xarray as xr import pandas as pd import numpy as np ds = xr.Dataset({'example': (['time'], np.arange(0, 15))}, coords={'time': pd.date_range(pd.datetime(2011, 6, 1), pd.datetime(2011, 6, 15), freq='1D')}) This is not an errords.sel(time=slice(pd.datetime(2011, 6, 1), pd.datetime(2011, 6, 6))) This is an errords.sel(time=slice(0, 5)) ``` Problem descriptionI expected to be able to index a dataset using it's own time dimension or the time dimension of another dataset. I would expect the operation to work like: Expected Output```python import xarray as xr import pandas as pd import numpy as np ds = xr.Dataset({'example': (['x'], np.arange(0, 15))}, coords={'x': np.arange(0, 15)}) Neither of the below failsds.sel(x=slice(0, 15))
ds.sel(x=slice(ds.x[0], ds.x[-1]))
Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/1996/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |