pyinterp.core.RTree3DFloat64.value#
- RTree3DFloat64.value(self: pyinterp.core.RTree3DFloat64, coordinates: Annotated[numpy.typing.ArrayLike, numpy.float64], radius: SupportsFloat | None = None, k: SupportsInt = 4, within: bool = False, num_threads: SupportsInt = 0) tuple#
Get the K nearest neighbors of given points.
Retrieves the coordinates and values of the K nearest neighbors for each provided position.
- Parameters:
coordinates – Array of shape
(n, 3)or(n, 2)containing observation coordinates. Herenis 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: Ifecef=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. By default, no limit is applied.
k – Number of nearest neighbors to retrieve. Defaults to 4.
within – If True, ensures neighbors are located around the point of interest (no extrapolation). Defaults to False.
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 of (coordinates, values) arrays for the K nearest neighbors found for each provided position. The coordinates array has shape (k, 2) or (k, 3) depending on whether z-coordinates were provided.
Note
The neighbor coordinates array has dimension (k, n) where n is 2 if the input coordinates only define x and y, and 3 if they define x, y, and z.