issues: 677773328
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
677773328 | MDU6SXNzdWU2Nzc3NzMzMjg= | 4338 | Combining tiled data sets in xarray | 56926399 | closed | 0 | 4 | 2020-08-12T15:12:39Z | 2020-08-13T12:04:11Z | 2020-08-12T22:50:33Z | NONE | I'm working on a project where I need to combine different sets of geographic image tiles into one large tile in Xarray. I am running into an issue. I've made a simplified example bellow. ```python square1 = xr.DataArray(name="box1", data=np.random.randint(5, size=(3, 2)), coords=[("x", [0,1,2]),('y',[0,1])]) square2 = xr.DataArray(name="box2", data=np.random.randint(5, size=(3, 2)), coords=[("x", [2,3,4]),('y',[0,1])]) square3 = xr.DataArray(name="box3", data=np.random.randint(5, size=(3, 2)), coords=[("x", [0,1,2]),('y',[2,3])]) square4 = xr.DataArray(name="box4", data=np.random.randint(5, size=(3, 2)), coords=[("x", [2,3,4]),('y',[2,3])]) combineddata = xr.combine_by_coords([square1,square2,square3,square4]) ``` I thought this is all you need to do it but I get this error ```pythonValueError Traceback (most recent call last) <ipython-input-57-fc5add80d55a> in <module> ----> 1 xr.combine_by_coords([square1,square2,square3,square4]) ~/my-conda-envs/dem/lib/python3.8/site-packages/xarray/core/combine.py in combine_by_coords(datasets, compat, data_vars, coords, fill_value, join, combine_attrs) 713 714 # Group by data vars --> 715 sorted_datasets = sorted(datasets, key=vars_as_keys) 716 grouped_by_vars = itertools.groupby(sorted_datasets, key=vars_as_keys) 717 ~/my-conda-envs/dem/lib/python3.8/site-packages/xarray/core/combine.py in vars_as_keys(ds) 502 503 def vars_as_keys(ds): --> 504 return tuple(sorted(ds)) 505 506 ~/my-conda-envs/dem/lib/python3.8/site-packages/xarray/core/common.py in bool(self) 118 119 def bool(self: Any) -> bool: --> 120 return bool(self.values) 121 122 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() ``` I am not really sure why this is not working. |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/4338/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |