uxarray.grid.neighbors.BallTree.query

Contents

uxarray.grid.neighbors.BallTree.query#

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

Queries the tree for the k nearest neighbors.

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

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

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

  • 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 (coords.shape[0], k), dtype=double) – Distance array that keeps the distances of the k-nearest neighbors to the entries from coords in each row

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