[feature] Modular refactor of crop models - grassim
Summary
Crop model refactor : modular structure. The goal is to achieve modularity of crop models, with a favorable and clear development structure. The simulation structure bellow is proposed.
Current behavior
Crop models use their own structure, wrapped to return a uniform output (nyears_data
dictionary). Each structure is rigi, models are not meant to be modified beside parameters and inits.
Desired behavior
Crop modes should share a common modular structure, so that modules can be "plugged" in and out or interchanged (from a model to another).
The proposed structure is described as follows :
-
SimulationEngine
orchestrates the simulation. it loads modules, checks compatibility, order modules and runs them. -
Grid2D
is a simple spatial descriptor. The same grid2D object must be used for a simulation -
SharedState
is a registry of all current state variable, accessible and modifiable by any module. -
Module
is a class structure common to all modules. It containsrequires
andprovides
variable name lists, so that modules can be ordered and their compatibility checked before running a simulation. It has aadvance()
method that contains the actual model process, executed at runtime.
Simulation parameters and modules to load are set in a config file. A config file corresponds to a soil-plant model. Ex: Grassim, Simple, etc.
Still need to be figured out :
- how to load simulation-specific parameters ? PFT parametrs, weather data, light (Explain the expected behavior as specifically as possible, with examples, where files should be stored, details on data structure, applications, etc.)
Sources
(Give relevant sources i.e. stackoverflow posts, scientific papers, etc.)
Linked features or branches
(List relevant linked features and branches of the project, typically if this feature request is the child of another branch)