uxarray.grid.neighbors.KDTree.query#
- KDTree.query(xyz, k=1, return_distance=True, dualtree=False, breadth_first=False, sort_results=True)#
Queries the tree for the
k
nearest neighbors.- Parameters:
xyz (array_like) – coordinate pairs in cartesian (x, y, z) to query
k (int, default=1) – The number of nearest neighbors to return
return_distance (bool, optional) – Indicates whether distances should be returned
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