Last updated:
0 purchases
pyRothC 0.0.4
pyRothC
Python version of The Rothamsted carbon model (RothC) 26.3.
Documentation: Rothamsted RothC Model
Source Code: https://github.com/mishagrol/pyRothC
pyRothc is a Python version of The Rothamsted carbon model (RothC) 26.3.
RothC is a model for the turnover of organic carbon in non-waterlogged topsoil that allows for the effects of soil type, temperature, soil moisture and plant cover on the turnover process.
Inspired by SoilR version SoilR RothC
Requirements
Python 3.7+
SciPy
NumPy
Pandas
Installation
$ pip install pyRothC
Example
Below is an example of how the RothC class should be used. It needs
matplotlib library to be installed in
order to draw the graphs.
import numpy as np
import matplotlib.pyplot as plt
from pyRothC.RothC import RothC
Temp=np.array([-0.4, 0.3, 4.2, 8.3, 13.0, 15.9,18.0,
17.5, 13.4, 8.7, 3.9, 0.6])
Precip=np.array([49, 39, 44, 41, 61, 58,
71, 58, 51,48, 50, 58])
Evp=np.array([12, 18, 35, 58, 82, 90,
97, 84, 54, 31,14, 10])
soil_thick=25 #Soil thickness (organic layer topsoil), in cm
SOC=69.7 #Soil organic carbon in Mg/ha
clay=48 #Percent clay
input_carbon=2.7 #Annual C inputs to soil in Mg/ha/yr
IOM=0.049*SOC**(1.139) # Falloon et al. (1998)
rothC = RothC(temperature=Temp,
precip=Precip,
evaporation=Evp,
clay = 48,
input_carbon=input_carbon,
pE=1.0,
C0=np.array([0, 0, 0, 0, IOM]))
df = rothC.compute()
df.index = rothC.t
fig, ax = plt.subplots(1,1,figsize=(6,4))
df.plot(ax=ax)
ax.set_ylabel('C stocks (Mg/ha)')
ax.set_ylabel('Years')
plt.show()
Testing
If you need to run the test suite, first install the package in "editable" mode with the test
optional dependencies:
git clone [email protected]:mishagrol/pyRothC.git
cd pyRothC
pip install -e ".[test]"
Now you can run the tests by simply running this command:
pytest tests
Structure of the RothC model
Credits: Theoretical Ecosystem Ecology group of the Max Planck Institute for Biogeochemistry
Equations
dCdt=I(γ 1−γ 0 0 0)+(−k10000 0−k2000 a3,1a3,2−k3+a3,3a3,40 a4,1a4,2a4,3−k4+a4,40 00000)(C1 C2 C3 C4 C5)
Optional Dependencies
Matplotlib
License
This project is licensed under the terms of the CC0 1.0 Universal license.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.