home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 301795163

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
301795163 MDU6SXNzdWUzMDE3OTUxNjM= 1952 xarray.merge exception : invalid type promotion 1997005 closed 0     4 2018-03-02T15:02:43Z 2018-08-20T16:31:16Z 2018-08-20T16:31:16Z CONTRIBUTOR      

Code Sample

```python import xarray import pandas import numpy

array1 = xarray.DataArray( [numpy.timedelta64('NaT')], dims=['time'], coords={'time': pandas.to_datetime(['2018-01-01'])}, name='foo' )

array2 = xarray.DataArray( [numpy.timedelta64(30, 's')], dims=['time'], coords={'time': pandas.to_datetime(['2018-01-02'])}, name='foo' )

xarray.merge([array1, array2]) ```

Problem description

Merging arrays with identical dtypes should work ...

There's some issue with the NaT being interpreted as float64, so that xarray.core.dtypes.result_type thinks that those 2 arrays are not compatible..

It works with xarray==0.10.0 and fails at xarray==0.10.1. I've pin-pointed the issue to commit 2aa5b8a5c0945935.

Work-around in the mean time : python xarray.merge([array1.astype(float), array2.astype(float)]).astype('timedelta64')

Expected Output

```python

expected :

xarray.DataArray( [numpy.timedelta64('NaT'), numpy.timedelta64(30, 's')], dims=['time'], coords={'time': pandas.to_datetime(['2018-01-01', '2018-01-02'])}, name='foo' ) ```

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.6.2.final.0 python-bits: 64 OS: Linux OS-release: 3.13.0-142-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: fr_FR.UTF-8 LOCALE: fr_FR.UTF-8 xarray: 0.10.0+dev60.g2aa5b8a pandas: 0.22.0 numpy: 1.14.0 scipy: None netCDF4: 1.3.1 h5netcdf: None h5py: None Nio: None zarr: None bottleneck: None cyordereddict: None dask: None distributed: None matplotlib: 2.1.1 cartopy: None seaborn: None setuptools: 38.4.0 pip: 9.0.1 conda: None pytest: 3.3.2 IPython: 6.2.1 sphinx: None

Thanks !

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1952/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 4 rows from issue in issue_comments
Powered by Datasette · Queries took 80.72ms · About: xarray-datasette