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 1672146474,I_kwDOAMm_X85jqu4q,7763,xr.concat error behaviour differs based on input DataArray ordering,5311739,open,0,,,1,2023-04-18T00:13:27Z,2023-04-24T16:04:37Z,,NONE,,,,"### What happened? When using `xr.concat` without specifying the coords argument and with input DataArrays of differing dimensions, where one is missing a dimension that is present in the others, the behaviour of the function will depend on the order and number of the arrays in the input list. The expected behaviour is that a ValueError prompting the use of coords='minimal' will be raised, however this error is not raised when either: * There are only two DataArrays in the provided list; or * The DataArray with the missing dimension is first in the list. In these instances, the `xr.concat` function acts as if coords='minimal' has been specified and broadcasts the smaller DataArray without erroring. ### What did you expect to happen? The raising of errors when using `xr.concat` should be consistent and not depend on the ordering or number of inputs. ### Minimal Complete Verifiable Example ```Python a = xr.DataArray([[1,2,3],[4,5,6]], coords=[('first', [10, 20]), ('second', ['a', 'b', 'c'])]) b = xr.DataArray([[10,20,30],[40,50,60]], coords=[('first', [30, 40]), ('second', ['a', 'b', 'c'])]) c = xr.DataArray([100, 200], coords=[('first', [10, 20])]) xr.concat([a, b, c], dim='first') # Errors as expected xr.concat([b, a, c], dim='first') # Errors as expected xr.concat([c, a, b], dim='first') # Does not error xr.concat([a, c], dim='first') # Does not error xr.concat([c, a], dim='first') # Does not error ``` ### MVCE confirmation - [X] Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray. - [X] Complete example — the example is self-contained, including all data and the text of any traceback. - [X] Verifiable example — the example copy & pastes into an IPython prompt or [Binder notebook](https://mybinder.org/v2/gh/pydata/xarray/main?urlpath=lab/tree/doc/examples/blank_template.ipynb), returning the result. - [X] New issue — a search of GitHub Issues suggests this is not a duplicate. ### Relevant log output _No response_ ### Anything else we need to know? _No response_ ### Environment
INSTALLED VERSIONS ------------------ commit: None python: 3.10.11 (main, Apr 5 2023, 14:15:10) [GCC 9.4.0] python-bits: 64 OS: Linux OS-release: 5.15.90.1-microsoft-standard-WSL2 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: C.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: None libnetcdf: None xarray: 2023.4.0 pandas: 2.0.0 numpy: 1.24.2 scipy: None netCDF4: None pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None iris: None bottleneck: None dask: None distributed: None matplotlib: None cartopy: None seaborn: None numbagg: None fsspec: None cupy: None pint: None sparse: None flox: None numpy_groupies: None setuptools: 65.3.0 pip: 22.2.2 conda: None pytest: None mypy: None IPython: 8.12.0 sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7763/reactions"", ""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue