def apply_mask(in_scmcube, in_mask):
    """Apply a mask to an scm cube's data

    Parameters
    ----------
    in_scmcube : :obj:`SCMCube`
        An ``SCMCube`` instance.

    in_mask : boolean np.ndarray
        The mask to apply

    Returns
    -------
    :obj:`SCMCube`
        A copy of the input cube with the mask applied to its data
    """
    out_cube = type(in_scmcube)()
    out_cube.cube = in_scmcube.cube.copy()
    out_cube.cube.data.mask = in_mask
    return out_cube
