def daily_total_solar_radiation(ra_24_toa, ra_24_toa_flat, diffusion_index,
    trans_24):
    """
    Computes the daily solar radiation at the earth's surface taken
    diffuse and direct solar radiation into account

    .. math ::
        S^{\\downarrow} = I_{diff} \\tau S_{toa,f} +(1-I_{diff}) \\tau S_{toa}

    Parameters
    ----------
    ra_24_toa : float
        daily solar radiation at the top of atmosphere
        :math:`S_{toa}`
        [Wm-2]
    ra_24_toa_flat : float
        daily solar radiation at the top of atmosphere for a flat surface
        :math:`S_{toa,f}`
        [Wm-2]
    diffusion_index : float
        diffusion_index
        :math:`I_{diff}`
        [-]
    trans_24 : float
        daily atmospheric transmissivity
        :math:`\\tau`
        [-]

    Returns
    -------
    ra_24 : float
        daily solar radiation
        :math:`S^{\\downarrow}`
        [Wm-2]

    """
    diffuse = trans_24 * ra_24_toa_flat * diffusion_index
    direct = trans_24 * ra_24_toa * (1 - diffusion_index)
    ra_24 = diffuse + direct
    return ra_24
