environmentaltools.spatiotemporal.bme.select_neighbours
- environmentaltools.spatiotemporal.bme.select_neighbours(c0, c, z, nmax, dmax)[source]
Select neighboring data points for local BME estimation.
Finds data points within specified spatiotemporal distance constraints, limiting to a maximum number of nearest neighbors.
- Parameters:
c0 (pd.DataFrame) – Estimation point coordinates with columns [‘x’, ‘y’, ‘t’].
c (pd.DataFrame) – Data point coordinates with columns [‘x’, ‘y’, ‘t’].
z (pd.DataFrame) – Data values at coordinates c.
nmax (int) – Maximum number of neighbors to select.
dmax (list of float) – Maximum distances [spatial_max, temporal_max, space_time_ratio].
- Returns:
csub (pd.DataFrame) – Coordinates of selected neighbor points.
zsub (pd.DataFrame) – Values at selected neighbor points.
dsub (list of np.ndarray) – Distances [spatial, temporal, combined] for selected neighbors.
nsub (int) – Number of selected neighbors.
index (np.ndarray) – Indices of selected neighbors in original data.
Notes
Combined distance uses weighted sum: ds + (space_time_ratio * dt). If more than nmax neighbors meet distance criteria, selects nearest ones.