I think the closest distance to the next grid point can be obtained by looking at the lat and lon value seperately.
For finding the closest grid coordinate
look at lat and lon seperately
For the index
numpy's searchsorted() may be helpful since the values are sorted. It would work for getting the index of a grid point for each coordinate (lat and lon).
index_lat = lats.searchsorted(grid_lat)
index_lon = lons.searchsorted(grid_lon)
I think the closest distance to the next grid point can be obtained by looking at the lat and lon value seperately.
For finding the closest grid coordinate
look at lat and lon seperately
For the index
numpy's
searchsorted()may be helpful since the values are sorted. It would work for getting the index of a grid point for each coordinate (lat and lon).