Skip to content

PalmStudio/XPalm.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XPalm - Growth and yield model for oil palm

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

Overview

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)

!!! note You need to install the CSV and DataFrames packages to run the example above. You can install them by running ] add CSV DataFrames.

We can also run the model with a custom configuration file for the parameter values. The configuration file may be in any format that can be parsed into a dictionary, such as JSON, YAML or TOML.

For example, to run the model with a JSON configuration file:

using JSON # You first need to install the JSON package by running `] add JSON`
params = open("examples/xpalm_parameters.json", "r") do io
    JSON.parse(io; dicttype=Dict{Symbol,Any}, inttype=Int64)
end
p = XPalm.Palm(parameters=params)
df = xpalm(meteo; palm=p, vars=Dict("Scene" => (:lai,)), sink=DataFrame)

Or with a YAML file:

using YAML # You first need to install the YAML package by running `] add YAML`
params = YAML.load_file(joinpath(dirname(dirname(pathof(XPalm))), "examples/xpalm_parameters.yml"), dicttype=Dict{Symbol,Any})
df = xpalm(meteo; palm=XPalm.Palm(parameters=params), vars=Dict("Scene" => (:lai,)), sink=DataFrame)

!!! note The configuration file must contain all the parameters required by the model. Template files are available from the examples folder.

Funding

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

To do

  • Manage the case when photosynthesis + reserves are not enough for maintenance respiration: e.g. abortions?
  • Add variable that tells us how far we are from the demand, i.e. (demand - allocation)
  • Test difference between LeafCarbonDemandModelArea and LeafCarbonDemandModelPotentialArea. The first assumes that the leaf can always increase its demand more than the potential to catch back any delay in growth induced by previous stress. The second assumes that the potential daily increment only follows the daily potential curve, and that any lost demand induced by stress will be lost demand.
  • There can still be some carbon offer at the end of the day, where do we put it?
  • Increase the new internode size when the reserves are full?
  • Check the carbon balance (add it as a variable?)
  • In carbon allocation, put again reserve as needed input. We had to remove it because PSE detects a cyclic dependency with reserve filling. This is ok to remove because carbon allocation needs the value from the day before.
  • calibration of 'final_potential_biomass' check on ECOPALM data the maximum number of furit and maximal individual fruit
  • Add harvest management: remove fruits, remove leaves
  • Compute the trophic status of the phytomer and females as a proper process (see number_fruits + sex_determination)
  • Add litter (when leaves are removed) + male inflorescences
  • Add peduncle carbon demand and biomass for the female
  • Review how maintenance respiration is computed (add Male and Female)