rex.utilities.utilities.res_dist_threshold

res_dist_threshold(lat_lons, tree=None, margin=1.05)[source]

Distance threshold for nearest neighbor searches performed on resource points. Calculated as half of the diagonal between closest resource points, with desired extra margin

Parameters:
  • lat_lons (ndarray) – n x 2 array of resource points coordinates (lat, lon)

  • tree (cKDTree, optional) – Pre-build cKDTree of resource lat, lon coordintes. If None, build the cKDTree from scratch, by default None

  • margin (float, optional) – Extra margin to multiply times the computed max distance between neighboring resource points, by default 1.05

Returns:

float – Distance threshold for nearest neighbor searches performed on resource points. Calculated as half of the diagonal between closest resource points, with desired extra margin