Interpolate this object onto the coordinates of another object. Performs univariate or multivariate interpolation of a Dataset onto new coordinates, utilizing either NumPy or SciPy interpolation routines. Out-of-range values are filled with NaN, unless specified otherwise v
(
self,
other: T_Xarray,
method: InterpOptions = "linear",
assume_sorted: bool = False,
kwargs: Mapping[str, Any] | None = None,
method_non_numeric: str = "nearest",
)
| 4040 | return self._replace_with_new_dims(variables, coord_names, indexes=indexes) |
| 4041 | |
| 4042 | def interp_like( |
| 4043 | self, |
| 4044 | other: T_Xarray, |
| 4045 | method: InterpOptions = "linear", |
| 4046 | assume_sorted: bool = False, |
| 4047 | kwargs: Mapping[str, Any] | None = None, |
| 4048 | method_non_numeric: str = "nearest", |
| 4049 | ) -> Self: |
| 4050 | """Interpolate this object onto the coordinates of another object. |
| 4051 | |
| 4052 | Performs univariate or multivariate interpolation of a Dataset onto new coordinates, |
| 4053 | utilizing either NumPy or SciPy interpolation routines. |
| 4054 | |
| 4055 | Out-of-range values are filled with NaN, unless specified otherwise via `kwargs` to the numpy/scipy interpolant. |
| 4056 | |
| 4057 | Parameters |
| 4058 | ---------- |
| 4059 | other : Dataset or DataArray |
| 4060 | Object with an 'indexes' attribute giving a mapping from dimension |
| 4061 | names to an 1d array-like, which provides coordinates upon |
| 4062 | which to index the variables in this dataset. Missing values are skipped. |
| 4063 | method : { "linear", "nearest", "zero", "slinear", "quadratic", "cubic", \ |
| 4064 | "quintic", "polynomial", "pchip", "barycentric", "krogh", "akima", "makima" } |
| 4065 | Interpolation method to use (see descriptions above). |
| 4066 | assume_sorted : bool, default: False |
| 4067 | If False, values of coordinates that are interpolated over can be |
| 4068 | in any order and they are sorted first. If True, interpolated |
| 4069 | coordinates are assumed to be an array of monotonically increasing |
| 4070 | values. |
| 4071 | kwargs : dict, optional |
| 4072 | Additional keyword arguments passed to the interpolator. Valid |
| 4073 | options and their behavior depend which interpolant is use |
| 4074 | method_non_numeric : {"nearest", "pad", "ffill", "backfill", "bfill"}, optional |
| 4075 | Method for non-numeric types. Passed on to :py:meth:`Dataset.reindex`. |
| 4076 | ``"nearest"`` is used by default. |
| 4077 | |
| 4078 | Returns |
| 4079 | ------- |
| 4080 | interpolated : Dataset |
| 4081 | Another dataset by interpolating this dataset's data along the |
| 4082 | coordinates of the other object. |
| 4083 | |
| 4084 | Notes |
| 4085 | ----- |
| 4086 | - scipy is required. |
| 4087 | - If the dataset has object-type coordinates, reindex is used for these |
| 4088 | coordinates instead of the interpolation. |
| 4089 | - When interpolating along multiple dimensions with methods `linear` and `nearest`, |
| 4090 | the process attempts to decompose the interpolation into independent interpolations |
| 4091 | along one dimension at a time. |
| 4092 | - The specific interpolation method and dimensionality determine which |
| 4093 | interpolant is used: |
| 4094 | |
| 4095 | 1. **Interpolation along one dimension of 1D data (`method='linear'`)** |
| 4096 | - Uses :py:func:`numpy.interp`, unless `fill_value='extrapolate'` is provided via `kwargs`. |
| 4097 | |
| 4098 | 2. **Interpolation along one dimension of N-dimensional data (N ≥ 1)** |
| 4099 | - Methods {"linear", "nearest", "zero", "slinear", "quadratic", "cubic", "quintic", "polynomial"} |