pyinterp.core.RTree3DFloat64.inverse_distance_weighting

pyinterp.core.RTree3DFloat64.inverse_distance_weighting#

RTree3DFloat64.inverse_distance_weighting(self: pyinterp.core.RTree3DFloat64, coordinates: Annotated[numpy.typing.ArrayLike, numpy.float64], radius: SupportsFloat | None = None, k: SupportsInt = 9, p: SupportsInt = 2, within: bool = True, num_threads: SupportsInt = 0) tuple#

Interpolate values using inverse distance weighting.

Performs inverse distance weighted interpolation at the requested positions using the K nearest neighbors found within the specified search radius.

Parameters:
  • coordinates – Array of shape (n, 3) or (n, 2) containing observation coordinates. Here n is the number of observations and each row represents a coordinate in the order x, y, and optionally z. If the matrix shape is (n, 2), the z-coordinate is assumed to be zero. The coordinate system depends on the instance configuration: If ecef=True, coordinates are in the Cartesian coordinate system (ECEF). Otherwise, coordinates are in the geodetic system (longitude, latitude, altitude) in degrees, degrees, and meters, respectively.

  • radius – Maximum search radius in meters. Defaults to the largest representable value.

  • k – Number of nearest neighbors to use for interpolation. Defaults to 9.

  • p – Power parameter for inverse distance weighting. Defaults to 2.

  • within – If True, ensures neighbors are located around the point of interest (no extrapolation). Defaults to True.

  • num_threads – Number of threads to use for computation. If 0, all CPUs are used. If 1, no parallel computing is used (useful for debugging). Defaults to 0.

Returns:

Tuple containing the interpolated value and the number of neighbors used in the calculation.