Skip to content

Regions

The Regions module handles specification of the initial state for crop areas (x0_crops) and animal numbers (x0_animals), which are used in the default optimisation goal function in the GeoDistributor and FeedDistributor modules. It also handles parameters for climate and soil properties and the maximum allowable land use per land use category (land_use; e.g. cropland).


%%{init: {
  "flowchart": {
    "nodeSpacing": 10,
    "rankSpacing": 20,
    "padding": 3,
    "curve": "linear"
  },
  "themeVariables": {
    "fontSize": "12px"
  }
}}%%


flowchart TD

  %% -------------------------
  %% Main
  %% -------------------------

  A["**Regions**"]:::mod_main

  A --> C["**.calculate()**"]:::method

  S["
  **<u>Settings</u>**
  max_land_use_from_x0 = True
  max_land_use_from_scenario_x0 = False
  "]:::settings --> A

  A --> GX0_1["**.get_x0()**"]:::method
  C --> GX0_2["**.get_x0()**"]:::method
  C --> CL["**.get_climate()**"]:::method
  C --> SL["**.get_soil()**"]:::method
  SL_T["**.classify_soil_texture()**"]:::method
  SL_PK["**.classify_soil_PK()**"]:::method
  MLU["**.calculate_max_land_use()**"]:::method

  %% -------------------------
  %% Get x0
  %% -------------------------

  P_X0_1["**Regions.par.**
x0_crops, x0_animals"]:::param --> GX0_1
  GX0_1 --> DA_X0_1["**Regions.data_attr.**
x0_crops_init, x0_animals_init"]:::data

  P_X0_2["**Regions.par.**
x0_crops, x0_animals"]:::param --> GX0_2
  GX0_2 --> DA_X0_2["**Regions.data_attr.**
x0_crops, x0_animals"]:::data

  %% -------------------------
  %% Climate
  %% -------------------------

  P_CL["**Regions.par.**
GDD5"]:::param --> CL
  CL --> DA_CL["**Regions.data_attr.**
climate"]:::data

  %% -------------------------
  %% Soil
  %% -------------------------

  P_SL["**Regions.par.**
soil_clay, soil_silt, soil_sand, soil_OM, soil_pH, soil_P_AL, soil_K_AL"]:::param --> SL
  SL --> DA_SL["**Regions.data_attr.**
soil"]:::data

  DA_SL --> SL_T
  DA_SL --> SL_PK

  SL_T --> DA_SL_T["**Regions.data_attr.**
soil_texture"]:::data

  SL_PK --> D_SL_PK["**Regions.data_attr.**
soil_P_class, soil_K_class"]:::data

  %% -------------------------
  %% Max land use
  %% -------------------------

  P_MLU["**Regions.par.**
max_land_use, max_land_use_factor"]:::param --> MLU

  DA_X0_1 --> MLU
  DA_X0_2 --> MLU

  MLU --> DA_MLU["**Regions.data_attr.**
max_land_use"]:::data


  %% -------------------------
  %% Styles
  %% -------------------------
  classDef mod_main fill:#509e2f80,stroke:#203f13,stroke-width:2px,font-size:13,color:#203f13;
  classDef mod_mgmt fill:#6ad1e380,stroke:#125560,stroke-width:2px,font-size:13,color:#125560;
  classDef mod_opt  fill:#d9d9d680,stroke:#43433e,stroke-width:2px,font-size:13,color:#43433e;

  classDef data  fill:#fee8c880,stroke:#b30000,stroke-width:0.5px,font-size:11,color:#b30000;
  classDef param fill:#d7f4ee80,stroke:#165044,stroke-width:0.5px,font-size:11,color:#165044;

  classDef method   fill:#ffffff80,stroke:#000000,stroke-width:1px,font-size:12,color:#000000;
  classDef helper   fill:#f5f5f580,stroke:#616161,stroke-width:2px,font-size:12,color:#212121;
  classDef settings fill:#ffd5f680,stroke:#aa0088,stroke-width:1px,font-size:11,color:#aa0088;
Hold "Alt" / "Option" to enable pan & zoom
View Docstring
Signature:
Regions(par: ParameterRetriever, settings: dict)

Docstring:
Class that handles region attributes such as soil and climate paramters as well as the baseline
crop areas and animal numbers (x0) and parameters to control maximum land use.

Parameters
----------
par : ParameterRetriever object
settings : dict
    Dict with  : 
    Allowed settings are:
        'max_land_use_from_x0' : bool, default True
            If True, calculate maximum land use per region as the sum of 'x0_crops'
            belonging to each land use class multiplied by the value specified through
            the parameter 'max_land_use_factor'.
            If False, use values specified with the 'max_land_use' parameter multiplied
            by 'max_land_use_factor.
        'max_land_use_from_scenario_x0' : bool, default False
            If True, use 'x0_crops' (i.e. baseline crop areas) as updated in scenarios
            to calculate maximum land use per region. Otherwise maximum land use is
            calculated from 'x0_crops' as defined in default parameters irrespective
            of scenario.
            Note: Only applies if 'max_land_use_from_x0' is True

File: CIBUSmod/main_modules/regions.py