[feature] Grassim refactoring
Summary
Make GrasSim more modular and stuctured.
Current behavior
- Working on different scenarios requires risky, time consuming and sometimes unclear hardcoding.
- Management should be a specific module interacting with growth
- Multiple management scenarios should be available
Desired behavior
Objects
- "spatialized grid" class containing the scene shape (n*m cells, dimensions), time information (n years), and common methods. Grid instance is an argument of all next classes.
- "Soil" class containing soil parameters, Water and Nitrogen variables and methods (compute_n_mineralisation(), compute_n_immobilisation(), compute_available_water(), ...)
- "Plant" class, takes PFT type and init parameters as input. Initiate PFT-specific and non-specific attributes, as well as initial BM compartments.
- "Management" class, takes cut decision type (sward height-based, date-based), amount-to-remove type (cut height-based, max exported biomass-based -> animals descritption), rotation rules (None, sward_height based, date-based), rotation paddocks (spatial division) as input. Contains methods for computing, residual BM on field depending on management types, cut mask in case of rotation
Note : PFT compositions should not vary, but this possibility is not excluded for future development. An option should be added to either average PFT parameters or disconnect the growth of each PFT. For computing time reduction, there should be only one instance of Plant with weighted average of PFT params.
Input files
- PFT parameter values (.csv)
- PFT composition (.yaml)
- Crop init : start total biomass / start biomass per PFT / start sward height ... (.yaml)
- Soil init : texture, N, Water, ... (.yaml)
- Management : cut decision type (dates/sward_height), amount removed (cut_height/Max_BM -> priority order of PFT/plant parts), animals (number, UGB conversion, consumption rate (if relevant)) (.yaml)
- variables to save (.yaml)
initialization should look like this :
grid = SpatializedGrid(pre-computed light) # scene shape, number of years (or >1year)
soil = Soil(grid)
pft_a = Plant(grig=grid, pft_type="A", inits=inits_A) # "inits" objects can be computed from PFT_composition + crop_init files
pft_b = Plant(grid=grid, pft_type="B", inits=inits_B") # disconnect PFT growth ?
crop = [pft_a, pft_b, ...]
# if pfts proportions are not variable :
plants = Plant(grid=grid, pft_type={"A":0.5, "B":0.5}, inits=inits) # pft dict generated with yaml loader
management = Management(grid=grid, parameters=management) # management dict generated with yaml loader