Query the cKDtree for the nearest neighbours and Euclidean
        distance from x,y points.

        Returns 0, 0 if a cKDtree has not been constructed
        (switch tree=True if you need this routine)

        Parameters
        ----------
         x : 1D array of Cartesian x coordinates
         y : 1D array of Cartesian y coordinates
         k : number of nearest neighbours to return
             (default: 1)
         max_distance : maximum Euclidean distance to search
                        for neighbours (default: inf)

        Returns
        -------
         d    : Euclidean distance between each point and their
                nearest neighbour(s)
         vert : vertices of the nearest neighbour(s)

def nearest_vertices(self, x, y, k=1, max_distance=np.inf ):
        """
        Query the cKDtree for the nearest neighbours and Euclidean
        distance from x,y points.

        Returns 0, 0 if a cKDtree has not been constructed
        (switch tree=True if you need this routine)

        Parameters
        ----------
         x : 1D array of Cartesian x coordinates
         y : 1D array of Cartesian y coordinates
         k : number of nearest neighbours to return
             (default: 1)
         max_distance : maximum Euclidean distance to search
                        for neighbours (default: inf)

        Returns
        -------
         d    : Euclidean distance between each point and their
                nearest neighbour(s)
         vert : vertices of the nearest neighbour(s)
        """

        if self.tree == False or self.tree == None:
            return 0, 0

        xy = np.column_stack([x, y])

        dxy, vertices = self._cKDtree.query(xy, k=k, distance_upper_bound=max_distance)


        if k == 1:   # force this to be a 2D array
            vertices = np.reshape(vertices, (-1, 1))

        return dxy, vertices