xarray.Dataset.interp_like#

Dataset.interp_like(other, method='linear', assume_sorted=False, kwargs=None, method_non_numeric='nearest')[source]#

Interpolate this object onto the coordinates of another object, filling the out of range values with NaN.

Parameters
  • other (Dataset or DataArray) – Object with an ‘indexes’ attribute giving a mapping from dimension names to an 1d array-like, which provides coordinates upon which to index the variables in this dataset. Missing values are skipped.

  • method (str, optional) – {“linear”, “nearest”} for multidimensional array, {“linear”, “nearest”, “zero”, “slinear”, “quadratic”, “cubic”} for 1-dimensional array. ‘linear’ is used by default.

  • assume_sorted (bool, optional) – If False, values of coordinates that are interpolated over can be in any order and they are sorted first. If True, interpolated coordinates are assumed to be an array of monotonically increasing values.

  • kwargs (dict, optional) – Additional keyword passed to scipy’s interpolator.

  • method_non_numeric ({"nearest", "pad", "ffill", "backfill", "bfill"}, optional) – Method for non-numeric types. Passed on to Dataset.reindex(). "nearest" is used by default.

Returns

interpolated (Dataset) – Another dataset by interpolating this dataset’s data along the coordinates of the other object.

Notes

scipy is required. If the dataset has object-type coordinates, reindex is used for these coordinates instead of the interpolation.