Skip to content

Interpolating with a common chunked dim fails #4058

Closed
@aulemahal

Description

@aulemahal

Interpolating a dataarray with another one fails if one of them is a dask array and they share a chunked dimension. Even if the interpolation is independent of that dimension.

MCVE Code Sample

import xarray as xr
import numpy as np

g = xr.DataArray(np.zeros((10, 10)), dims=('x', 'c'), coords={k: np.arange(10) for k in ['x', 'c']})
b = xr.DataArray([5, 6.6, 8.8], dims=('new',)).expand_dims(c=g.c)
gc = g.chunk({'c': 1})
gc.interp(x=b)

Expected Output

An array with coords "new" and "c", with values of g interpolated along x at positions in b, for each c. As there is no interpolation along c, I would expect the fact that it is chunked to be irrelevant.

Problem Description

Raises: NotImplementedError: Chunking along the dimension to be interpolated (1) is not yet supported.;

I didn't see any issue about this, so I thought it ought to be noted as a needed enhancement.

Versions

Output of xr.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.8.2 | packaged by conda-forge | (default, Apr 16 2020, 18:04:51)
[GCC 7.3.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.6
libnetcdf: 4.7.4

xarray: 0.15.2.dev42+g0cd14a5
pandas: 1.0.3
numpy: 1.18.1
scipy: 1.4.1
netCDF4: 1.5.3
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.1.1.2
nc_time_axis: None
PseudoNetCDF: None
rasterio: 1.1.3
cfgrib: None
iris: None
bottleneck: 1.3.2
dask: 2.14.0
distributed: 2.14.0
matplotlib: 3.2.1
cartopy: 0.17.0
seaborn: None
numbagg: None
pint: 0.11
setuptools: 46.1.3.post20200325
pip: 20.0.2
conda: None
pytest: 5.4.1
IPython: 7.13.0
sphinx: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions