xoa.core.geo.closest_point_fast

xoa.core.geo.closest_point_fast#

xoa.core.geo.closest_point_fast(lons, lats, target_lon, target_lat)[source]#

Find the closest point of a 2D grid, without scanning large grids

Small grids are fully scanned. For larger ones, the closest point of a subsampled grid is refined by walking downhill from it, to the closest point of its neighbours, until no neighbour is closer. Unlike a search in a window of fixed size, this is not limited by the distance between the subsampled point and the true closest point, which is large when cells are not square.

Returns:

  • int – I index

  • int – J index