issues: 849771808
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
849771808 | MDU6SXNzdWU4NDk3NzE4MDg= | 5107 | Converting `cftime.datetime` objects to `np.datetime64` values through `astype` | 6628425 | open | 0 | 0 | 2021-04-04T01:02:55Z | 2021-10-05T00:00:36Z | MEMBER | The discussion of the use of the Describe the solution you'd like It would be better if we could do this conversion with ``` In [1]: import xarray as xr In [2]: times = xr.cftime_range("2000", periods=6, calendar="noleap") In [3]: da = xr.DataArray(times.values.reshape((2, 3)), dims=["a", "b"]) In [4]: da.astype("datetime64[ns]") Out[4]: <xarray.DataArray (a: 2, b: 3)> array([['2000-01-01T00:00:00.000000000', '2000-01-02T00:00:00.000000000', '2000-01-03T00:00:00.000000000'], ['2000-01-04T00:00:00.000000000', '2000-01-05T00:00:00.000000000', '2000-01-06T00:00:00.000000000']], dtype='datetime64[ns]') Dimensions without coordinates: a, b ``` NumPy obviously does not officially support this -- nor would I expect it to -- so I would be wary of simply documenting this behavior as is. Would it be reasonable for us to modify |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/5107/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | issue |