issues: 596249070
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
596249070 | MDU6SXNzdWU1OTYyNDkwNzA= | 3954 | Concatenate 3D array with 2D array | 30388627 | open | 0 | 5 | 2020-04-08T01:36:28Z | 2022-05-06T16:39:22Z | NONE | The 3D array has three dims: z, y and x.
The 2D array has two dims: y and x.
When I try to concatenate them by expanding the 2D array with z dim, there's something wrong in MCVE Code Sample```python import xarray as xr import numpy as np x = 2 y = 4 z = 3 data = np.arange(xyz).reshape(z, x, y) 3d array with coordsa = xr.DataArray(data, dims=['z', 'y', 'x'], coords={'z': np.arange(z)}) 2d array without coordsb = xr.DataArray(np.arange(xy).reshape(x, y)1.5, dims=['y', 'x']) expand 2d to 3db = b.expand_dims('z') concatcomb = xr.concat([a, b], dim='z') ``` Expected OutputSame as ``` <xarray.DataArray (z: 4, x: 2, y: 4)> array([[[ 0. , 1. , 2. , 3. ], [ 4. , 5. , 6. , 7. ]],
Dimensions without coordinates: z, x, y ``` Problem Description
As suggested by @dcherian, assigning the coordinate label by changing VersionsOutput of `xr.show_versions()`INSTALLED VERSIONS ------------------ commit: None python: 3.7.6 | packaged by conda-forge | (default, Jan 7 2020, 21:48:41) [MSC v.1916 64 bit (AMD64)] python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 158 Stepping 9, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: None.None libhdf5: None libnetcdf: None xarray: 0.15.1 pandas: 1.0.3 numpy: 1.18.1 scipy: 1.4.1 netCDF4: None pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.1.1.2 nc_time_axis: None PseudoNetCDF: None rasterio: 1.1.3 cfgrib: None iris: None bottleneck: None dask: 2.10.1 distributed: 2.14.0 matplotlib: 3.2.1 cartopy: 0.17.0 seaborn: 0.10.0 numbagg: None setuptools: 46.1.3.post20200325 pip: 20.0.2 conda: None pytest: None IPython: 7.13.0 sphinx: 2.4.4 |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3954/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | issue |