home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1174585854

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
1174585854 I_kwDOAMm_X85GAsH- 6384 xr.concat adds an extra array around elements 14371165 closed 0     1 2022-03-20T15:25:49Z 2022-03-21T04:49:23Z 2022-03-21T04:49:23Z MEMBER      

What happened?

When concatenating dataarrays with pd.Interval along a dim the pd.Interval is wrapped with a numpy array and appended instead of without like it it was before #5692.

Minimal Complete Verifiable Example

```Python import numpy as np import xarray as xr

shape = (2, 3, 4) darray = xr.DataArray(np.linspace(0, 1, num=np.prod(shape)).reshape(shape)) bins = [-1, 0, 1, 2] a = darray.groupby_bins("dim_0", bins).mean(...) a_nan = np.nan * a.isel(**{"dim_0_bins": -1}) out = xr.concat([a, a_nan], dim="dim_0_bins") print(out["dim_0_bins"]) ```

Relevant log output

Current result: Python <xarray.DataArray 'dim_0_bins' (dim_0_bins: 4)> array([Interval(-1, 0, closed='right'), Interval(0, 1, closed='right'), Interval(1, 2, closed='right'), array(Interval(1, 2, closed='right'), dtype=object)], dtype=object) Coordinates: * dim_0_bins (dim_0_bins) object (-1, 0] (0, 1] (1, 2] (1, 2]

Should be: ```python <xarray.DataArray 'dim_0_bins' (dim_0_bins: 4)> array([Interval(-1, 0, closed='right'), Interval(0, 1, closed='right'), Interval(1, 2, closed='right'), Interval(1, 2, closed='right')], dtype=object) Coordinates: * dim_0_bins (dim_0_bins) object (-1, 0] (0, 1] (1, 2] (1, 2]

```

Anything else we need to know?

No response

Environment

xr.show_versions() INSTALLED VERSIONS ------------------ commit: None python: 3.9.6 | packaged by conda-forge | (default, Jul 11 2021, 03:37:25) [MSC v.1916 64 bit (AMD64)] python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 58 Stepping 9, GenuineIntel byteorder: little LC_ALL: None LANG: en LOCALE: ('Swedish_Sweden', '1252') libhdf5: 1.10.6 libnetcdf: 4.7.4 xarray: 0.16.3.dev99+gc19467fb pandas: 1.3.1 numpy: 1.21.5 scipy: 1.7.1 netCDF4: 1.5.6 pydap: installed h5netcdf: 0.11.0 h5py: 2.10.0 Nio: None zarr: 2.8.3 cftime: 1.5.0 nc_time_axis: 1.3.1 PseudoNetCDF: installed rasterio: 1.2.6 cfgrib: None iris: 3.0.4 bottleneck: 1.3.2 dask: 2021.10.0 distributed: 2021.10.0 matplotlib: 3.4.3 cartopy: 0.19.0.post1 seaborn: 0.11.1 numbagg: 0.2.1 fsspec: 2021.11.1 cupy: None pint: 0.17 sparse: 0.12.0 setuptools: 49.6.0.post20210108 pip: 21.2.4 conda: None pytest: 6.2.4 IPython: 7.31.0 sphinx: 4.3.2
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6384/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 3 rows from issues_id in issues_labels
  • 1 row from issue in issue_comments
Powered by Datasette · Queries took 0.655ms · About: xarray-datasette