A Python package to estimate nutrient loss based on soil erosion.
Project description
Erosion Induced Nutrient Loss
Version: 0.1.15
Python Required: 3.7 or higher
License: MIT License
SoilRunoffNutri is a Python package designed to estimate erosion-induced nutrient losses using empirical piecewise linear regression models that link runoff, soil loss, and sediment-associated nutrient transport from agricultural land.
Soil loss is defined as the amount of soil removed from the land surface by rainfall and surface runoff and is expressed as tonnes per hectare (t ha⁻¹). It indicates the severity of erosion and depletion of fertile topsoil.
Runoff percentage represents the proportion of rainfall converted into surface runoff, calculated as runoff depth divided by rainfall depth multiplied by 100, and reflects the potential for erosion and nutrient transport.
The package estimates erosion-induced losses of the following nutrients, expressed in kg ha⁻¹:
- Nitrogen (N)
- Phosphorus (P)
- Potassium (K)
Erosion-induced nutrient loss refers to the quantity of plant nutrients removed from agricultural land due to soil erosion and surface runoff. Nutrients are transported either in dissolved form with runoff water or attached to eroded soil particles (sediments).
These losses are computed using empirically derived relationships based on long-term experimental datasets generated by ICAR – Indian Institute of Soil and Water Conservation (IISWC), Dehradun, aggregated across multiple agro-ecological regions of India. The resulting models provide robust applicability across diverse climatic and physiographic conditions.
Piecewise Linear Regression Framework
The nutrient loss estimation framework adopts a piecewise linear regression approach, wherein separate linear equations are applied to different ranges of soil loss or runoff rather than a single equation over the entire range. By using locally fitted equations, the model accommodates changes in erosion–nutrient coupling mechanisms such as threshold-driven soil detachment, transport limitation, and nutrient enrichment at higher erosion levels. This structure enhances model flexibility and improves prediction accuracy under varying erosion and runoff intensities.
For each predefined interval of soil loss or runoff, the relationship between nutrient loss and the driving variable is expressed as:
[ y = m x + c ]
where:
- ( y ) = nutrient loss (kg ha⁻¹)
- ( x ) = soil loss (t ha⁻¹) or runoff (%)
- ( m ) = slope of the regression line for interval
- ( c ) = intercept for interval
Statistical significance of regression parameters was assessed at the 5% level (p < 0.05), ensuring that only meaningful and stable relationships were retained. Model predictions are generated dynamically based on user-provided inputs, and the appropriate regression segment is automatically selected according to the input range.
The reliability of the output depends on the accuracy of input data. Results should be interpreted as decision-support estimates rather than exact measurements. The author shall not be responsible for any variations in the result.
Installation
Install using pip:
pip install SoilRunNutri
Quick Usage Guide
import SoilRunNutri as srn
Load default input file (inputuser.txt)
data = srn.load_input_file()
Calculate nutrient loss using main functions
nitrogen_loss = srn.nitrogen_loss(value, mode)
phosphorus_loss = srn.phosphorus_loss(value, mode)
potassium_loss = srn.potassium_loss(value, mode)
print("Nitrogen loss:", nitrogen_loss)
print("Phosphorus loss:", phosphorus_loss)
print("Potassium loss:", potassium_loss)
Functions Available
| Function | Description | Example |
|---|---|---|
nitrogen_loss(value, mode) |
Returns estimated N loss (kg ha⁻¹) | nitrogen_loss = srn.nitrogen_loss(14, "soil") |
phosphorus_loss(value, mode) |
Returns estimated P loss (kg ha⁻¹) | phosphorus_loss = srn.phosphorus_loss(20, "soil") |
potassium_loss(value, mode) |
Returns estimated K loss (kg ha⁻¹) | potassium_loss = srn.potassium_loss(10 , "runoff") |
load_input_file(file_path="inputuser.txt") |
Loads a text input file with soil loss & runoff data |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file soilrunnutri-0.1.15.tar.gz.
File metadata
- Download URL: soilrunnutri-0.1.15.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17df23e4635a3dba2a9be2774c26bf05f446415521e538b4d964ad4fa63ae06d
|
|
| MD5 |
462ca90fa6a824d4fd93d883d840ce6c
|
|
| BLAKE2b-256 |
adbac461c9bf8727eb99ac58f9cedee6b8a0259f71d51903000446dc3f4f5617
|
File details
Details for the file soilrunnutri-0.1.15-py3-none-any.whl.
File metadata
- Download URL: soilrunnutri-0.1.15-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e91e80db74e0ce8a9009ea6735d6eb276f3e5b230cd3923428704d7ab224ea9f
|
|
| MD5 |
9ac99a0ed3e5965657eb7fcd791b7412
|
|
| BLAKE2b-256 |
fbfd8ca158b27035631b68120cd6fb5678750be259c0cb391cfcda3a10053548
|