environmentaltools.common.find_nearest_point

environmentaltools.common.find_nearest_point(data, point: tuple)[source]

Find the nearest point in a spatial dataset to a given coordinate.

Uses Euclidean distance to identify the closest point in the dataset to the specified target coordinates.

Parameters:
  • data (xr.Dataset or pd.DataFrame) – Dataset with ‘x’ and ‘y’ coordinates.

  • point (tuple) – Target point coordinates as (x, y).

Returns:

Index of the nearest point in the dataset.

Return type:

int