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/issues/3248#issuecomment-777037245,https://api.github.com/repos/pydata/xarray/issues/3248,777037245,MDEyOklzc3VlQ29tbWVudDc3NzAzNzI0NQ==,22328646,2021-02-10T21:08:06Z,2021-02-10T21:08:06Z,CONTRIBUTOR,"It looks like this issue has been neglected for a while. @TomNicholas, can you take a look at this PR?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484270833 https://github.com/pydata/xarray/issues/3248#issuecomment-741908629,https://api.github.com/repos/pydata/xarray/issues/3248,741908629,MDEyOklzc3VlQ29tbWVudDc0MTkwODYyOQ==,35968931,2020-12-09T17:03:24Z,2020-12-09T17:03:24Z,MEMBER,"@aijams while that isn't quite how I think about it, I think that is an accurate description of what `combine_by_coords` does :blush: > I'm assuming the main issue here is to have combine_by_coords put a set of unnamed DataArrays into a single group and paste them together. Yes - which involves making the assumption that these different unnamed DataArrays are actually the same physical variable, and so can be meaningfully combined into a group. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484270833 https://github.com/pydata/xarray/issues/3248#issuecomment-739060150,https://api.github.com/repos/pydata/xarray/issues/3248,739060150,MDEyOklzc3VlQ29tbWVudDczOTA2MDE1MA==,22328646,2020-12-04T22:36:45Z,2020-12-08T12:09:55Z,CONTRIBUTOR,"My comprehension of the `combine_by_coords` function is as follows: Given a set of DataArrays (possibly obtained by splitting apart data sets), group them by name and paste the arrays from each group onto an array of nans with the same dimension set as each member of that group. The result for each group will be a DataArray with an entry for each element of the Cartesian product of that group's coordinates. I'm assuming the main issue here is to have `combine_by_coords` put a set of unnamed DataArrays into a single group and paste them together. @TomNicholas, does this seem accurate to you? ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484270833 https://github.com/pydata/xarray/issues/3248#issuecomment-737591086,https://api.github.com/repos/pydata/xarray/issues/3248,737591086,MDEyOklzc3VlQ29tbWVudDczNzU5MTA4Ng==,35968931,2020-12-03T01:02:46Z,2020-12-03T01:02:46Z,MEMBER,"Hi @max-sixty good question, and it would be nice to fix this! I think that if we go with the [scheme suggested](https://github.com/pydata/xarray/issues/3248#issuecomment-526263925) by @dcherian for handling this issue then it answers the [question I posed in #3312](https://github.com/pydata/xarray/pull/3312#issuecomment-652363949) - the answer being that we care more about `combine_by_coords` happily accepting two unnamed DataArrays than we do about it being consistent with `merge` by throwing an error. If we're happy with that then I think it shouldn't be too difficult to finish off the PR in #3312? (I think that [this bug mentioned in #3312 is separate](https://github.com/pydata/xarray/pull/3312#issuecomment-568789721), and possibly deserves its own small issue.)","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484270833 https://github.com/pydata/xarray/issues/3248#issuecomment-736022156,https://api.github.com/repos/pydata/xarray/issues/3248,736022156,MDEyOklzc3VlQ29tbWVudDczNjAyMjE1Ng==,5635139,2020-11-30T20:24:46Z,2020-11-30T20:24:46Z,MEMBER,"Hi @aijams — this issue is still current! There are some notes from @TomNicholas on this PR: https://github.com/pydata/xarray/pull/3312. Though it looks like there may be an outstanding question on @shoyer there. @TomNicholas any thoughts on whether this is ready for a contribution?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484270833 https://github.com/pydata/xarray/issues/3248#issuecomment-735852114,https://api.github.com/repos/pydata/xarray/issues/3248,735852114,MDEyOklzc3VlQ29tbWVudDczNTg1MjExNA==,22328646,2020-11-30T15:22:24Z,2020-11-30T15:22:24Z,CONTRIBUTOR,"Hello, I'm new to open source development and xarray. I would like to help with this issue, however it appears that nothing has been done for over a year. Is this issue stale or does it still need to be addressed?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484270833 https://github.com/pydata/xarray/issues/3248#issuecomment-531825386,https://api.github.com/repos/pydata/xarray/issues/3248,531825386,MDEyOklzc3VlQ29tbWVudDUzMTgyNTM4Ng==,2448579,2019-09-16T15:19:50Z,2019-09-16T15:20:59Z,MEMBER,"Thanks @friedrichknuth . It looks like all the `combine` functions expect lists of Datasets, not DataArrays (see docstrings). It should be relatively easily to make this work like `merge` which can take a list of `Datasets or DataArrays`. See this code in `merge`: https://github.com/pydata/xarray/blob/756c94164840e8c070bcd26681b97c31412909ae/xarray/core/merge.py#L593-L602 `to_dataset` will fail for unnamed DataArrays, but `_to_temp_dataset()` will succeed. It seems to me like we want lists of unnamed DataArrays to work (like in the first example), so call `_to_temp_dataset` when needed. Maybe @shoyer has an idea on how to implement that cleanly. Can you send in a PR?","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484270833 https://github.com/pydata/xarray/issues/3248#issuecomment-531511177,https://api.github.com/repos/pydata/xarray/issues/3248,531511177,MDEyOklzc3VlQ29tbWVudDUzMTUxMTE3Nw==,10554254,2019-09-14T20:31:22Z,2019-09-14T20:31:22Z,NONE,"Some additional information on the topic: Combining named 1D data arrays works. ``` da1 = xr.DataArray(name='foo', data=np.random.randn(3), coords=[('x', [1, 2, 3])]) da2 = xr.DataArray(name='foo', data=np.random.randn(3), coords=[('x', [5, 6, 7])]) xr.combine_by_coords([da1, da2]) Dimensions: (x: 6) Coordinates: * x (x) int64 1 2 3 5 6 7 Data variables: foo (x) float64 1.443 0.4889 0.9233 0.1946 -1.639 -1.455 ``` However, when combining 2D gridded data... ``` da1 = xr.DataArray(name='foo', data=np.random.rand(3,3), coords=[('x', [1, 2, 3]), ('y', [1, 2, 3])]) da2 = xr.DataArray(name='foo', data=np.random.rand(3,3), coords=[('x', [5, 6, 7]), ('y', [5, 6, 7])]) xr.combine_by_coords([da1, da2]) ``` ...the method fails, despite passing a data variable name. ``` --------------------------------------------------------------------------- ValueError Traceback (most recent call last) in 9 ('y', [5, 6, 7])]) 10 ---> 11 xr.combine_by_coords([da1, da2]) ~/xarray/xarray/core/combine.py in combine_by_coords(datasets, compat, data_vars, coords, fill_value, join) 580 581 # Group by data vars --> 582 sorted_datasets = sorted(datasets, key=vars_as_keys) 583 grouped_by_vars = itertools.groupby(sorted_datasets, key=vars_as_keys) 584 ~/xarray/xarray/core/combine.py in vars_as_keys(ds) 465 466 def vars_as_keys(ds): --> 467 return tuple(sorted(ds)) 468 469 ~/xarray/xarray/core/common.py in __bool__(self) 119 120 def __bool__(self: Any) -> bool: --> 121 return bool(self.values) 122 123 def __float__(self: Any) -> float: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() ``` Again, converting to a dataset bypasses the issue. ``` ds1 = da1.to_dataset() ds2 = da2.to_dataset() xr.combine_by_coords([ds1, ds2]) Dimensions: (x: 6, y: 6) Coordinates: * x (x) int64 1 2 3 5 6 7 * y (y) int64 1 2 3 5 6 7 Data variables: foo (x, y) float64 0.5078 0.8981 0.8707 nan ... 0.4172 0.7259 0.8431 ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484270833 https://github.com/pydata/xarray/issues/3248#issuecomment-526263925,https://api.github.com/repos/pydata/xarray/issues/3248,526263925,MDEyOklzc3VlQ29tbWVudDUyNjI2MzkyNQ==,2448579,2019-08-29T16:31:41Z,2019-08-29T16:31:41Z,MEMBER,"What do you think of: 1. If `combine` receives a list of unnamed DataArrays, we convert them to temp datasets and then pass datasets down to merge. 2. If `combine` receives a list of named DataArrays, then merge will do the right thing. 3. If `combine` receives a list containing both Datasets and unnamed DataArrays then merge will raise the right error. So really it's just (1) that needs a special case in the combine functions?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484270833 https://github.com/pydata/xarray/issues/3248#issuecomment-526251545,https://api.github.com/repos/pydata/xarray/issues/3248,526251545,MDEyOklzc3VlQ29tbWVudDUyNjI1MTU0NQ==,35968931,2019-08-29T15:59:24Z,2019-08-29T15:59:24Z,MEMBER,"@dcherian is this a `merge` problem, or a `combine_by_coords` problem?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484270833 https://github.com/pydata/xarray/issues/3248#issuecomment-524517012,https://api.github.com/repos/pydata/xarray/issues/3248,524517012,MDEyOklzc3VlQ29tbWVudDUyNDUxNzAxMg==,1217238,2019-08-24T04:00:41Z,2019-08-24T04:00:41Z,MEMBER,+1 we should make this work!,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,484270833