html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/pull/2777#issuecomment-467993188,https://api.github.com/repos/pydata/xarray/issues/2777,467993188,MDEyOklzc3VlQ29tbWVudDQ2Nzk5MzE4OA==,35968931,2019-02-27T19:16:11Z,2019-02-28T10:05:39Z,MEMBER,I've just submitted a PR which solves this issue in the way I just suggested instead #2792. ,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,411755105 https://github.com/pydata/xarray/pull/2777#issuecomment-468088653,https://api.github.com/repos/pydata/xarray/issues/2777,468088653,MDEyOklzc3VlQ29tbWVudDQ2ODA4ODY1Mw==,35968931,2019-02-28T00:38:11Z,2019-02-28T00:38:11Z,MEMBER,"@Zac-HD there's actually another way to get the indexing behaviour you wanted with the current API: ```python colors = ""blue green red"".split() das = [xr.DataArray(np.random.random((2, 2)), dims=""x y"".split(), coords={""band"": k}) for k in colors] xr.concat(das, dim=""band"").plot.imshow(col=""band"") ``` Here instead of using the name attribute to label each band I've used a scalar coordinate called `""band""`, so that when you concat along `""band""` it will just stack along that coordinate. This never touches the names so actually gives the desired output without the need for #2792: ![figure_2](https://user-images.githubusercontent.com/35968931/53533021-11b33f80-3af1-11e9-9009-1d3b5e17a881.png) ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,411755105 https://github.com/pydata/xarray/pull/2777#issuecomment-467945628,https://api.github.com/repos/pydata/xarray/issues/2777,467945628,MDEyOklzc3VlQ29tbWVudDQ2Nzk0NTYyOA==,35968931,2019-02-27T17:04:39Z,2019-02-27T17:16:53Z,MEMBER,"@Zac-HD forgive me for this but I think this PR is unnecessary because what you need basically already exists in the API. Going back to your original example, you could have got the same indexing by creating a DataArray to use as a coordinate to concatenate over: ```python colors = ""blue green red"".split() ds = xr.Dataset({ k: xr.DataArray(np.random.random((2, 2)), dims=""x y"".split(), name=k) for k in colors }) band = xr.DataArray(colors, name=""band"", dims=[""band""]) xr.concat([ds.blue, ds.green, ds.red], dim=band).plot.imshow(col=""band"") ``` ![figure_1](https://user-images.githubusercontent.com/35968931/53503197-86fa2280-3aa7-11e9-9d6b-e89f0d1b97a8.png) This still leaves the wrong label on the colorbar, but that could be fixed separately and has to do with concat using the attrs of the first dataset in the list for the final dataset (a similar problem to #2382). I think it would be easier to change that behaviour instead (perhaps to `if all names the same, use that name, else name of result = None`, but this also relates to #1614). Creating a new coordinate using a DataArray is in the docstring for `xr.concat`: > If dimension is provided as a DataArray or Index, its name is used as the dimension to concatenate along and the values are added as a coordinate. but I think there should be an example there too. (Also I think this is relevant to #1646) > I'm not entirely sure this is a deal-breaker but it makes me a little nervous @shoyer I agree, although I like the idea then I think this could introduce all sorts of complex concatentation edge cases. At the very least the new API should have symmetry properties something like: ```python da1 = DataArray(name='a', data=[[0]], dims=['x', 'y']) da2 = DataArray(name='b', data=[[1]], dims=['x', 'y']) da3 = DataArray(name='a', data=[[2]], dims=['x', 'y']) da4 = DataArray(name='b', data=[[3]], dims=['x', 'y']) xr.manual_combine([[da1, da2], [da3, da4]], concat_dim=['x', 'y']) # should give the same result as xr.manual_combine([[da1, da3], [da2, da4]], concat_dim=['y', 'x']) ``` but with this PR I don't think it would. In the first case the x coord would be created with values `['a', 'b']`, and no y coord would be created, while in the second case no y coord would be created, and the intermediate DataSet would be nameless, so then no x coord would be created either. I think my suggestion for naming would pass this test because the result would be nameless and have no coords either way. I might have got that wrong but I definitely think this kind of change should be carefully considered :confused: (EDIT: I just added this example as a test to #2616) ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,411755105