def get_indices(start, end, coords, res):
    """
    Transform continuous start and end coordinates into array indices.

    Parameters
    ----------
    start : float
        coordinate of the lower bound.
    end : float
        coordinate of the upper bound.
    coords : numpy.ndarray
        coordinate values along the axis.
    res : tuple
        Resolution along an axis (aka "grid/cell sizes")
    """
    size = len(coords)
    half = abs(res) / 2.0
    vmin, vmax = coords.min(), coords.max()
    span = vmax - vmin
    start, end = start + half - vmin, end - half - vmin
    sidx, eidx = int(start / span * size), int(end / span * size)
    if eidx < sidx:
        return sidx, sidx
    return sidx, eidx
