Hey,
Currently, interpolating using indexes as dask arrays with da.interp is not possible.
import dask.array as da
import xarray as xr
import numpy as np
ds = xr.Dataset(
data_vars={
"a": ("x", [5, 7, 4]),
"b": (
("x", "y"),
[[1, 4, 2, 9], [2, 7, 6, np.nan], [6, np.nan, 5, 8]],
),
},
coords={"x": [0, 1, 2], "y": [10, 12, 14, 16]},
)
ds.interp(x=[0, 0.75, 1.25, 1.75]) # working
ds.interp(x=da.from_array(np.array([0, 0.75, 1.25, 1.75]))) # not working, raises TypeError
I understand this is a well known feature (Slow initilization of dataset.interp · Issue #4739 · pydata/xarray · GitHub).
However, are there any tricks to circumvent this? Have some of you experienced and solved this?
Calling compute on the indexes before interpolation can be penalizing if indexes are obtained following many computations and a large graph.
Thanks a lot,