nsrdb.utilities.nearest_neighbor.geo_nn
- geo_nn(df1, df2, labels=('latitude', 'longitude'), k=4)[source]
Get geo nearest neighbors for coordinate sets using haversine dist.
- Parameters:
df1/df2 (pd.DataFrame:) – Dataframes containing coodinate columns with the corresponding labels.
labels (tuple | list) – Column labels corresponding to the lat/lon columns in df1/df2.
k (int) – Number of nearest neighbors to return
- Returns:
dist (ndarray) – Distance array in km.
indicies (ndarray) – 2D array of row indicies in df1 that match df2. df1[df1.index[indicies[i]]] is closest to df2[df2.index[i]]