nsrdb.utilities.nearest_neighbor.reg_grid_nn

reg_grid_nn(latitude, longitude, df, labels=('latitude', 'longitude'))[source]

Get nearest neighbors from a regular lat/lon grid.

Parameters:
  • latitude (np.ndarray) – 1D array of latitude values from a regular grid.

  • longitude (np.ndarray) – 1D array of longitude values from a regular grid.

  • df (pd.DataFrame:) – Dataframe containing coodinate columns with the corresponding labels.

  • labels (tuple | list) – Column labels corresponding to the lat/lon columns in df.

Returns:

out (ndarray) – Array of indices that correspond to data mapped to the regular latitude/longitude input grid. The regular grid data should be flattened and then indexed with this output indices var.