def _get_neighbours_ix(obs_coords, raw_coords, nnear):
"""
Returns <nnear> neighbour indices per <obs_coords> coordinate pair
Parameters
----------
obs_coords : array of float of shape (num_points,ndim)
in the neighbourhood of these coordinate pairs we look for neighbours
raw_coords : array of float of shape (num_points,ndim)
from these coordinate pairs the neighbours are selected
nnear : integer
number of neighbours to be selected per coordinate pair of obs_coords
"""
# plant a tree
tree = cKDTree(raw_coords)
# return nearest neighbour indices
return tree.query(obs_coords, k=nnear)[1]
评论列表
文章目录