Skip to main content

A Python package to estimate nutrient loss based on soil erosion.

Project description

Erosion Induced Nutrient Loss

Version: 0.1.14
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

soilrunnutri-0.1.14.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

soilrunnutri-0.1.14-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file soilrunnutri-0.1.14.tar.gz.

File metadata

  • Download URL: soilrunnutri-0.1.14.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

Hashes for soilrunnutri-0.1.14.tar.gz
Algorithm Hash digest
SHA256 6b3224cd2949d56ae5c512b38b235d2b6378e71abc5bf396b55b4f603459e320
MD5 202db86e87cc097d69afe87842ffb553
BLAKE2b-256 cfa49f79c3f6d275b222a7bb82283ccc920d796f724b6323a8de16786148d004

See more details on using hashes here.

File details

Details for the file soilrunnutri-0.1.14-py3-none-any.whl.

File metadata

  • Download URL: soilrunnutri-0.1.14-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

Hashes for soilrunnutri-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 6f799da6f28093e019a9c34629383dfd0f43aeb822c9cbd51ae785a93f1247c0
MD5 bab5074190e40f1a468d6b9a55054756
BLAKE2b-256 9b4a8d216288660b54c37295f9ec975e9976862206c6f85da3f4ee3820e840d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page