Skip to main content

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

Project description

Erosion Induced Nutrient Loss

Version: 0.1.16
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.16.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.16-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: soilrunnutri-0.1.16.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.16.tar.gz
Algorithm Hash digest
SHA256 5527ea3d81727c35b4e30b451838b6fdfa29882e236bddd890f5471b29ade98d
MD5 81ad8653b3976a2fe721c6b8e2930b58
BLAKE2b-256 ce413d7f29a2da5ed68ecb6d00cc09159f6eb0a3cc275808cd8bbc150391e5d4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: soilrunnutri-0.1.16-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.16-py3-none-any.whl
Algorithm Hash digest
SHA256 35289ad116583247e6390b3a5046b378ce45aacce32233375645fe2ecf289c82
MD5 f00fcf62bd1218aa83e662c04cbb40db
BLAKE2b-256 8e97de3104e0769139dadf338cc2b0291b248ed13c8b56574cff32eeca1ac16e

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