Preparing the SAMIR parameter csv file
All the SAMIR model parameters are written in a csv file. Here is an example of such a file:
ClassName |
scale_factor |
Default |
class1 |
class2 |
class3 |
class4 |
class5 |
class6 |
class7 |
ClassNumber |
1 |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
FCmax |
1000 |
1 |
|||||||
Fslope |
10000 |
1.4286 |
|||||||
Foffset |
1000 |
-0.214 |
|||||||
Kcmax |
0 |
1.8 |
|||||||
Kslope |
10000 |
2.5714 |
|||||||
Koffset |
1000 |
-0.386 |
|||||||
NDVIsol |
1 |
0.15 |
|||||||
NDVImax |
1 |
0.85 |
|||||||
Zsoil |
1 |
3000 |
|||||||
Ze |
1 |
50 |
|||||||
Init_RU |
1000 |
0.64 |
|||||||
DiffE |
1 |
1 |
|||||||
DiffR |
1 |
5 |
|||||||
REW |
1 |
0 |
|||||||
minZr |
1 |
0 |
|||||||
maxZr |
1 |
1000 |
|||||||
p |
1000 |
0.55 |
|||||||
FW |
1000 |
1 |
|||||||
Irrig_auto |
1 |
1 |
|||||||
Irrig_man |
1 |
0 |
|||||||
Kcb_stop_irrig |
1 |
0.5 |
Here is how the file is organised:
model parameters are located in the first column (row header), a row contains the values of a parameter for different classes.
the file contains three header columns: the parameter name (
ClassName
leftmost), the scale factors (scale_factor
used to manage data types in the SAMIR calculations) and the default (Default
) parameter values column.the other columns have the
ClassName
as a header and contain the different parameter values. If a cell is empty, it will take theDefault
column value.the
ClassNumber
row should not be changed for thescale_factor
andDefault
columns. For the classes, it should correspond to the integer values contained in the land cover raster.
The parameter name
This column should not be changed. It contains the names of all the necessary SAMIR parameters. It is used in the modspa_samir.py
script to generate a dictionnary containing the rasterized parameters and the scale factors. In the parameter dictionnary, the rasterized parameters have the suffix _
after the parameter name, the scale factors have the prefix s_
before the parameter name.
The scale factor
This column is used to scale the parameters to store the rasterized parameters as integer arrays (int16
), this reduces the memory usage of the model (a parameter of value 1.24
with scale factor 1000
will be stored as 1240
). Adapt the scale factor to the value of the parameter and the desired precision.
If the scale factor is equal to 0, the parameter will not be spatialized, it will stay as a scalar and the associated scale factor will be set at 1 (some parameters do not need to be spatialized).
The Default column
This column contains the default values for the parameters for which you do not have any data. All empy cells for a given parameter will be filled with the default value.
You can have different parameter files, the file to use for a simulation is set in the json configuration file. This csv table is then loaded in an object as a pandas DataFrame
attribute with the following function:
- class modspa_pixel.parameters.params_samir_class.samir_parameters(paramFile: str)[source]
Load all parameters for multiples classes in one object.
Attributes
- .table:
pd.DataFrame
pandas DataFrame
with all paramters (rows) for all classes (columns)It also contains :
a
scale_factor
column (first column) that allows to convert all parameters to integer values for reduced memory usagea
Default
column (second column) that contains default values to fill in missing values
Example of the parameter table:
scale_factor Default class1 class2 class3 ClassName ClassNumber 1 0.00 1.00 2.000 3.000 FminNDVI 1000 0.20 0.20 0.100 0.100 FmaxNDVI 1000 0.90 0.90 0.900 0.900 FminFC 1000 0.90 0.90 0.900 0.900 FmaxFC 1000 1.00 0.90 1.000 1.000 Fslope 1000 1.40 1.50 1.500 1.500 Foffset 1000 -0.10 -0.10 -0.100 -0.100 Plateau 1 70.00 70.00 70.000 70.000 KminNDVI 1000 0.10 0.10 0.100 0.100 KmaxNDVI 1000 0.90 0.90 0.900 0.900 KminKcb 1000 0.00 0.20 0.000 0.000 KmaxKcb 1000 0.98 1.00 1.100 1.100 Kslope 1000 1.60 1.60 1.600 1.600 Koffset 1000 -0.10 -0.10 -0.100 -0.100 Zsoil 1 2000.00 1600.00 1550.000 1550.000 ... ... ... ... ... ... Kcmax 1000 1.15 1.15 1.15 1.15 Fc_stop 1000 0.15 0.15 0.15 0.15 Start_date_Irr 1 0.00 0.00 0.00 0.00 p_trigger 1 0.00 0.00 0.00 0.00
- .table:
Methods
This object is used to build a dictionnary containing a raster for each parameter (spatialized parameters) in the SAMIR functions.