title: NetCDF and Python: Finding the closest lon/lat index given actual lon/lat values
body: <p>I'd like to be able to find the lon/lat coordinate indices of the closest location to a lon/lat tuple.  This is already available in the Java API as GridCoordSystem.findXYindexFromLatLon(), but I haven't found anything comparable in the Python API. What I'm hoping to find in the API, or write myself and contribute to the API (if useful), is something like this:</p>
  
  <pre><code>def get_indices(netcdf_dataset, lon_value, lat_value):
      '''
      :param netcdf_dataset an open NetCDF data set object
      :param lon_value a longitude value, in degrees (-180...180)
      :param lat_value a latitude value, in degrees (-90...90)
      :return indices into the lon and lat coordinate variables corresponding to the closest point to the lon/lat value arguments
      '''
  
      # some (trigonometry?) code here...
  
      return lon_index, lat_index
  </code></pre>
  
  <p>Maybe this isn't as complicated as I assume it is, and I can get away with just using the closest neighbor?</p>
  
  <p>Thanks in advance for any comments or suggestions.</p>