home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 566490806

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
566490806 MDU6SXNzdWU1NjY0OTA4MDY= 3774 Allow xr.combine_by_coords to work with point coordinates? 555667 closed 0     13 2020-02-17T19:53:51Z 2021-06-23T15:58:10Z 2021-06-23T15:58:10Z NONE      

MCVE Code Sample

```python

Your code here

data_0 = xr.Dataset({'temperature': ('time', [10,20,30])}, coords={'time': [0,1,2]}) data_0.coords['trial'] = 0

data_1 = xr.Dataset({'temperature': ('time', [50,60,70])}, coords={'time': [0,1,2]}) data_1.coords['trial'] = 1

the following fails with a ValueError:

all_trials = xr.combine_by_coords([data_0, data_1])

but this works:

all_trials = xr.combine_by_coords([data_0.expand_dims('trial'), data_1.expand_dims('trial')]) # works ```

Expected output

Both work and produce the same result.

Problem Description

I found this behavior somewhat unintuitive -- I didn't understand that I needed to call expand_dims to get combine_by_coords to work. It might make things a little easier to understand if both behaved the same way -- maybe the code that concatenates dimensions should look for full dimensions first, and point coordinates second.

This would also make code that selects dimensions with sel and then calls combine_by_coords more easy to write.

On the other hand, this could be seen as "magic", and it might also be a breaking change to combine_by_coords; I'm not sure. So I'd understand if isn't implemented.

Output of xr.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 3.7.6 (default, Jan  8 2020, 19:13:59) 
[GCC 7.3.0]
python-bits: 64
OS: Linux
OS-release: 4.14.0-115.10.1.el7a.ppc64le
machine: ppc64le
processor: ppc64le
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
libhdf5: 1.10.2
libnetcdf: None

xarray: 0.15.0
pandas: 0.25.3
numpy: 1.16.5
scipy: 1.3.0
netCDF4: None
pydap: None
h5netcdf: None
h5py: 2.8.0
Nio: None
zarr: None
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 2.10.0
distributed: 2.10.0
matplotlib: 3.1.1
cartopy: None
seaborn: None
numbagg: None
setuptools: 44.0.0.post20200106
pip: 19.3.1
conda: None
pytest: 5.3.2
IPython: 7.11.1
sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3774/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

  • 1 row from issues_id in issues_labels
  • 13 rows from issue in issue_comments
Powered by Datasette · Queries took 0.675ms · About: xarray-datasette