issues: 709272776
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
709272776 | MDU6SXNzdWU3MDkyNzI3NzY= | 4463 | Interpolation with multiple mutlidimensional arrays sharing dims fails | 20629530 | open | 0 | 5 | 2020-09-25T20:45:54Z | 2020-09-28T19:10:56Z | CONTRIBUTOR | What happened:
When trying to interpolate a N-D array with 2 other arrays sharing a common (new) dimension and with one (at least) being multidimensional fails. Kinda a complex edge case I agree. Here's a MWE:
What you expected to happen:
I expected (with the dummy data I gave):
But instead it fails with Full traceback:
```python3
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-19-b968c6f3dae9> in <module>
----> 1 a.interp(y=y, x=x, method='linear')
~/Python/xarray/xarray/core/dataarray.py in interp(self, coords, method, assume_sorted, kwargs, **coords_kwargs)
1473 "Given {}.".format(self.dtype)
1474 )
-> 1475 ds = self._to_temp_dataset().interp(
1476 coords,
1477 method=method,
~/Python/xarray/xarray/core/dataset.py in interp(self, coords, method, assume_sorted, kwargs, **coords_kwargs)
2691 if k in var.dims
2692 }
-> 2693 variables[name] = missing.interp(var, var_indexers, method, **kwargs)
2694 elif all(d not in indexers for d in var.dims):
2695 # keep unrelated object array
~/Python/xarray/xarray/core/missing.py in interp(var, indexes_coords, method, **kwargs)
652 else:
653 out_dims.add(d)
--> 654 result = result.transpose(*tuple(out_dims))
655 return result
656
~/Python/xarray/xarray/core/variable.py in transpose(self, *dims)
1395 return self.copy(deep=False)
1396
-> 1397 data = as_indexable(self._data).transpose(axes)
1398 return type(self)(dims, data, self._attrs, self._encoding, fastpath=True)
1399
~/Python/xarray/xarray/core/indexing.py in transpose(self, order)
1288
1289 def transpose(self, order):
-> 1290 return self.array.transpose(order)
1291
1292 def __getitem__(self, key):
ValueError: axes don't match array
```
Anything else we need to know?:
It works if Environment: Output of <tt>xr.show_versions()</tt>INSTALLED VERSIONS ------------------ commit: None python: 3.8.5 | packaged by conda-forge | (default, Jul 31 2020, 02:39:48) [GCC 7.5.0] python-bits: 64 OS: Linux OS-release: 3.10.0-514.2.2.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_CA.UTF-8 LOCALE: en_CA.UTF-8 libhdf5: 1.10.5 libnetcdf: 4.7.4 xarray: 0.16.2.dev9+gc0399d3 pandas: 1.0.3 numpy: 1.18.4 scipy: 1.4.1 netCDF4: 1.5.3 pydap: None h5netcdf: None h5py: 2.10.0 Nio: None zarr: None cftime: 1.1.3 nc_time_axis: 1.2.0 PseudoNetCDF: None rasterio: 1.1.4 cfgrib: None iris: None bottleneck: 1.3.2 dask: 2.17.2 distributed: 2.23.0 matplotlib: 3.3.1 cartopy: 0.18.0 seaborn: None numbagg: None pint: 0.11 setuptools: 49.6.0.post20200814 pip: 20.2.2 conda: None pytest: None IPython: 7.17.0 sphinx: None |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/4463/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | issue |