pyinterp.RTree.inverse_distance_weighting

RTree.inverse_distance_weighting(coordinates: ndarray, radius: float | None = None, k: int = 9, p: int = 2, within: bool = True, num_threads: int = 0) tuple[ndarray, ndarray][source]

Interpolation of the value at the requested position by inverse distance weighting method.

Parameters:
  • coordinates – a matrix of shape (n, 3), where n is the number of observations and 3 represents the coordinates in theorder: x, y, and z. If the matrix shape is (n, 2), the z-coordinate is assumed to be zero. The coordinates (x, y, z) are in the Cartesian coordinate system (ECEF) if the instance is configured to use this system (ecef keyword set to True during construction). Otherwise, the coordinates are in the geodetic system (longitude, latitude, and altitude) in degrees, degrees, and meters, respectively.

  • radius – The maximum radius of the search (m). Defaults The maximum distance between two points.

  • k – The number of nearest neighbors to be used for calculating the interpolated value. Defaults to 9.

  • p – The power parameters. Defaults to 2.

  • within – If true, the method ensures that the neighbors found are located around the point of interest. In other words, this parameter ensures that the calculated values will not be extrapolated. Defaults to true.

  • num_threads – The number of threads to use for the computation. If 0 all CPUs are used. If 1 is given, no parallel computing code is used at all, which is useful for debugging. Defaults to 0.

Returns:

The interpolated value and the number of neighbors used in the calculation.