def _resample_grid(stations, nodes, lags, mindepth, maxdepth, corners):
resamp_nodes = []<EOL>resamp_lags = []<EOL>for i, node in enumerate(nodes):<EOL><INDENT>if mindepth < float(node[<NUM_LIT:2>]) < maxdepth andcorners.contains_point(node[<NUM_LIT:0>:<NUM_LIT:2>]):<EOL><INDENT>resamp_nodes.append(node)<EOL>resamp_lags.append([lags[:, i]])<EOL><DEDENT><DEDENT>print(np.shape(resamp_lags))<EOL>resamp_lags = np.reshape(resamp_lags, (len(resamp_lags), len(stations))).T<EOL>print('<STR_LIT:U+0020>'.join(['<STR_LIT>', str(len(resamp_nodes)), '<STR_LIT>']))<EOL>return stations, resamp_nodes, resamp_lags<EOL>
Resample the lagtime grid to a given volume.

For use if the grid from Grid2Time is too large or you want to run a
faster, downsampled scan.

:type stations: list
:param stations:
    List of station names from in the form where stations[i] refers to
    nodes[i][:] and lags[i][:]
:type nodes: list
:param nodes:
    List of node points where nodes[i] referes to stations[i] and
    nodes[:][:][0] is latitude in degrees, nodes[:][:][1] is longitude in
    degrees, nodes[:][:][2] is depth in km.
:type lags: numpy.ndarray
:param lags:
    Array of arrays where lags[i][:] refers to stations[i]. lags[i][j]
    should be the delay to the nodes[i][j] for stations[i] in seconds.
:type mindepth: float
:param mindepth: Upper limit of volume
:type maxdepth: float
:param maxdepth: Lower limit of volume
:type corners: matplotlib.path.Path
:param corners:
    matplotlib Path of the corners for the 2D polygon to cut to in lat and
    lon.

:returns: Stations
:rtype: list
:returns: List of lists of tuples of node locations
:rtype: list
:returns: Array of lags.
:rtype: :class:`numpy.ndarray`

.. note::
    **Output:**

    station[1] refers to nodes[1] and lags[1] nodes[1][1] refers
    to station[1] and lags[1][1] nodes[n][n] is a tuple of latitude,
    longitude and depth.