uxarray.grid.neighbors.BallTree#
- class uxarray.grid.neighbors.BallTree(grid, coordinates='nodes', coordinate_system='spherical', distance_metric='haversine', reconstruct=False)#
Custom BallTree data structure written around the
sklearn.neighbors.BallTree
implementation for use with either the (node_x
,node_y
,node_z
) and (node_lon
,node_lat
), edge (edge_x
,edge_y
,edge_z
) and (edge_lon
,edge_lat
), or center (face_x
,face_y
,face_z
) and (face_lon
,face_lat
) nodes of the inputted unstructured grid.- Parameters:
grid (ux.Grid) – Source grid used to construct the BallTree
coordinates (str, default="nodes") – Identifies which tree to construct or select, with “nodes” selecting the Corner Nodes, “face centers” selecting the Face Centers of each face, and “edge centers” selecting the edge centers of each face.
distance_metric (str, default="haversine") – Distance metric used to construct the BallTree, options include: ‘euclidean’, ‘l2’, ‘minkowski’, ‘p’,’manhattan’, ‘cityblock’, ‘l1’, ‘chebyshev’, ‘infinity’, ‘seuclidean’, ‘mahalanobis’, ‘hamming’, ‘canberra’, ‘braycurtis’, ‘jaccard’, ‘dice’, ‘rogerstanimoto’, ‘russellrao’, ‘sokalmichener’, ‘sokalsneath’, ‘haversine’
Notes
See sklearn.neighbors.BallTree for further information about the wrapped data structures.
- __init__(grid, coordinates='nodes', coordinate_system='spherical', distance_metric='haversine', reconstruct=False)#
Methods
__init__
(grid[, coordinates, ...])query
(coords[, k, in_radians, ...])Queries the tree for the
k
nearest neighbors.query_radius
(coords[, r, in_radians, ...])Queries the tree for all neighbors within a radius
r
.Attributes
coordinates