code: def findClosestAzel(az, el, azpts, elpts):
      
      assert az.ndim == 2
      assert az.shape == el.shape
  
      azpts = np.atleast_1d(azpts)
      elpts = np.atleast_1d(elpts)
  
      assert azpts.shape == elpts.shape
  
      az = np.ma.masked_invalid(az)
      el = np.ma.masked_invalid(el)
  
      az = np.radians(az)
      el = np.radians(el)
      azpts = np.radians(azpts)
      elpts = np.radians(elpts)
  
      if np.ma.is_masked(azpts):
          azpts = azpts.compressed()
          elpts = elpts.compressed()
      else:
          azpts = np.atleast_1d(azpts).ravel()
          elpts = np.atleast_1d(elpts).ravel()
  
      # can be FAR FAR faster than scipy.spatial.distance.cdist()
      nearRow, nearCol = _findindex(az, el, azpts, elpts)
  
      return nearRow, nearCol
docs: assumes that azpts, elpts are each list of 1-D arrays or 2-D arrays
      az: 2-D Numpy array of azimuths in the image
      el: 2-D Numpy array of elevations in the image
      azpts: 1-D or 2-D Numpy array of azimuth points to see where nearest neighbor index is
      elpts: 1-D or 2-D Numpy array of azimuth points to see where nearest neighbor index is