XPalm - Growth and yield model for oil palm
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.AbortionRate
XPalm.AbstractAbortionModel
XPalm.AbstractBiomassModel
XPalm.AbstractBiomass_From_AreaModel
XPalm.AbstractBiomass_To_AreaModel
XPalm.AbstractCarbon_AllocationModel
XPalm.AbstractCarbon_AssimilationModel
XPalm.AbstractCarbon_DemandModel
XPalm.AbstractCarbon_OfferModel
XPalm.AbstractFTSWModel
XPalm.AbstractFinal_Potential_BiomassModel
XPalm.AbstractHarvestModel
XPalm.AbstractInitiation_AgeModel
XPalm.AbstractInternode_DimensionsModel
XPalm.AbstractInternode_Final_Potential_DimensionsModel
XPalm.AbstractInternode_Potential_DimensionsModel
XPalm.AbstractLai_DynamicModel
XPalm.AbstractLeaf_AreaModel
XPalm.AbstractLeaf_Final_Potential_AreaModel
XPalm.AbstractLeaf_Potential_AreaModel
XPalm.AbstractLeaf_PruningModel
XPalm.AbstractLeaf_RankModel
XPalm.AbstractLight_InterceptionModel
XPalm.AbstractMaintenance_RespirationModel
XPalm.AbstractNumber_FruitsModel
XPalm.AbstractNumber_SpikeletsModel
XPalm.AbstractPhyllochronModel
XPalm.AbstractPhytomer_CountModel
XPalm.AbstractPhytomer_EmissionModel
XPalm.AbstractPlant_AgeModel
XPalm.AbstractPotential_EvapotranspirationModel
XPalm.AbstractReproductive_Organ_EmissionModel
XPalm.AbstractReserve_FillingModel
XPalm.AbstractRoot_GrowthModel
XPalm.AbstractSex_DeterminationModel
XPalm.AbstractSoil_WaterModel
XPalm.AbstractStateModel
XPalm.AbstractThermal_TimeModel
XPalm.Beer
XPalm.CarbonOfferPhotosynthesis
XPalm.CarbonOfferRm
XPalm.ConstantRUEModel
XPalm.DailyDegreeDays
XPalm.DailyDegreeDaysSinceInit
XPalm.DailyPlantAgeModel
XPalm.DegreeDaysFTSW
XPalm.ET0_BP
XPalm.FTSW
XPalm.FTSW_BP
XPalm.FemaleBiomass
XPalm.FemaleCarbonDemandModel
XPalm.FemaleFinalPotentialFruits
XPalm.GraphNodeCount
XPalm.InternodeBiomass
XPalm.InternodeCarbonDemandModel
XPalm.LAIModel
XPalm.LeafAreaModel
XPalm.LeafCarbonDemandModelArea
XPalm.MaleBiomass
XPalm.NumberFruits
XPalm.NumberSpikelets
XPalm.OrgansCarbonAllocationModel
XPalm.Palm
XPalm.Palm
XPalm.PhyllochronModel
XPalm.PhytomerEmission
XPalm.PlantLeafAreaModel
XPalm.PlantRm
XPalm.PotentialAreaModel
XPalm.ReproductiveOrganEmission
XPalm.RmQ10FixedN
XPalm.RootGrowthFTSW
XPalm.SceneToPlantLightPartitioning
XPalm.SexDetermination
PlantSimEngine.run!
PlantSimEngine.run!
PlantSimEngine.run!
PlantSimEngine.run!
XPalm.KS
XPalm.KS_bp
XPalm.age_relative_value
XPalm.compute_compartment_size
XPalm.compute_compartment_size
XPalm.model_mapping
XPalm.notebook
XPalm.xpalm
XPalm.AbortionRate
— TypeAbortionRate(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.
XPalm.AbstractAbortionModel
— Typeabortion
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)
XPalm.AbstractBiomassModel
— Typebiomass
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)
XPalm.AbstractBiomass_From_AreaModel
— Typebiomass_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)
XPalm.AbstractBiomass_To_AreaModel
— Typebiomass_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)
XPalm.AbstractCarbon_AllocationModel
— Typecarbon_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)
XPalm.AbstractCarbon_AssimilationModel
— Typecarbon_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)
XPalm.AbstractCarbon_DemandModel
— Typecarbon_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)
XPalm.AbstractCarbon_OfferModel
— Typecarbon_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)
XPalm.AbstractFTSWModel
— TypeAbstractFTSWModel <: AbstractSoil_WaterModel
Defines a structure for soil water model that computes ftsw
as an output.
XPalm.AbstractFinal_Potential_BiomassModel
— Typefinal_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)
XPalm.AbstractHarvestModel
— Typeharvest
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)
XPalm.AbstractInitiation_AgeModel
— Typeinitiation_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)
XPalm.AbstractInternode_DimensionsModel
— Typeinternode_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)
XPalm.AbstractInternode_Final_Potential_DimensionsModel
— Typeinternode_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)
XPalm.AbstractInternode_Potential_DimensionsModel
— Typeinternode_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)
XPalm.AbstractLai_DynamicModel
— Typelai_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)
XPalm.AbstractLeaf_AreaModel
— Typeleaf_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)
XPalm.AbstractLeaf_Final_Potential_AreaModel
— Typeleaf_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)
XPalm.AbstractLeaf_Potential_AreaModel
— Typeleaf_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)
XPalm.AbstractLeaf_PruningModel
— Typeleaf_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)
XPalm.AbstractLeaf_RankModel
— Typeleaf_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)
XPalm.AbstractLight_InterceptionModel
— Typelight_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)
XPalm.AbstractMaintenance_RespirationModel
— Typemaintenance_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)
XPalm.AbstractNumber_FruitsModel
— Typenumber_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)
XPalm.AbstractNumber_SpikeletsModel
— Typenumber_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)
XPalm.AbstractPhyllochronModel
— Typephyllochron
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)
XPalm.AbstractPhytomer_CountModel
— Typephytomer_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)
XPalm.AbstractPhytomer_EmissionModel
— Typephytomer_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)
XPalm.AbstractPlant_AgeModel
— Typeplant_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)
XPalm.AbstractPotential_EvapotranspirationModel
— Typepotential_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)
XPalm.AbstractReproductive_Organ_EmissionModel
— Typereproductive_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)
XPalm.AbstractReserve_FillingModel
— Typereserve_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)
XPalm.AbstractRoot_GrowthModel
— Typeroot_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)
XPalm.AbstractSex_DeterminationModel
— Typesex_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)
XPalm.AbstractSoil_WaterModel
— Typesoil_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)
XPalm.AbstractStateModel
— Typestate
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)
XPalm.AbstractThermal_TimeModel
— Typethermal_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)
XPalm.Beer
— TypeBeer(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⁻¹.
XPalm.CarbonOfferPhotosynthesis
— TypeCarbonOfferPhotosynthesis()
A model that computes carbon offer as the carbon_assimilation
.
XPalm.CarbonOfferRm
— TypeCarbonOfferRm()
A model that computes carbon offer as the carbon assimilation minus the maintenance respiration.
XPalm.ConstantRUEModel
— TypeConstantRUEModel(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
XPalm.DailyDegreeDays
— TypeDailyDegreeDays(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)
XPalm.DailyDegreeDaysSinceInit
— TypeDailyDegreeDaysSinceInit()
Compute thermal time since organ initiation using :TEff
.
Outputs
TT_since_init
: daily efficient temperature for organ growth (degree C days)
XPalm.DailyPlantAgeModel
— TypeDailyPlantAgeModel(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)
XPalm.DegreeDaysFTSW
— TypeDegreeDaysFTSW(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)
XPalm.ET0_BP
— TypeET0_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)
XPalm.FTSW
— TypeFTSW{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 layerZ1
: Thickness of the first layer (mm)H_WP_Z2
: Humidity at wilting point (g[H20] g[Soil]) for the second layerZ2
: 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])
XPalm.FTSW_BP
— TypeFTSW_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 layerZ1
: Thickness of the first layer (mm)H_WP_Z2
: Humidity at wilting point (g[H20] g[Soil]) for the second layerZ2
: 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])
XPalm.FemaleBiomass
— TypeFemaleBiomass(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 inflocarbon_demand_stalk
: carbon demand of the stalkcarbon_demand_non_oil
: carbon demand of non oil components of fruitscarbon_demand_oil
: carbon demand of fruits oilstate
: state of the inflorescence
outputs
biomass
: total ifnlo/bunch biomassbiomass_stalk
: stalk biomassbiomass_fruits
: fruits biomass
XPalm.FemaleCarbonDemandModel
— TypeFemaleCarbonDemandModel(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
XPalm.FemaleFinalPotentialFruits
— TypeFemaleFinalPotentialFruits(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]
XPalm.GraphNodeCount
— TypeGraphNodeCount(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.
XPalm.InternodeBiomass
— TypeInternodeBiomass(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)
XPalm.InternodeCarbonDemandModel
— TypeInternodeCarbonDemandModel(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])
XPalm.LAIModel
— TypeLAIModel()
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⁻²)
XPalm.LeafAreaModel
— TypeLeafAreaModel(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)
XPalm.LeafCarbonDemandModelArea
— TypeLeafCarbonDemandModelArea(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)
XPalm.MaleBiomass
— TypeMaleBiomass(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 inflostate
: state of the inflorescence
outputs
biomass
: inflo biomasslitter_male
: biomass of scenescent inflorescent that goes to the litter
XPalm.NumberFruits
— TypeNumberFruits(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).
XPalm.NumberSpikelets
— TypeNumberSpikelets(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).
XPalm.OrgansCarbonAllocationModel
— TypeOrgansCarbonAllocationModel()
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
XPalm.Palm
— TypePalm(;
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)
)
XPalm.Palm
— MethodPalm(; 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
XPalm.PhyllochronModel
— TypePhyllochronModel(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 reduceproduction_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
XPalm.PhytomerEmission
— TypePhytomerEmission(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.
XPalm.PlantLeafAreaModel
— TypePlantLeafAreaModel()
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²)
XPalm.PlantRm
— TypePlantRm()
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⁻¹
XPalm.PotentialAreaModel
— TypePotentialAreaModel(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 developedTT_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
XPalm.ReproductiveOrganEmission
— Typeadd_reproductive_organ!(...)
Add a new reproductive organ to a phytomer.
XPalm.RmQ10FixedN
— TypeRmQ10FixedN(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 organnitrogen_content
: nitrogen content of the organ (gN gC⁻¹)
XPalm.RootGrowthFTSW
— TypeRootGrowthFTSW(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
.
XPalm.SceneToPlantLightPartitioning
— TypeSceneToPlantLightPartitioning()
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 areascene_leaf_area
: the total scene leaf area
Outputs
aPPFD
: absorbed Photosynthetic Photon Flux Density in mol[PAR] plant⁻¹ s⁻¹.
XPalm.SexDetermination
— TypeSexDetermination(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.
PlantSimEngine.run!
— Functionrun!(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
: AModelList
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, seeAtmosphere
constants = PlantMeteo.Constants()
: physical constants. SeePlantMeteo.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]
PlantSimEngine.run!
— FunctionCompute 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)
PlantSimEngine.run!
— Methodadd_phytomer!(palm, initiation_age)
Add a new phytomer to the palm
Arguments
palm
: a Palminitiation_age::Dates.Date
: date of initiation of the phytomer
PlantSimEngine.run!
— Methodadd_reproductive_organ!(...)
Add a new reproductive organ to a phytomer.
XPalm.KS
— MethodKS(fillRate, tresh)
Coefficient of stress.
Arguments
fillRate
: fill level of the compartmenttresh
: filling treshold of the compartment below which there is a reduction in the flow
XPalm.KS_bp
— MethodKS_bp(fillRate, tresh)
Coefficient of stress.
Arguments
fillRate
: fill level of the compartmenttresh
: filling treshold of the compartment below which there is a reduction in the flow
XPalm.age_relative_value
— Methodage_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 plantage_min_value
: the age at which minimum value is reached (ages below this age will hagemin_value
)age_max_value
: the age at which the value is at the maximum value (ages above this age will hagemax_value
)min_value
: the value below or atage_min_value
max_value
: the value at or aboveage_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
XPalm.compute_compartment_size
— Methodcompute_compartment_size(m, root_depth)
Compute the size of the layers of the FTSW model.
Arguments
m
: FTSW modelroot_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)
XPalm.compute_compartment_size
— Methodcompute_compartment_size(m, root_depth)
Compute the size of the layers of the FTSW model.
Arguments
m
: FTSW modelroot_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)
XPalm.model_mapping
— Methodmodel_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).
XPalm.notebook
— Functionnotebook(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 (unlessforce=true
), otherwise it will be created.force::Bool=false
: Iftrue
, overwrite the file atpath
.
Example
using XPalm, Pluto
XPalm.notebook()
XPalm.xpalm
— Methodxpalm(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 datasink
: aTables.jl
compatible sink function to format the results, for exemple aDataFrame
vars
: A dictionary with the outputs to be returned for each scale of simulationpalm
: 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)