Skip to content

Instantly share code, notes, and snippets.

@beatorizu
Created October 25, 2017 17:20
Show Gist options
  • Select an option

  • Save beatorizu/cb7b97572b5854cd6182ee5ddabff4b9 to your computer and use it in GitHub Desktop.

Select an option

Save beatorizu/cb7b97572b5854cd6182ee5ddabff4b9 to your computer and use it in GitHub Desktop.
def find_nearest_point(latitude, longitude, l_latitude, l_longitude):
"""
This function find the index of the nearest value to the latitude and longitude values int the l_latitude and
l_longitude lists.
Parameters
----------
latitude: float
longitude: float
l_latitude: list
l_longitude: list
Returns
-------
tuple
the index of latitude and longitude
"""
i_latitude = (np.abs(l_latitude-latitude)).argmin()
i_longitude = (np.abs(l_longitude-longitude)).argmin()
return i_latitude, i_longitude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment