pyinterp.core.geodetic.RTree.query

RTree.query(self: pyinterp.core.geodetic.RTree, lon: numpy.ndarray[numpy.float64[m, 1], flags.writeable], lat: numpy.ndarray[numpy.float64[m, 1], flags.writeable], k: int = 4, within: bool = False, num_threads: int = 0) tuple

Search for the nearest K nearest neighbors of a given point.

Parameters:
  • lon – The longitude of the points in degrees.

  • lat – The latitude of the points in degrees.

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

  • within – If true, the method ensures that the neighbors found are located within the point of interest. Defaults to false.

  • 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:

A tuple containing a matrix describing for each provided position, the distance, in meters, between the provided position and the found neighbors and a matrix containing the value of the different neighbors found for all provided positions.