home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 484270833

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
484270833 MDU6SXNzdWU0ODQyNzA4MzM= 3248 combine_by_coords fails with DataArrays 2448579 closed 0     11 2019-08-23T00:11:38Z 2021-07-02T21:34:36Z 2021-07-02T21:34:36Z MEMBER      

MCVE Code Sample

python da1 = xr.DataArray([1, 2, 3], dims='x', coords={'x': [0, 1, 2]}) da2 = xr.DataArray([3, 4, 5], dims='x', coords={'x': [2, 3, 4]}) xr.combine_by_coords([da1, da2])

```

ValueError Traceback (most recent call last) <ipython-input-133-d27216ba5688> in <module> 1 da1 = xr.DataArray([1, 2, 3], dims='x', coords={'x': [0, 1, 2]}) 2 da2 = xr.DataArray([3, 4, 5], dims='x', coords={'x': [2, 3, 4]}) ----> 3 xr.combine_by_coords([da1, da2])

~/work/python/xarray/xarray/core/combine.py in combine_by_coords(datasets, compat, data_vars, coords, fill_value, join) 619 compat=compat, 620 fill_value=fill_value, --> 621 join=join, 622 ) 623

~/work/python/xarray/xarray/core/merge.py in merge(objects, compat, join, fill_value) 588 ) 589 --> 590 obj = obj.to_dataset() if isinstance(obj, DataArray) else obj 591 dict_like_objects.append(obj) 592

~/work/python/xarray/xarray/core/dataarray.py in to_dataset(self, dim, name) 478 return self._to_dataset_split(dim) 479 else: --> 480 return self._to_dataset_whole(name) 481 482 @property

~/work/python/xarray/xarray/core/dataarray.py in _to_dataset_whole(self, name, shallow_copy) 426 if name is None: 427 raise ValueError( --> 428 "unable to convert unnamed DataArray to a " 429 "Dataset without providing an explicit name" 430 )

ValueError: unable to convert unnamed DataArray to a Dataset without providing an explicit name ```

To get what I want, I need xr.combine_by_coords([da1.to_dataset(name='a'), da2.to_dataset(name='a')]).a

I think the issue is that the code uses to_dataset instead of _to_temp_dataset

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3248/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 2 rows from issues_id in issues_labels
  • 11 rows from issue in issue_comments
Powered by Datasette · Queries took 0.634ms · About: xarray-datasette