issues: 342793201
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
342793201 | MDExOlB1bGxSZXF1ZXN0MjAyNjA5OTEz | 2301 | WIP Add a CFTimeIndex-enabled xr.cftime_range function | 6628425 | closed | 0 | 9 | 2018-07-19T16:04:10Z | 2018-09-19T20:24:51Z | 2018-09-19T20:24:40Z | MEMBER | 0 | pydata/xarray/pulls/2301 |
I took the approach first discussed here by @shoyer and followed pandas by creating simplified offset classes for use with cftime objects to implement a Here are a few examples: ``` In [1]: import xarray as xr In [2]: xr.cftime_range('2000-02-01', '2002-05-05', freq='3M', calendar='noleap') Out[2]: CFTimeIndex([2000-02-28 00:00:00, 2000-05-31 00:00:00, 2000-08-31 00:00:00, 2000-11-30 00:00:00, 2001-02-28 00:00:00, 2001-05-31 00:00:00, 2001-08-31 00:00:00, 2001-11-30 00:00:00, 2002-02-28 00:00:00], dtype='object') In [3]: xr.cftime_range('2000-02-01', periods=4, freq='3A-JUN', calendar='noleap') Out[3]: CFTimeIndex([2000-06-30 00:00:00, 2003-06-30 00:00:00, 2006-06-30 00:00:00, 2009-06-30 00:00:00], dtype='object') In [4]: xr.cftime_range(end='2000-02-01', periods=4, freq='3A-JUN') Out[4]: CFTimeIndex([1990-06-30 00:00:00, 1993-06-30 00:00:00, 1996-06-30 00:00:00, 1999-06-30 00:00:00], dtype='object') ``` Hopefully the offset classes defined here would also be useful for implementing things like |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2301/reactions", "total_count": 1, "+1": 0, "-1": 0, "laugh": 0, "hooray": 1, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | pull |