issues: 607678694
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
607678694 | MDU6SXNzdWU2MDc2Nzg2OTQ= | 4010 | Issue indexing by xarray's own time values + offset | 2405019 | closed | 0 | 2 | 2020-04-27T16:20:34Z | 2020-04-28T11:03:06Z | 2020-04-28T08:20:16Z | CONTRIBUTOR | I'm struggling to work out how to index by a xarray time value + an offset (either created using MCVE Code Sample```python import xarray as xr import numpy as np import datetime as dt now = dt.datetime.now() dt_array = xr.DataArray( range(10), dims=('time', ), coords=dict(time=[now + dt.timedelta(seconds=i) for i in range(10)]) ) this worksdt_array.loc[dt_array.time.min():dt_array.time.max()].count() == 10 this fails, only the first value is returned (addingthe time delta appears to have no effect)dt_array.loc[dt_array.time.min():dt_array.time.min() + np.timedelta64(seconds=4)].count() == 4 this fails, an exception is raised when trying to adda datetime.timedelta to the xarray valuedt_array.loc[dt_array.time.min():dt_array.time.max() + dt.timedelta(seconds=4)].count() == 4 also fails, I got the impression from issue #1240that
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/4010/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |