code: def nearest_vertex(self, lons, lats):
          
  
          # translate to unit sphere
  
          xi = np.array(_stripack.trans(lats, lons))
          idx = np.empty_like(xi[0,:], dtype=np.int)
          dist = np.empty_like(xi[0,:], dtype=np.float)
  
          for pt in range(0, xi.shape[1]):
              xi0 = xi[:,pt]
  
              # i is the node at which we start the search
              # the closest x coordinate is a good place
              i = ((self._x - xi0[0])**2).argmin() + 1
  
              idx[pt], dist[pt] = _stripack.nearnd((xi0[0],xi0[1],xi0[2]), self._x, self._y, self._z, self.lst, self.lptr, self.lend, i)
  
          idx -= 1 # return to C ordering
  
          return self._deshuffle_simplices(idx), dist
docs: Locate the index of the nearest vertex to points (lons,lats)
          and return the squared great circle distance between (lons,lats) and
          each nearest neighbour.
  
          Parameters
          ----------
           lons : float / array of floats, shape (l,)
              longitudinal coordinate(s) on the sphere
           lats : float / array of floats, shape (l,)
              latitudinal coordinate(s) on the sphere
  
          Returns
          -------
           index : array of ints
              the nearest vertex to each of the supplied points
           dist : array of floats
              great circle distance (angle) on the unit sphere to the closest
              vertex identified.
  
  
          Notes
          -----
           Faster searches can be obtained using a k-d tree.
           See sTriangulation.nearest_vertices() for details.
           There is an additional overhead associated with building and storing the k-d tree.