XPalm - Growth and yield model for oil palm

Dev Build Status Coverage ColPrac: Contributor's Guide on Collaborative Practices for Community Packages

XPalm is a growth and yield model for oil palm (Elaeis guineensis).

Installation

The package can be installed using the Julia package manager. From the Julia REPL, type ] to enter the Pkg REPL mode and run:

pkg> add https://github.com/PalmStudio/XPalm.jl

To use the package, type the following in the Julia REPL:

using XPalm

Running the model

The model can be run using the xpalm function. The function takes a table as input and returns a table with the same format as result. The vars argument is a dictionary that maps the names of the columns in the input table to the names of the variables in the model. The sink argument specifies the type of the output table such as a DataFrame, or any table implementing the Tables.jl interface (e.g. XSLX, SQLite, Arrow, see here for all integrations).

using XPalm, CSV, DataFrames
meteo = CSV.read(joinpath(dirname(dirname(pathof(XPalm))), "0-data/meteo.csv"), DataFrame)
df = xpalm(meteo; vars= Dict("Scene" => (:lai,)), sink=DataFrame)

Funding

This work is supported by the PalmStudio research project, funded by the SMART Research Institute and CIRAD.

API

XPalm.AbortionRateType
AbortionRate(TT_flowering, duration_abortion, abortion_rate_max=1.0, abortion_rate_ref=0.2; random_seed::Int=0)
AbortionRate(TT_flowering, duration_abortion, abortion_rate_max, abortion_rate_ref, random_generator<:AbstractRNG)

Determines if the inflorescence will abort based on the trophic state of the plant during a given period in thermal time.

Arguments

  • TT_flowering: thermal time for flowering since phytomer appearence (degree days).
  • duration_abortion: duration used for computing abortion rate before flowering (degree days).

Inputs

  • carbon_offer_after_rm: carbon offer after maintenance respiration (gC/plant).
  • carbon_demand_organs: carbon demand of all organs (gC/plant).

Outputs

  • carbon_demand_plant: total carbon demand of the plant (gC/plant).
  • carbon_offer_plant: total carbon offer of the plant (gC/plant).
  • state: phytomer state (undetermined,Aborted,...)

Note

The abortion is determined at TT_flowering based on the trophic_status of the plant during a period of time before this date. The hypothesis is that a trophic stress can trigger more abortion in the plant.

source
XPalm.AbstractAbortionModelType

abortion process abstract model.

All models implemented to simulate the abortion process must be a subtype of this type, e.g. struct MyAbortionModel <: AbstractAbortionModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractAbortionModel)
source
XPalm.AbstractBiomassModelType

biomass process abstract model.

All models implemented to simulate the biomass process must be a subtype of this type, e.g. struct MyBiomassModel <: AbstractBiomassModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractBiomassModel)
source
XPalm.AbstractBiomass_From_AreaModelType

biomass_from_area process abstract model.

All models implemented to simulate the biomass_from_area process must be a subtype of this type, e.g. struct MyBiomass_From_AreaModel <: AbstractBiomass_From_AreaModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractBiomass_From_AreaModel)
source
XPalm.AbstractBiomass_To_AreaModelType

biomass_to_area process abstract model.

All models implemented to simulate the biomass_to_area process must be a subtype of this type, e.g. struct MyBiomass_To_AreaModel <: AbstractBiomass_To_AreaModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractBiomass_To_AreaModel)
source
XPalm.AbstractCarbon_AllocationModelType

carbon_allocation process abstract model.

All models implemented to simulate the carbon_allocation process must be a subtype of this type, e.g. struct MyCarbon_AllocationModel <: AbstractCarbon_AllocationModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractCarbon_AllocationModel)
source
XPalm.AbstractCarbon_AssimilationModelType

carbon_assimilation process abstract model.

All models implemented to simulate the carbon_assimilation process must be a subtype of this type, e.g. struct MyCarbon_AssimilationModel <: AbstractCarbon_AssimilationModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractCarbon_AssimilationModel)
source
XPalm.AbstractCarbon_DemandModelType

carbon_demand process abstract model.

All models implemented to simulate the carbon_demand process must be a subtype of this type, e.g. struct MyCarbon_DemandModel <: AbstractCarbon_DemandModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractCarbon_DemandModel)
source
XPalm.AbstractCarbon_OfferModelType

carbon_offer process abstract model.

All models implemented to simulate the carbon_offer process must be a subtype of this type, e.g. struct MyCarbon_OfferModel <: AbstractCarbon_OfferModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractCarbon_OfferModel)
source
XPalm.AbstractFTSWModelType
AbstractFTSWModel <: AbstractSoil_WaterModel

Defines a structure for soil water model that computes ftsw as an output.

source
XPalm.AbstractFinal_Potential_BiomassModelType

final_potential_biomass process abstract model.

All models implemented to simulate the final_potential_biomass process must be a subtype of this type, e.g. struct MyFinal_Potential_BiomassModel <: AbstractFinal_Potential_BiomassModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractFinal_Potential_BiomassModel)
source
XPalm.AbstractHarvestModelType

harvest process abstract model.

All models implemented to simulate the harvest process must be a subtype of this type, e.g. struct MyHarvestModel <: AbstractHarvestModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractHarvestModel)
source
XPalm.AbstractInitiation_AgeModelType

initiation_age process abstract model.

All models implemented to simulate the initiation_age process must be a subtype of this type, e.g. struct MyInitiation_AgeModel <: AbstractInitiation_AgeModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractInitiation_AgeModel)
source
XPalm.AbstractInternode_DimensionsModelType

internode_dimensions process abstract model.

All models implemented to simulate the internode_dimensions process must be a subtype of this type, e.g. struct MyInternode_DimensionsModel <: AbstractInternode_DimensionsModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractInternode_DimensionsModel)
source
XPalm.AbstractInternode_Final_Potential_DimensionsModelType

internode_final_potential_dimensions process abstract model.

All models implemented to simulate the internode_final_potential_dimensions process must be a subtype of this type, e.g. struct MyInternode_Final_Potential_DimensionsModel <: AbstractInternode_Final_Potential_DimensionsModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractInternode_Final_Potential_DimensionsModel)
source
XPalm.AbstractInternode_Potential_DimensionsModelType

internode_potential_dimensions process abstract model.

All models implemented to simulate the internode_potential_dimensions process must be a subtype of this type, e.g. struct MyInternode_Potential_DimensionsModel <: AbstractInternode_Potential_DimensionsModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractInternode_Potential_DimensionsModel)
source
XPalm.AbstractLai_DynamicModelType

lai_dynamic process abstract model.

All models implemented to simulate the lai_dynamic process must be a subtype of this type, e.g. struct MyLai_DynamicModel <: AbstractLai_DynamicModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractLai_DynamicModel)
source
XPalm.AbstractLeaf_AreaModelType

leaf_area process abstract model.

All models implemented to simulate the leaf_area process must be a subtype of this type, e.g. struct MyLeaf_AreaModel <: AbstractLeaf_AreaModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractLeaf_AreaModel)
source
XPalm.AbstractLeaf_Final_Potential_AreaModelType

leaf_final_potential_area process abstract model.

All models implemented to simulate the leaf_final_potential_area process must be a subtype of this type, e.g. struct MyLeaf_Final_Potential_AreaModel <: AbstractLeaf_Final_Potential_AreaModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractLeaf_Final_Potential_AreaModel)
source
XPalm.AbstractLeaf_Potential_AreaModelType

leaf_potential_area process abstract model.

All models implemented to simulate the leaf_potential_area process must be a subtype of this type, e.g. struct MyLeaf_Potential_AreaModel <: AbstractLeaf_Potential_AreaModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractLeaf_Potential_AreaModel)
source
XPalm.AbstractLeaf_PruningModelType

leaf_pruning process abstract model.

All models implemented to simulate the leaf_pruning process must be a subtype of this type, e.g. struct MyLeaf_PruningModel <: AbstractLeaf_PruningModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractLeaf_PruningModel)
source
XPalm.AbstractLeaf_RankModelType

leaf_rank process abstract model.

All models implemented to simulate the leaf_rank process must be a subtype of this type, e.g. struct MyLeaf_RankModel <: AbstractLeaf_RankModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractLeaf_RankModel)
source
XPalm.AbstractLight_InterceptionModelType

light_interception process abstract model.

All models implemented to simulate the light_interception process must be a subtype of this type, e.g. struct MyLight_InterceptionModel <: AbstractLight_InterceptionModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractLight_InterceptionModel)
source
XPalm.AbstractMaintenance_RespirationModelType

maintenance_respiration process abstract model.

All models implemented to simulate the maintenance_respiration process must be a subtype of this type, e.g. struct MyMaintenance_RespirationModel <: AbstractMaintenance_RespirationModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractMaintenance_RespirationModel)

Generic maintenance repspiration model.

The models used are defined by the types of the maintenance_respiration fields of a ModelList.

Examples

meteo = Atmosphere(T = 20.0, Wind = 1.0, P = 101.3, Rh = 0.65)

# Using Fvcb model:
leaf =
    ModelList(
        maintenance_respiration = RmQ10(),
        status = (Tₗ = 25.0, PPFD = 1000.0, Cₛ = 400.0, Dₗ = meteo.VPD)
    )

maintenance_respiration(leaf, meteo)
source
XPalm.AbstractNumber_FruitsModelType

number_fruits process abstract model.

All models implemented to simulate the number_fruits process must be a subtype of this type, e.g. struct MyNumber_FruitsModel <: AbstractNumber_FruitsModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractNumber_FruitsModel)
source
XPalm.AbstractNumber_SpikeletsModelType

number_spikelets process abstract model.

All models implemented to simulate the number_spikelets process must be a subtype of this type, e.g. struct MyNumber_SpikeletsModel <: AbstractNumber_SpikeletsModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractNumber_SpikeletsModel)
source
XPalm.AbstractPhyllochronModelType

phyllochron process abstract model.

All models implemented to simulate the phyllochron process must be a subtype of this type, e.g. struct MyPhyllochronModel <: AbstractPhyllochronModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractPhyllochronModel)
source
XPalm.AbstractPhytomer_CountModelType

phytomer_count process abstract model.

All models implemented to simulate the phytomer_count process must be a subtype of this type, e.g. struct MyPhytomer_CountModel <: AbstractPhytomer_CountModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractPhytomer_CountModel)
source
XPalm.AbstractPhytomer_EmissionModelType

phytomer_emission process abstract model.

All models implemented to simulate the phytomer_emission process must be a subtype of this type, e.g. struct MyPhytomer_EmissionModel <: AbstractPhytomer_EmissionModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractPhytomer_EmissionModel)
source
XPalm.AbstractPlant_AgeModelType

plant_age process abstract model.

All models implemented to simulate the plant_age process must be a subtype of this type, e.g. struct MyPlant_AgeModel <: AbstractPlant_AgeModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractPlant_AgeModel)
source
XPalm.AbstractPotential_EvapotranspirationModelType

potential_evapotranspiration process abstract model.

All models implemented to simulate the potential_evapotranspiration process must be a subtype of this type, e.g. struct MyPotential_EvapotranspirationModel <: AbstractPotential_EvapotranspirationModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractPotential_EvapotranspirationModel)
source
XPalm.AbstractReproductive_Organ_EmissionModelType

reproductive_organ_emission process abstract model.

All models implemented to simulate the reproductive_organ_emission process must be a subtype of this type, e.g. struct MyReproductive_Organ_EmissionModel <: AbstractReproductive_Organ_EmissionModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractReproductive_Organ_EmissionModel)
source
XPalm.AbstractReserve_FillingModelType

reserve_filling process abstract model.

All models implemented to simulate the reserve_filling process must be a subtype of this type, e.g. struct MyReserve_FillingModel <: AbstractReserve_FillingModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractReserve_FillingModel)
source
XPalm.AbstractRoot_GrowthModelType

root_growth process abstract model.

All models implemented to simulate the root_growth process must be a subtype of this type, e.g. struct MyRoot_GrowthModel <: AbstractRoot_GrowthModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractRoot_GrowthModel)
source
XPalm.AbstractSex_DeterminationModelType

sex_determination process abstract model.

All models implemented to simulate the sex_determination process must be a subtype of this type, e.g. struct MySex_DeterminationModel <: AbstractSex_DeterminationModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractSex_DeterminationModel)
source
XPalm.AbstractSoil_WaterModelType

soil_water process abstract model.

All models implemented to simulate the soil_water process must be a subtype of this type, e.g. struct MySoil_WaterModel <: AbstractSoil_WaterModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractSoil_WaterModel)
source
XPalm.AbstractStateModelType

state process abstract model.

All models implemented to simulate the state process must be a subtype of this type, e.g. struct MyStateModel <: AbstractStateModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractStateModel)
source
XPalm.AbstractThermal_TimeModelType

thermal_time process abstract model.

All models implemented to simulate the thermal_time process must be a subtype of this type, e.g. struct MyThermal_TimeModel <: AbstractThermal_TimeModel end.

You can list all models implementing this process using subtypes:

Examples

subtypes(AbstractThermal_TimeModel)
source
XPalm.BeerType
Beer(k)

Beer-Lambert law for light interception.

Arguments

  • k: extinction coefficient of light

Inputs

  • lai in m² m⁻².

Required meteorology data

  • Ri_PAR_f: incident flux of atmospheric radiation in the PAR, in MJ m⁻² d⁻¹.

Outputs

  • aPPFD: absorbed Photosynthetic Photon Flux Density in mol[PAR] m[soil]⁻² d⁻¹.
source
XPalm.CarbonOfferRmType
CarbonOfferRm()

A model that computes carbon offer as the carbon assimilation minus the maintenance respiration.

source
XPalm.ConstantRUEModelType
ConstantRUEModel(rue)

Computes the carbon_assimilation using a constant radiation use efficiency (rue).

Arguments

  • rue: radiation use efficiency (gC MJ⁻¹)

Inputs

  • aPPFD: the absorbed Photosynthetic Photon Flux Density in mol[PAR] m[leaf]⁻² s⁻¹.

Outputs

  • carbon_assimilation: carbon offer from photosynthesis
source
XPalm.DailyDegreeDaysType
DailyDegreeDays(TOpt1, TOpt2, TBase, TLim)
DailyDegreeDays(TOpt1=25, TOpt2=30, TBase=15, TLim=40)

Compute thermal time from daily meteo data

Arguments

  • TOpt1: starting optimal temperature for thermal time calculation (degree Celsius)
  • TOpt2: ending optimal temperature for thermal time calculation (degree Celsius)
  • TBase: Tbase temperature for thermal time calculation (degree Celsius)
  • TLim: limit temperature for thermal time calculation (degree Celsius)

Outputs

  • TEff: daily efficient temperature for plant growth (degree C days)
source
XPalm.DailyDegreeDaysSinceInitType
DailyDegreeDaysSinceInit()

Compute thermal time since organ initiation using :TEff.

Outputs

  • TT_since_init: daily efficient temperature for organ growth (degree C days)
source
XPalm.DailyPlantAgeModelType
DailyPlantAgeModel(initiation_age)

Plant age model, simply tracks the age of the plant in days.

Arguments

  • initiation_age: age of the plant at the start of the simulation (days)

Returns

  • age: age of the plant (days)
source
XPalm.DegreeDaysFTSWType
DegreeDaysFTSW(TOpt1, TOpt2, TBase, TLim, threshold_ftsw_stress)
DegreeDaysFTSW(TOpt1=25, TOpt2=30, TBase=15, TLim=40, threshold_ftsw_stress=0.3)

Compute thermal time from daily meteo data, corrected by FTSW

Arguments

  • TOpt1: starting optimal temperature for thermal time calculation (degree Celsius)
  • TOpt2: ending optimal temperature for thermal time calculation (degree Celsius)
  • TBase: Tbase temperature for thermal time calculation (degree Celsius)
  • TLim: limit temperature for thermal time calculation (degree Celsius)
  • threshold_ftsw_stress: threshold value under which we apply an FTSW stress

Inputs

  • ftsw: fraction of transpirable soil water (unitless)

Ouputs

  • TEff: daily efficient temperature for plant growth (degree C days)
  • TT_since_init: cumulated thermal time from the first day (degree C days)
source
XPalm.ET0_BPType
ET0_BP(LATITUDE,ALTITUDE)
ET0_BP(LATITUDE=0.97,ALTITUDE=50)

Compute potential evapotranspiration

Arguments

  • LATITUDE: latitude (radian)
  • ALTITUDE: altitude (m)

Inputs

  • meteo

Outputs

  • ET0: potentiam evapotranpiration (mm)
source
XPalm.FTSWType
FTSW{O}(
    ini_root_depth::T
    H_FC::T
    H_WP_Z1::T
    Z1::T
    H_WP_Z2::T
    Z2::T
    H_0::T
    KC::T
    TRESH_EVAP::T
    TRESH_FTSW_TRANSPI::T
    ini_qty_H2O_Vap::T
    ini_qty_H2O_C1::T
    ini_qty_H2O_C1minusVap::T
    ini_qty_H2O_C2::T
    ini_qty_H2O_C::T
)

Fraction of Transpirable Soil Water model.

Note that there is also a method for FTSW that takes an organ type as type, e.g. FTSW{Leaf}(ini_root_depth = 200.0).

Arguments

  • ini_root_depth: root depth at initialization (mm)
  • H_FC: Humidity at field capacity (g[H20] g[Soil])
  • H_WP_Z1: Humidity at wilting point (g[H20] g[Soil]) for the first layer
  • Z1: Thickness of the first layer (mm)
  • H_WP_Z2: Humidity at wilting point (g[H20] g[Soil]) for the second layer
  • Z2: Thickness of the second layer (mm)
  • H_0: Initial soil humidity (g[H20] g[Soil])
  • KC: cultural coefficient (unitless)
  • TRESH_EVAP: fraction of water content in the evaporative layer below which evaporation is reduced (g[H20] g[Soil])
  • TRESH_FTSW_TRANSPI: FTSW treshold below which transpiration is reduced (g[H20] g[Soil])
source
XPalm.FTSW_BPType
FTSW_BP(H_FC::Float64, H_WP_Z1::Float64,Z1::Float64,H_WP_Z2::Float64,Z2::Float64,H_0::Float64,KC::Float64,TRESH_EVAP::Float64,TRESH_FTSW_TRANSPI::Float64)

Fraction of Transpirable Soil Water model.

Arguments

  • ini_root_depth: root depth at initialization (mm)
  • H_FC: Humidity at field capacity (g[H20] g[Soil])
  • H_WP_Z1: Humidity at wilting point (g[H20] g[Soil]) for the first layer
  • Z1: Thickness of the first layer (mm)
  • H_WP_Z2: Humidity at wilting point (g[H20] g[Soil]) for the second layer
  • Z2: Thickness of the second layer (mm)
  • H_0: Initial soil humidity (g[H20] g[Soil])
  • KC: cultural coefficient (unitless)
  • TRESH_EVAP: fraction of water content in the evaporative layer below which evaporation is reduced (g[H20] g[Soil])
  • TRESH_FTSW_TRANSPI: FTSW treshold below which transpiration is reduced (g[H20] g[Soil])
source
XPalm.FemaleBiomassType

FemaleBiomass(respirationcost,respirationcostoleosynthesis) FemaleBiomass(respirationcost=1.44,respirationcostoleosynthesis=3.2)

Compute female biomass (inflo and bunch) from daily carbon allocation. Allocation to the different components of the bunch (stalk adnd fruit) is proportional to their carbon demand.

Arguments

  • respiration_cost: respiration cost (g g-1)
  • respiration_cost_oleosynthesis: respiration cost of fruits oil (g g-1)

inputs

  • carbon_allocation: carbon allocated to female inflo
  • carbon_demand_stalk: carbon demand of the stalk
  • carbon_demand_non_oil: carbon demand of non oil components of fruits
  • carbon_demand_oil: carbon demand of fruits oil
  • state: state of the inflorescence

outputs

  • biomass: total ifnlo/bunch biomass
  • biomass_stalk: stalk biomass
  • biomass_fruits: fruits biomass
source
XPalm.FemaleCarbonDemandModelType

FemaleCarbonDemandModel(lmamin, respirationcost, leafletsbiomasscontribution) FemaleCarbonDemandModel(lmamin= 80.0, respirationcost=1.44, leafletsbiomasscontribution=0.35)

Carbon demand of the female inflorescence based on the finalpotentialfruitbiomass and finalpotentialstalkbiomass

Arguments

  • respiration_cost: growth respiration cost (g g⁻¹)

-respiration_cost_oleosynthesis: -TT_flowering: -TT_harvest:

  • duration_fruit_setting: period of thermal time after flowering that determines the number of flowers in the bunch that become fruits, i.e. fruit set (degree days).

-oil_content: -fraction_period_oleosynthesis:- fraction_period_oleosynthesis: fraction of the duration between flowering and harvesting when oleosynthesis occurs -fraction_period_stalk:

  • lma_min: minimum leaf mass area (g m⁻²)

  • leaflets_biomass_contribution: contribution of the leaflet biomass to the total leaf biomass (including rachis)

Inputs

  • potential_area: potential leaf area (m2)
  • state: state of the leaf

Outputs

  • carbon_demand: daily leaf carbon demand
source
XPalm.FemaleFinalPotentialFruitsType
FemaleFinalPotentialFruits(age_mature_female, fraction_first_female)

Arguments

  • age_mature_female: age at which the palm makes bunch of mature size (days).
  • fraction_first_female: size of the first bunches on a young palm relative to the size

at maturity (dimensionless)

  • potential_fruit_number_at_maturity: potential number of fruits at maturity (number of fruits)
  • potential_fruit_weight_at_maturity: potential weight of one fruit at maturity (g)

Inputs

  • initiation_age: age at which the palm starts to make bunches (days)

Outputs

  • potential_fruits_number: potential number of fruits (number of fruits)
  • final_potential_fruit_biomass: potential biomass of fruits (g)
  • final_potential_biomass_stalk: potential biomass of stalk (g)

Examples

using PlantSimEngine
using MultiScaleTreeGraph
using XPalm 

node = Node(NodeMTG("/", "Plant", 1, 1))
pot_model = XPalm.FemaleFinalPotentialFruits(8.0 * 365, 0.3, 2000.0, 6.5, 2100.0)

m = ModelList(
    pot_model,
    status = (initiation_age = 5000.0, )
)

meteo = Atmosphere(T = 20.0, Wind = 1.0, P = 101.3, Rh = 0.65)
run!(m, meteo, PlantMeteo.Constants(), node)

m[:potential_fruits_number]
source
XPalm.GraphNodeCountType
GraphNodeCount(graph_node_count_ini=0)

Stores the number of nodes in the graph.

Arguments

  • graph_node_count_ini: the initial number of nodes in the graph.

Outputs

  • graph_node_count: the number of nodes in the graph.

Details

This model does nothing. It is just used to define the value of the graph's node count so it exists in the status of the organ.

The node cound should be updated by the models that create new organs at the time-step of organ emission.

source
XPalm.InternodeBiomassType

InternodeBiomass(respirationcost) InternodeBiomass(respirationcost=1.44)

Compute internode biomass from daily carbon allocation

Arguments

  • initial_biomass: initial biomass of the internode (g)
  • respiration_cost: repisration cost (g g-1)

Inputs

  • carbon_allocation:carbon allocated to the internode

Outputs

  • biomass: internode biomass (g)
source
XPalm.InternodeCarbonDemandModelType

InternodeCarbonDemandModel(stemapparentdensity,respirationcost) InternodeCarbonDemandModel(stemapparentdensity=3000.0,respirationcost=1.44)

Compute internode carbon demand from potential dimensions

Arguments

  • stem_apparent_density: stem apparent density (g m⁻³)
  • respiration_cost: repisration cost (g[sugar].g[carbon mass]-1)

Inputs

  • potential_height: potential height of the internode (m)
  • potential_radius: potential radius of the internode (m)

Outputs

  • potential_volume: potential volume of the internode (m³)
  • carbon_demand: daily carbon demand of the internode (g[sugar])
source
XPalm.LAIModelType

LAIModel()

Compute the leaf area index (LAI) using all leaves in the scene and the scene surface area.

Arguments

  • area: the surface area of the scene.

Inputs

  • leaf_area: a vector of all leaf area values in the scene

Outputs

  • lai: the leaf area index (m² m⁻²)
source
XPalm.LeafAreaModelType
LeafAreaModel(lma_min, leaflets_biomass_contribution, leaf_area_ini)

Leaf area from its biomass.

Arguments

  • lma_min: minimal leaf mass area (when there is no reserve in the leaf)
  • leaflets_biomass_contribution: ratio of leaflets biomass to total leaf biomass including rachis and petiole (0-1)

Inputs

  • biomass: leaf biomass (g)

Outputs

  • leaf_area: leaf area (m2)
source
XPalm.LeafCarbonDemandModelAreaType
LeafCarbonDemandModelArea(lma_min, respiration_cost, leaflets_biomass_contribution)

Carbon demand of the leaf based on the difference between the current leaf area and the potential leaf area.

This model assumes that the leaf is always trying to catch its potential growth, so leaf demand can increase more than the daily potential to alleviate any previous stress effect.

See also LeafCarbonDemandModelPotentialArea.

Arguments

  • lma_min: minimum leaf mass area (g m⁻²)
  • respiration_cost: growth respiration cost (g g⁻¹)
  • leaflets_biomass_contribution: contribution of the leaflet biomass to the total leaf biomass (including rachis)
source
XPalm.MaleBiomassType

MaleBiomass(respirationcost) MaleBiomass(respirationcost=1.44)

Compute male biomass from daily carbon allocation

Arguments

  • respiration_cost: respiration cost (g g-1)

inputs

  • carbon_allocation: carbon allocated to female inflo
  • state: state of the inflorescence

outputs

  • biomass: inflo biomass
  • litter_male: biomass of scenescent inflorescent that goes to the litter
source
XPalm.NumberFruitsType
NumberFruits(TT_flowering, duration_dev_fruits)

Determines the number of fruits on the bunch.

Arguments

  • TT_flowering: thermal time for flowering since phytomer appearence (degree days).
  • duration_fruit_setting: period of thermal time after flowering that determines the number of flowers in the bunch that become fruits, i.e. fruit set (degree days).
  • computed:

Inputs

  • carbon_offer_plant: carbon offer maintenance respiration (gC/plant).
  • potential_fruits_number: potential number of fruits (number/bunch).
  • carbon_demand_plant: carbon demand of the plant (gC/plant), used to compute the plant trophic status.
  • carbon_offer_plant: carbon offer of the plant (gC/plant), used to compute the plant trophic status.

Outputs

  • fruits_number: number of fruits (number/bunch).
source
XPalm.NumberSpikeletsType
NumberSpikelets(TT_flowering=6300.0, duration_dev_spikelets=675.0)

Determines the number of spikelets on the fruit bunch.

Arguments

  • TT_flowering: thermal time for flowering since phytomer appearence (degree days).
  • duration_dev_spikelets: period of thermal time before flowering that determines the number of spikelets on the fruit bunch (degree days).
source
XPalm.OrgansCarbonAllocationModelType

OrgansCarbonAllocationModel()

Compute the carbon to allocate to organs from photosysthesis and reserve mobilization (after maintenance respiration)

Arguments

  • cost_reserve_mobilization: carbon cost to mobilize carbon reserve from stem or leaves
source
XPalm.PalmType
Palm(;
    nsteps=1,
    initiation_age=0,
    parameters=default_parameters(),
    model_list=model_mapping(parameters, nsteps)
)

Create a new scene with one Palm plant.

Arguments

  • nsteps: number of time steps to run the simulation for (default: 1, should match the number of rows in the meteo data)
  • initiation_age: date of the first phytomer initiation (default: 0)
  • parameters: a dictionary of parameters (default: default_parameters())
  • model_list: a dictionary of models (default: model_mapping(parameters, nsteps))
source
XPalm.PalmMethod
Palm(; initiation_age=0, parameters=default_parameters())

Create a new scene with one Palm plant. The scene contains a soil, a plant, a root system, a stem, a phytomer, an internode, and a leaf.

Arguments

  • initiation_age: days elapsed since the first phytomer initiation (default: 0)
  • parameters: a dictionary of parameters (default: default_parameters())

Returns

  • a Palm object
source
XPalm.PhyllochronModelType

PhyllochronModel(agepalmmaturity,thresholdftswstress,productionspeedinitial,productionspeedmature)

Compute the phyllochron and initiate a new phytomer at every new emergence

Arguments

  • age_palm_maturity: age of the plant when maturity is establiched (days)
  • threshold_ftsw_stress:ftsw treshold below which the phyllochron is reduce
  • production_speed_initial: initial phyllochron (for seedlings) (leaf.degreeC days-1)
  • production_speed_mature: phyllochron at plant maturity (leaf.degreeC days-1)

Inputs

  • plant_age= plant age (days)
  • TEff: daily efficient temperature for plant growth (degree C days)
  • ftsw= fraction of tranpirable soil water (unitless)

Outputs

  • newPhytomerEmergence: fraction of time during two successive phytomer (at 1 the new phytomer emerge)
  • production_speed= phyllochron at the current plant age (leaf.degreeC days-1)
  • phylo_slow= coefficient of reduction of the phyllochron du to ftsw
source
XPalm.PhytomerEmissionType
PhytomerEmission(mtg; phytomer_symbol="Phytomer", internode_symbol="Internode", leaf_symbol="Leaf") <: AbstractPhytomer_EmissionModel

A PhytomerEmission model, which emits a new phytomer when called. The new phytomer is composed of an internode and a leaf, and is added as a child of the last phytomer.

Arguments

  • mtg::MultiScaleTreeGraph.Node: The multiscale tree graph of the plant.
  • phytomer_symbol::String: The symbol of the phytomer, default to "Phytomer".
  • internode_symbol::String: The symbol of the internode, default to "Internode".
  • leaf_symbol::String: The symbol of the leaf, default to "Leaf".

Inputs

  • graph_node_count::Int: The number of nodes in the graph.

No other inputs, except for the simulation object (sim_object) as the last argument to run!.

Outputs

  • last_phytomer::MultiScaleTreeGraph.Node: The last phytomer of the palm, takes its values from the struct above as its first value.
  • phytomer_count::Int: The number of phytomers in the palm.
source
XPalm.PlantLeafAreaModelType
PlantLeafAreaModel()

Sum of the leaf area at plant scale.

Inputs

  • leaf_area: a vector of leaf area (m²)

Outputs

  • plant_leaf_area: total leaf area of the plant (m²)
source
XPalm.PlantRmType
PlantRm()

Total plant maintenance respiration based on the sum of Rm.

Intputs

  • Rm_organs: a vector of maintenance respiration from all organs in the plant in gC d⁻¹

Outputs

  • Rm: the total plant maintenance respiration in gC d⁻¹
source
XPalm.PotentialAreaModelType
PotentialAreaModel(inflexion_index, slope)
PotentialAreaModel(inflexion_index=  560.0, slope=100.0)

Computes the instantaneous potential area at a given cumulative thermal time using a logistic function. In other words, it defines the development of the leaf area at the potential, i.e. without any stress. It starts around 0.0 and goes to a maximum of final_potential_area.

Arguments

  • inflexion_index: a parameter that defines the relationship between the final potential

leaf area and the inflexion point of the logistic function. The higher the final area, the longer the time to reach the inflexion point.

  • slope: the slope of the relationship at the inflexion point.

Inputs

  • final_potential_area: the final potential area when the leaf is fully developed
  • TT_since_init: the cumulated thermal time since leaf initiation

Outputs

  • potential_area: potential area of the leaf (m2)
  • maturity: maturity is true when the leaf reaches its final length
source
XPalm.RmQ10FixedNType
RmQ10FixedN(Q10, Rm_base, T_ref, P_alive, nitrogen_content)

Maintenance respiration based on a Q10 computation with fixed nitrogen values and proportion of living cells in the organs.

Arguments

  • Q10: Q10 factor (values should usually range between: 1.5 - 2.5, with 2.1 being the most common value)
  • Rm_base: Base maintenance respiration (gC gDM⁻¹ d⁻¹). Should be around 0.06.
  • T_ref: Reference temperature at which Q10 was measured (usually around 25.0°C)
  • P_alive: proportion of living cells in the organ
  • nitrogen_content: nitrogen content of the organ (gN gC⁻¹)
source
XPalm.RootGrowthFTSWType

RootGrowthFTSW(TRESHFTSWSLOWROOTS, ROOTSGROWTHDEPTH, Z1, Z2) RootGrowthFTSW(TRESHFTSWSLOWROOTS=0.2, ROOTSGROWTHDEPTH=0.3, Z1=200, Z2=2000)

Compute root growth depending on thermal time and water stress (ftsw)

Arguments

  • ini_root_depth: initial root depth (mm)
  • ROOTS_GROWTH_DEPTH: root growth in depth (mm.degreeC days-1)
  • TRESH_FTSW_SLOW_ROOTS: ftsw treshold below which roots growth is reduced (unitless [0:1])

The model as a dependency on an AbstractFTSWModel that must return a value for ftsw, and soil_depth.

source
XPalm.SceneToPlantLightPartitioningType
SceneToPlantLightPartitioning()

Partitioning from aPPFD at the scene scale to the plant scale based on the relative leaf area of the plant.

Inputs

  • aPPFD: absorbed Photosynthetic Photon Flux Density in mol[PAR] m[soil]⁻² d⁻¹ (scene scale).
  • plant_leaf_area: the target plant leaf area
  • scene_leaf_area: the total scene leaf area

Outputs

  • aPPFD: absorbed Photosynthetic Photon Flux Density in mol[PAR] plant⁻¹ s⁻¹.
source
XPalm.SexDeterminationType
SexDetermination(TT_flowering, duration_abortion, duration_sex_determination, sex_ratio_min, sex_ratio_ref, rng::AbstractRNG)
SexDetermination(TT_flowering, duration_abortion, duration_sex_determination, sex_ratio_min, sex_ratio_ref; random_seed=1)

Determines the sex of a phytomer -or rather, its bunch- based on the trophic state of the plant during a given period in thermal time.

Arguments

  • TT_flowering: thermal time for flowering since phytomer appearence (degree days).
  • duration_abortion: duration used for computing abortion rate before flowering (degree days).
  • duration_sex_determination: duration used for sex determination before the abortion period(degree days).
  • sex_ratio_min: minimum allowed threshold of the sex ratio.
  • sex_ratio_ref: reference threshold of the sex ratio, i.e. the value when the trophic status is 1 (offer=demand).
  • rng: random number generator, Random.MersenneTwister by default.
  • random_seed: random seed for the random number generator, 1 by default.

Inputs

  • carbon_offer_plant: carbon offer at the plant scale (usually after maintenance respiration) (gC/plant).
  • carbon_demand_plant: total carbon demand of the plant (gC/plant), used to compute the plant trophic status.

Outputs

  • sex: the sex of the phytomer (or bunch) ("undetermined", "Female" or "Male").
  • carbon_demand_sex_determination: carbon demand of the plant integrated over the period of sex determination (gC/plant)
  • carbon_offer_sex_determination: carbon offer of the plant integrated over the period of sex determination (gC/plant)

Note

The sex of the organ is determined at TT_flowering-duration_abortion based on the trophic_status of the plant during a period of time before this date. The hypothesis is that a trophic stress can trigger more males in the plant.

source
PlantSimEngine.run!Function
run!(object, meteo, constants = Constants())

Computes the light interception of an object using the Beer-Lambert law.

Arguments

  • ::Beer: a Beer model, from the model list (i.e. m.light_interception)
  • models: A ModelList struct holding the parameters for the model with

initialisations for lai (m² m⁻²): the leaf area index.

  • status: the status of the model, usually the model list status (i.e. m.status)
  • meteo: meteorology structure, see Atmosphere
  • constants = PlantMeteo.Constants(): physical constants. See PlantMeteo.Constants for more details

Examples

using PlantSimEngine, PlantBiophysics, PlantMeteo
m = ModelList(light_interception=Beer(0.5), status=(lai=2.0,))

meteo = Atmosphere(T=20.0, Wind=1.0, P=101.3, Rh=0.65, Ri_PAR_f=300.0)
run!(m, meteo)
m[:aPPFD]
source
PlantSimEngine.run!Function

Compute root growth

Arguments

  • m: root growth model
  • ftsw: fraction of transpirable soil water (unitless [0:1])
  • TEff: daily efficient temperature for plant growth (degree C days)

Outputs

  • root_depth: root depth (cm)
source
PlantSimEngine.run!Method
add_phytomer!(palm, initiation_age)

Add a new phytomer to the palm

Arguments

  • palm: a Palm
  • initiation_age::Dates.Date: date of initiation of the phytomer
source
XPalm.KSMethod
KS(fillRate, tresh)

Coefficient of stress.

Arguments

  • fillRate: fill level of the compartment
  • tresh: filling treshold of the compartment below which there is a reduction in the flow
source
XPalm.KS_bpMethod
KS_bp(fillRate, tresh)

Coefficient of stress.

Arguments

  • fillRate: fill level of the compartment
  • tresh: filling treshold of the compartment below which there is a reduction in the flow
source
XPalm.age_relative_valueMethod
age_relative_value(age, age_min_value, age_max_value, min_value, max_value)

Value that depends on the plant age.

Arguments

  • age: the current age of the plant
  • age_min_value: the age at which minimum value is reached (ages below this age will hage min_value)
  • age_max_value: the age at which the value is at the maximum value (ages above this age will hage max_value)
  • min_value: the value below or at age_min_value
  • max_value: the value at or above age_max_value

Examples

julia> XPalm.age_relative_value(0, 1, 10, 0.1, 0.8)
0.1
julia> XPalm.age_relative_value(5, 1, 10, 0.1, 0.8)
0.4111111111111111
julia> XPalm.age_relative_value(15, 1, 10, 0.1, 0.8)
0.8
source
XPalm.compute_compartment_sizeMethod
compute_compartment_size(m, root_depth)

Compute the size of the layers of the FTSW model.

Arguments

  • m: FTSW model
  • root_depth: depth of the root system

Returns

  • SizeC1: size of the evapotranspirable water layer in the first soil layer (mm)
  • SizeVap: size of the evaporative layer within the first layer (mm)
  • SizeC1minusVap: size of the transpirable layer within the first layer (SizeC1-SizeVap)
  • SizeC2: size of the transpirable water layer in the first soil layer (mm)
  • SizeC: size of transpirable soil water (mm) (SizeC2 + SizeC1minusVap)
source
XPalm.compute_compartment_sizeMethod
compute_compartment_size(m, root_depth)

Compute the size of the layers of the FTSW model.

Arguments

  • m: FTSW model
  • root_depth: depth of the root system

Returns

  • SizeC1: size of the evapotranspirable water layer in the first soil layer (mm)
  • SizeVap: size of the evaporative layer within the first layer (mm)
  • SizeC1minusVap: size of the transpirable layer within the first layer (SizeC1-SizeVap)
  • SizeC2: size of the transpirable water layer in the first soil layer (mm)
  • SizeC: size of transpirable soil water (mm) (SizeC2 + SizeC1minusVap)
source
XPalm.model_mappingMethod
model_mapping(p)

Defines the list of sub-models used in XPalm.

Arguments

  • p: A palm object with the parameters of the model (e.g. p = Palm()).

Returns

  • A multiscale list of models, as a dictionary of scale (keys) and list of models (values).
source
XPalm.notebookFunction
notebook(copyto::String; force::Bool)

Open an XPalm notebook or create one from a template at path, and run the notebook.

Arguments

  • path::String: The path to the notebook file. If it exists, it will be opened (unless force=true), otherwise it will be created.
  • force::Bool=false: If true, overwrite the file at path.

Example

using XPalm, Pluto
XPalm.notebook()
source
XPalm.xpalmMethod
xpalm(meteo; vars=Dict("Scene" => (:lai,)), palm=Palm(initiation_age=0, parameters=default_parameters()))
xpalm(meteo, sink; vars=Dict("Scene" => (:lai,)), palm=Palm(initiation_age=0, parameters=default_parameters()))

Run the XPalm model with the given meteo data and return the results in a DataFrame.

Arguments

  • meteo: DataFrame with the meteo data
  • sink: a Tables.jl compatible sink function to format the results, for exemple a DataFrame
  • vars: A dictionary with the outputs to be returned for each scale of simulation
  • palm: the Palm object with the parameters of the model

Returns

A simulation output, either as a dictionary of variables per scales (default) or as a Tables.jl formatted object.

Example

using XPalm, CSV, DataFrames
meteo = CSV.read(joinpath(dirname(dirname(pathof(XPalm))), "0-data/meteo.csv"), DataFrame)
df = xpalm(meteo; vars= Dict("Scene" => (:lai,)), sink=DataFrame)
source