def stress_temperature(t_air_24, t_opt=25.0, t_min=0.0, t_max=50.0):
    """
    Computes the stress for plants when it is too cold or hot

    .. math ::
        f=\\frac{T_{max}-T_{opt}}{T_{opt}-T_{min}}

    .. math ::
        s_{T}=\\frac{\\left(T_{a}-T_{min}\\right)\\left(T_{max}-T_{a}\\right)^{f}}
            {\\left(T_{opt}-T_{min}\\right)\\left(T_{max}-T_{opt}\\right)^{f}}

    Parameters
    ----------
    t_air_24 : float
        daily air temperature
        :math:`T_{a}`
        [C]
    t_opt : float
        optimum air temperature for plant growth
        :math:`T_{opt}`
        [C]
    t_min : float
        minimum air temperature for plant growth
        :math:`T_{min}`
        [C]
    t_max : float
        maximum air temperature for plant growth
        :math:`T_{max}`
        [C]

    Returns
    -------
    stress_temp : float
        stress factor for air temperature
        :math:`S_{T}`
        [-]

    Examples
    --------
    >>> import ETLook.stress as stress
    >>> stress.stress_temperature(15)
    0.83999999999999997
    >>> stress.stress_temperature(15, t_opt =20)
    0.9451080185178129
    >>> stress.stress_temperature(15, t_opt =20, t_min=10)
    0.79398148148148151
    >>> stress.stress_temperature(15, t_opt =20, t_min=10, t_max=30)
    0.75

    """
    f = (t_max - t_opt) / (t_opt - t_min)
    x = (t_air_24 - t_min) * (t_max - t_air_24) ** f
    y = (t_opt - t_min) * (t_max - t_opt) ** f
    stress = x / y
    stress = stress.clip(0, 1)
    return stress
