Skip to main content

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

Project description

Erosion Induced Nutrient Loss

Version: 0.1.13
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 loss)
phosphorus_loss(value, mode) Returns estimated P loss (kg ha⁻¹) phosphorus_loss = srn.phosphorus_loss(20, Soil loss)
potassium_loss(value, mode) Returns estimated K loss (kg ha⁻¹) potassium_loss = srn.potassium_loss(10 , Run off)
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.13.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.13-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: soilrunnutri-0.1.13.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.13.tar.gz
Algorithm Hash digest
SHA256 7b10a5092b13c66c375dcde46ddd25eb9c324778e9a5103313a3df356cb86d7d
MD5 ac7de18e7e329875010b9b73f68f094a
BLAKE2b-256 50d7162956a08476880e3fb521fcf729219ee64681ea347fe5e5c257bec8b271

See more details on using hashes here.

File details

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

File metadata

  • Download URL: soilrunnutri-0.1.13-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.13-py3-none-any.whl
Algorithm Hash digest
SHA256 c0d73caf51df3c8c2fd7439da53f6e6f9b38cbf1a46345136fb7ff47de7e19e8
MD5 85a0fc1777242f4256293bbda1630104
BLAKE2b-256 fd68d15d575eb272436adecc01371caeeb7fad672f7c80fced1c57230ebee806

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