def get_csi(LWdown, T, e, e_ad=0.22, k=0.47, return_all=False):
    """
    Clear Sky Index after Marty and Philipona, 2000

    Parameters
    ----------
    LWdown : ndarray
        longwave down as measured/ simulated [W/m**2]
    T : ndarray
        temperature at lowest level [K]
    e : ndarray
        water vapor pressure [Pa]
    e_ad : float
        altitude dependent clear-sky emittance of a completely dry atmosphere
    k : float
        location dependent coefficient
    return_all : bool
        if False returns CSI, else returns (CSI, app_em, clear_sky_app_em)

    Returns
    -------
    CSI : ndarray
        clear sky index =

    Notes
    -----
    According to Marty and Philipona
    CSI <= 1 : clear sky, no clouds
    CSI > 1 : cloudy sky, overcast
    """

    # Stephan-Boltzmann constant
    sigma = 5.67 * 10**-8

    # apparent emittance of actual sky
    app_em = LWdown / (sigma * T**4)

    # clear sky apparent emittance
    cs_app_em = e_ad + k * (e * T) ** (1./7)

    CSI = app_em / cs_app_em

    if return_all:
        return (CSI, app_em, cs_app_em)
    else:
        return CSI