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

no_sim

straw_cereal

oilseed

soy

sunflower

corn

grassland

orchard

vineyards

broadleaf_forest

conifer_forest

heathland

ClassNumber

1

0

1

2

3

4

5

6

7

8

9

10

11

12

NDVIsol

1

0.15

0.15

0.15

NDVImax

1

0.85

0.85

0.85

FCmax

1000

1

0

1

Fslope

1000

1.4

0

1.18

1.22

Foffset

1000

-0.075

0

-0.165

-0.17

Kcbmax

1000

1.15

0

1.15

0.7

Kslope

1000

1.2

0

1.47

1.35

Koffset

1000

-0.24

0

-0.17

-0.16

Zsoil

1

2000

2000

2000

Ze

1

300

125

125

Init_RU

1000

0.87

0.5

0.5

DiffE

1

1

0

0

0

DiffR

1

5

0

0

0

REW

1

0

9

9

minZr

1

150

0

125

125

maxZr

1

600

0

1250

1450

p

1000

0.55

0

0.55

0.65

FW

1000

1

0

1

1

Irrig_auto

1

1

0

1

1

Irrig_man

1

0

0

0

0

Lame_max

1

50

Kcb_min_start_irrig

1000

0.1

0

frac_Kcb_stop_irrig

1000

0.85

0

frac_TAW

1000

0.65

0

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 the Default column value.

  • the ClassNumber row should not be changed for the scale_factor and Default 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

  1. .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 usage

    • a Default column (second column) that contains default values to fill in missing values

    Example of the parameter table:

    ClassName       scale_factor   Default   no_sim  straw_cereal  oilseed        soy  sunflower      corn
    ClassNumber                1     0.000     1.000        2.000     3.000     4.000      5.000     6.000
    NDVIsol                    1     0.150     0.150        0.150     0.150     0.150      0.150     0.150
    NDVImax                    1     0.850     0.850        0.850     0.850     0.850      0.850     0.850
    FCmax                   1000     1.000     0.000        1.000     1.000     1.000      1.000     1.000
    Fslope                  1000     1.400     0.000        1.180     1.220     1.400      1.400     1.400
    Foffset                 1000    -0.075     0.000       -0.165    -0.170    -0.075     -0.075    -0.075
    Kcmax                   1000     1.150     0.000        1.150     0.700     1.150      1.150     1.150
    Kslope                  1000     1.200     0.000        1.470     1.350     1.200      1.200     1.200
    Koffset                 1000    -0.240     0.000       -0.170    -0.160    -0.240     -0.240    -0.240
    Zsoil                      1  2000.000  2000.000     2000.000  2000.000  2000.000   2000.000  2000.000
    Ze                         1   300.000   300.000      125.000   125.000   300.000    300.000   300.000
    Init_RU                 1000     0.870     0.870        0.500     0.500     0.870      0.870     0.870
    DiffE                      1     1.000     0.000        0.000     0.000     1.000      1.000     1.000
    DiffR                      1     5.000     0.000        0.000     0.000     5.000      5.000     5.000
    REW                        1     0.000     0.000        9.000     9.000     0.000      0.000     0.000
    minZr                      1   150.000     0.000      125.000   125.000   150.000    150.000   150.000
    maxZr                      1   600.000     0.000     1250.000  1450.000   600.000    600.000   600.000
    p                       1000     0.550     0.000        0.550     0.650     0.550      0.550     0.550
    FW                      1000     1.000     0.000        1.000     1.000     1.000      1.000     1.000
    Irrig_auto                 1     1.000     0.000        1.000     1.000     1.000      1.000     1.000
    Irrig_man                  1     0.000     0.000        0.000     0.000     0.000      0.000     0.000
    Kcb_stop_irrig             1     0.500     0.000        0.500     0.500     0.500      0.500     0.500
    

Methods

__init__(paramFile: str) None[source]

Create pandas table from the csv parameter file.

Arguments

  1. paramFile: str

    path to csv parameter file

This object is used to build a dictionnary containing a raster for each parameter (spatialized parameters) in the SAMIR functions.