issues: 584865241
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
584865241 | MDU6SXNzdWU1ODQ4NjUyNDE= | 3872 | Operations resulting in np.timedelta64 are not properly coerced | 33886395 | closed | 0 | 2 | 2020-03-20T06:14:30Z | 2020-03-23T20:55:54Z | 2020-03-23T20:55:53Z | NONE | It seems that operations that are resulting in This follows the numpy documentation describing datetime arithmentic resulting in timedelta objects (http://lagrange.univ-lyon1.fr/docs/numpy/1.11.0/reference/arrays.datetime.html#datetime-and-timedelta-arithmetic) MCVE Code Sample```python this is a DataArray of type np.datetime64da = xr.DataArray( data= pd.date_range('2020-01-01', '2020-01-30', freq='D') ) this simple arithmetic will result in np.timedelta64delta = (da - np.datetime64('2020-01-01')) type(delta.data[0]) > numpy.timedelta64type(delta.dt) > xarray.core.accessor_dt.DatetimeAccessor``` Expected Output```python type(delta.dt) > xarray.core.accessor_dt.TimedeltaAccessor``` Problem DescriptionHaving a VersionsOutput of `xr.show_versions()`INSTALLED VERSIONS ------------------ commit: None python: 3.6.10 | packaged by conda-forge | (default, Mar 5 2020, 10:05:08) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 4.12.14-95.32-default machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.4 libnetcdf: 4.6.2 xarray: 0.14.1 pandas: 0.24.1 numpy: 1.18.1 scipy: 1.4.1 netCDF4: 1.5.1.2 pydap: None h5netcdf: 0.8.0 h5py: 2.9.0 Nio: None zarr: 2.2.0 cftime: 1.0.4.2 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: 1.3.2 dask: 2.12.0 distributed: 2.12.0 matplotlib: 3.0.3 cartopy: None seaborn: 0.10.0 numbagg: None setuptools: 45.2.0.post20200209 pip: 20.0.2 conda: None pytest: None IPython: 7.13.0 sphinx: None |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3872/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |