Introduction¶
After applying Module 3 constraint to the maximum attainable yield, users can now proceed with the Module 4: Soil Constraints.
The soil constraint module in PyAEZ is implemented based on GAEZ v5 new soil evaluation framework. An algorithm update based on new soil evaluation and AWC calculation is now included in the new version 2.3.
The combination of 7 soil qualities (SQ), which are based on the soil characteristics of each soil unit, and the input level gives us a single yield reduction factor – Soil Rating, which will be applied to the remaining yield. For more details on this calculation, please refer to the GAEZ v4 Model Documentation (Fischer et al., 2021).
- SQ1 : Nutrient Availability
- SQ2 : Nutrient Retention Capacity
- SQ3 : Rooting Conditions
- SQ4 : Oxygen Availability to Roots
- SQ5 : Salinity and Sodicity Conditions
- SQ6 : Calcium Carbonate and Gypsum Conditions
- SQ7 : Workability (constraining field management).
As explained in data preparation, the execution of Module 4 requires three components: Soil map, Soil Characteristics Excel Sheet, and Edaphic Requirement Excel Sheet. Once all preparations are completed, users can start off with Module 4. The overview of Module 4 is as shown in the figure below:
Figure: Overview of Module IV: Soil Constraints

Mandatory Settings¶
Initialization of M4 Object Class Creation¶
Firstly, users requires to import M4 object class named SoilConstraints by executing the following function:
| Initializing M4 Object | |
|---|---|
Input
| Arguments | Description | Unit | Data Format |
|---|---|---|---|
| rooting_depth | Crop-specific Rooting Depth Class. Must be one of [1, 2, 3, 4, 5] | Class | Integer |
Output
| Arguments | Description | Unit | Data Format |
|---|---|---|---|
| None | - | - | - |
Importing Edaphic Rating Excel Sheet¶
After the object class declaration, the crop/LUT-specific edaphic rating excel sheets for rainfed and irrigated conditions are required to be uploaded into the object class. Both excel sheets' file formats must be in .xlsx format.
| Uploading Edaphic Rating Excel Sheet | |
|---|---|
Input
| Arguments | Description | Unit | Data Format |
|---|---|---|---|
| rain_sheet_path | Full file path of LUT/management specific edaphic requirement setting for rainfed condition | None | String (.xlsx format) |
| irr_sheet_path | Full file path of LUT/management specific edaphic requirement setting for irrigated condition | None | String (.xlsx format) |
Output
| Arguments | Description | Unit | Data Format |
|---|---|---|---|
| None | - | - | - |
Calculation of Soil Qualities (SQ)¶
This function calculates seven major soil qualitites for each soil ID based on input soil characteristics.
| Calculating SQs | |
|---|---|
Input
| Arguments | Description | Unit | Data Format |
|---|---|---|---|
| irr_or_rain | 'I' for irrigated, 'R' for rainfed to execute | - | String |
Output
| Arguments | Description | Unit | Data Format |
|---|---|---|---|
| None | - | - | - |
Calculation of Soil Ratings (SR)¶
This function calculates input/management-specfic soil ratings (SR) based on existing SQs. Before running this, users are required to execute calculateSoilQualities first.
| Calculating SR | |
|---|---|
Input
| Arguments | Description | Unit | Data Format |
|---|---|---|---|
| input_level | L for low-level input, I for intermediate-level input, H for high-input level | - | String |
Output
| Arguments | Description | Unit | Data Format |
|---|---|---|---|
| None | - | - | - |
Major Functionalities¶
Applying Soil Constraints¶
This function applies all soil-related yield reduction factors. The returned yield map is now soil-adjusted yield map.
| Applying soil constraints | |
|---|---|
Input
| Arguments | Description | Unit | Data Format |
|---|---|---|---|
| soil_map | Soil Map containing SMUs which are IDs used to match the soil ratings with the input yield. | - | 2D-NumPy Array |
| yield_in | Input yield map before applying soil reduction factors (irrigated or rainfed) | kg/ha | 2D-NumPy Array |
Output
| Arguments | Description | Unit | Data Format |
|---|---|---|---|
| soil_adj_yld | Soil adjusted yield. | same as yield_in |
2D-NumPy Array |
Soil Suitability (Fc4)¶
This function returns soil suitability map after applying the soil constraints. Soil suitability factor (fc4) ranges from 0 (Not Suitable) to 1 (Very suitable). Note that the soil suitability map reflects all the input/management settings users specified earlier in the soil ratings calculation.
| Get Fc4 | |
|---|---|
Input
| Arguments | Description | Unit | Data Format |
|---|---|---|---|
| None | - | - | - |
Output
| Arguments | Description | Unit | Data Format |
|---|---|---|---|
| fc4 | LUT/management-specific soil constraint factor (fc4) | - | 2D-NumPy Array |
| ___ |
Soil Qualities Output¶
If users wish to see the each SMU's calculated soil qualities, you can produce soil quality outputs as pandas dataframe by executing the following function. Before running this, users are required to execute calculateSoilQualities first, so that the SQs are produced based on earlier LUT/management setting.
| Visualizing SQs | |
|---|---|
Input
| Arguments | Description | Unit | Data Format |
|---|---|---|---|
| None | --- | --- | --- |
Output
| Arguments | Description | Unit | Data Format |
|---|---|---|---|
| SQ | LUT/mangement specific SQs for each SMU | - | pd.DataFrame |
Soil Ratings Output¶
If users wish to see the each SMU's calculated soil ratings, you can produce soil quality outputs as pandas dataframe by executing the following function. Before running this, users are required to execute calculateSoilRatings first, so that the SRs are produced based on earlier LUT/management setting.
| Visualizing SRs | |
|---|---|
Input
| Arguments | Description | Unit | Data Format |
|---|---|---|---|
| None | --- | --- | --- |
Output
| Arguments | Description | Unit | Data Format |
|---|---|---|---|
| SR | LUT/mangement specific SRs for each SMU | - | pd.DataFrame |