xrspatial.interpolate.idw#

xrspatial.interpolate.idw(x, y, z, template, power=2.0, k=None, fill_value=nan, name='idw')[source]#

Inverse Distance Weighting interpolation.

Parameters:
  • x (array-like) – Coordinates and values of scattered input points.

  • y (array-like) – Coordinates and values of scattered input points.

  • z (array-like) – Coordinates and values of scattered input points.

  • template (xr.DataArray) – 2-D DataArray whose grid defines the output raster.

  • power (float, default 2.0) – Distance weighting exponent.

  • k (int or None, default None) – Number of nearest neighbours. None uses all points (numba JIT); an integer uses scipy.spatial.cKDTree (CPU only).

  • fill_value (float, default np.nan) – Value for pixels with zero total weight.

  • name (str, default 'idw') – Name of the output DataArray.

Return type:

xr.DataArray

Raises:

MemoryError – When k is set on a numpy-backed template and the (grid_pixels, k) distance and index arrays from the cKDTree query would exceed 80% of available memory.