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-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