uxarray.grid.neighbors.KDTree.query

Contents

uxarray.grid.neighbors.KDTree.query#

KDTree.query(coords, k=1, return_distance=True, in_radians=False, dualtree=False, breadth_first=False, sort_results=True)#

Queries the tree for the k nearest neighbors.

Parameters:
  • coords (array_like) – coordinate pairs in cartesian (x, y, z) or spherical (lat, lon) to query

  • k (int, default=1) – The number of nearest neighbors to return

  • return_distance (bool, optional) – Indicates whether distances should be returned

  • in_radians (bool, optional) – if True, queries assuming coords are inputted in radians, not degrees. Only applies for spherical coordinates

  • dualtree (bool, default=False) – Indicates whether to use the dual-tree formalism for node queries

  • breadth_first (bool, default=False) – Indicates whether to query nodes in a breadth-first manner

  • sort_results (bool, default=True) – Indicates whether distances should be sorted

Returns:

  • d (ndarray of shape (xyz.shape[0], k), dtype=double) – Distance array that keeps the distances of the k-nearest neighbors to the entries from xyz in each row

  • ind (ndarray of shape (xyz.shape[0], k), dtype=INT_DTYPE) – Index array that keeps the indices of the k-nearest neighbors to the entries from xyz in each row