def linear_variability(csr, var_frac):
    """Return an array with a linear relation between clearsky ratio and
    maximum variability fraction. Each value in the array is the maximum
    variability fraction for the corresponding clearsky ratio.

    Parameters
    ----------
    csr : np.ndarray
        REST2 clearsky irradiance without bad or missing data.
        This is a 2D array with (time, sites).
    var_frac : float
        Maximum variability fraction (0.05 is 5% variability).

    Returns
    -------
    out : np.ndarray
        Array with shape matching csr with maximum variability (var_frac)
        when the csr = 1 (clear or thin clouds). Each value in the array is
        the maximum variability fraction for the corresponding clearsky ratio.

    """
    return var_frac * csr