コード例 #1
0
def test_an_gs_ci_yields_more_severe_stress_when_temperature_and_water_stresses_are_combined_than_separated(
        leaf_local_weather=setup_leaf_local_weather()):
    an_t, _, _, gs_t = zip(*[
        exchange.an_gs_ci(photo_params=exchange.par_photo_default(),
                          meteo_leaf=leaf_local_weather,
                          psi=0.,
                          leaf_temperature=t,
                          model='misson',
                          g0=0.019,
                          rbt=2. / 3.,
                          ca=400.,
                          m0=5.278,
                          psi0=-0.1,
                          d0_leuning=30.,
                          steepness_tuzet=1.85) for t in range(-10, 46)
    ])

    an_t_psi, _, _, gs_t_psi = zip(*[
        exchange.an_gs_ci(photo_params=exchange.par_photo_default(),
                          meteo_leaf=leaf_local_weather,
                          psi=-2.,
                          leaf_temperature=t,
                          model='misson',
                          g0=0.019,
                          rbt=2. / 3.,
                          ca=400.,
                          m0=5.278,
                          psi0=-0.1,
                          d0_leuning=30.,
                          steepness_tuzet=1.85) for t in range(-10, 46)
    ])

    assert all(x <= x_t for x, x_t in zip(an_t_psi, an_t))
    assert all(x <= x_t for x, x_t in zip(gs_t_psi, gs_t))
コード例 #2
0
def test_an_gs_ci_yields_maximum_stomatal_conductance_at_34_degrees_celsius(
        leaf_local_weather=setup_leaf_local_weather()):
    gs_max = exchange.an_gs_ci(photo_params=exchange.par_photo_default(),
                               meteo_leaf=leaf_local_weather,
                               psi=0.,
                               leaf_temperature=34,
                               model='misson',
                               g0=0.019,
                               rbt=2. / 3.,
                               ca=400.,
                               m0=5.278,
                               psi0=-0.1,
                               d0_leuning=30.,
                               steepness_tuzet=1.85)[-1]

    an, _, _, gs = zip(*[
        exchange.an_gs_ci(photo_params=exchange.par_photo_default(),
                          meteo_leaf=leaf_local_weather,
                          psi=0.,
                          leaf_temperature=t,
                          model='misson',
                          g0=0.019,
                          rbt=2. / 3.,
                          ca=400.,
                          m0=5.278,
                          psi0=-0.1,
                          d0_leuning=30.,
                          steepness_tuzet=1.85) for t in range(-10, 46)
    ])

    assert all(x <= gs_max for x in gs)
コード例 #3
0
def test_arrhenius_1_increases_as_temperature_increases():
    param_names = ['Tx', 'Kc', 'Ko']
    for param_name in param_names:
        prev_value = exchange.arrhenius_1(param_name, 0,
                                          exchange.par_photo_default())
        for leaf_temperature in range(1, 50):
            actual_value = exchange.arrhenius_1(param_name, leaf_temperature,
                                                exchange.par_photo_default())
            assert actual_value > prev_value
            prev_value = actual_value
コード例 #4
0
def test_arrhenius_2_is_maximum_for_vcmax_at_39_degrees_celsius():
    value_at_low_temperature = exchange.arrhenius_2(
        'Vcmax', 0.0, exchange.par_photo_default())
    value_at_optimal_temperature = exchange.arrhenius_2(
        'Vcmax', 39.0, exchange.par_photo_default())
    value_at_high_temperature = exchange.arrhenius_2(
        'Vcmax', 50.0, exchange.par_photo_default())

    assert all([
        value_at_optimal_temperature > val
        for val in (value_at_low_temperature, value_at_high_temperature)
    ])
コード例 #5
0
def test_transpiration_rate_incrases_as_vapor_pressure_deficit_increases(
        leaf_local_weather=setup_leaf_local_weather()):
    air_temp = 25.
    leaf_temp = 25.
    atmospheric_pressure = leaf_local_weather['Pa']
    gb = exchange.boundary_layer_conductance(
        leaf_length=0.1,
        wind_speed=leaf_local_weather['u'],
        atm_pressure=leaf_local_weather['Pa'],
        air_temp=air_temp,
        ideal_gas_cst=exchange.R)
    es = utilities.saturated_air_vapor_pressure(leaf_temp)

    gs = exchange.an_gs_ci(photo_params=exchange.par_photo_default(),
                           meteo_leaf=leaf_local_weather,
                           psi=0.0,
                           leaf_temperature=34.,
                           model='misson',
                           g0=0.019,
                           rbt=2. / 3.,
                           ca=400.,
                           m0=5.278,
                           psi0=-0.1,
                           d0_leuning=30.,
                           steepness_tuzet=1.85)[-1]

    transpiration = [
        exchange.transpiration_rate(leaf_temp, ea, gs, gb,
                                    atmospheric_pressure)
        for ea in linspace(es, 0, 10)
    ]
    assert all(x <= y for x, y in zip(transpiration, transpiration[1:]))
コード例 #6
0
def test_an_gs_ci_changes_gas_exchange_rates_as_leaf_temperature_changes(
        leaf_local_weather=setup_leaf_local_weather()):
    an, _, _, gs = zip(*[
        exchange.an_gs_ci(photo_params=exchange.par_photo_default(),
                          meteo_leaf=leaf_local_weather,
                          psi=0.,
                          leaf_temperature=t,
                          model='misson',
                          g0=0.019,
                          rbt=2. / 3.,
                          ca=400.,
                          m0=5.278,
                          psi0=-0.1,
                          d0_leuning=30.,
                          steepness_tuzet=1.85) for t in range(-10, 46)
    ])

    assert all(x != y for x, y in zip(an, an[1:]))
    assert all(x != y for x, y in zip(gs, gs[1:]))
コード例 #7
0
def test_an_gs_ci_reduces_gas_exchange_rates_as_leaf_water_potential_decreases(
        leaf_local_weather=setup_leaf_local_weather()):
    an, _, _, gs = zip(*[
        exchange.an_gs_ci(photo_params=exchange.par_photo_default(),
                          meteo_leaf=leaf_local_weather,
                          psi=psi,
                          leaf_temperature=25.,
                          model='misson',
                          g0=0.019,
                          rbt=2. / 3.,
                          ca=400.,
                          m0=5.278,
                          psi0=-0.1,
                          d0_leuning=30.,
                          steepness_tuzet=1.85) for psi in arange(0, -3, -0.1)
    ])

    assert all(x >= y for x, y in zip(an, an[1:]))
    assert all(x >= y for x, y in zip(gs, gs[1:]))
コード例 #8
0
def test_compute_an_2par_increases_only_electron_transport_as_ppfd_increases():
    vcmax = []
    j_frac = []
    tpu_triple = []
    rd = []

    for ppfd in range(0, 2000, 10):
        res = exchange.compute_an_2par(exchange.par_photo_default(),
                                       ppfd,
                                       leaf_temp=25.0)
        vcmax.append(res[0])
        j_frac.append(res[2])
        tpu_triple.append(res[4])
        rd.append(res[6])

    # vcmax is independent from ppfd
    assert all(x == y for x, y in zip(vcmax, vcmax[1:]))
    # j increases with ppfd
    assert all(x < y for x, y in zip(j_frac, j_frac[1:]))
    # tpu is independent from ppfd
    assert all(x == y for x, y in zip(tpu_triple, tpu_triple[1:]))
    # rd is independent from ppfd
    assert all(x == y for x, y in zip(rd, rd[1:]))
コード例 #9
0
def test_compute_an_2par_affects_all_photosynthetic_parameters_by_temperature(
):
    vcmax = []
    j_frac = []
    tpu_triple = []
    rd = []

    for temperature in range(-10, 45):
        res = exchange.compute_an_2par(exchange.par_photo_default(),
                                       ppfd=1800.,
                                       leaf_temp=temperature)
        vcmax.append(res[0])
        j_frac.append(res[2])
        tpu_triple.append(res[4])
        rd.append(res[6])

    # vcmax is dependent on temperature
    assert all(x != y for x, y in zip(vcmax, vcmax[1:]))
    # j is dependent on temperature
    assert all(x != y for x, y in zip(j_frac, j_frac[1:]))
    # tpu is dependent on temperature
    assert all(x != y for x, y in zip(tpu_triple, tpu_triple[1:]))
    # rd is dependent on temperature
    assert all(x != y for x, y in zip(rd, rd[1:]))