Skip to main content

CNit: A Coupled Carbon-Nitrogen Cycle Model (Python)

Project description

CNit logo

CNit (Carbon-Nitrogen Interactions in Terrestrial ecosystems) is a process-based terrestrial biogeochemistry model that simulates coupled carbon and nitrogen cycles in terrestrial ecosystems. It is the land component of MAGICC (Model for the Assessment of Greenhouse Gas Induced Climate Change).

Features

  • Explicit carbon-nitrogen coupling with nitrogen limitation feedbacks
  • Four nitrogen pools (plant, litter, soil, mineral) and three carbon pools
  • Environmental modifiers: CO₂ fertilization, temperature, land use
  • Separation of deforestation and afforestation for CDR scenarios
  • Annual timestep with sub-annual process representation

Installation

For users:

pip install cnit

For developers:

To set up a development environment for this project, follow these steps:

  1. Create a new conda environment (replace cnit with your preferred name if desired):

    conda create --name cnit python=3.9
    
  2. Activate your environment:

    conda activate cnit
    
  3. Install all dependencies and set up the package:

    make env
    

This will install all required dependencies (including notebook, docs, and testing tools) and install the package in editable mode.

Note:
The Makefile will check that you are not in the base environment and will refuse to run if you are.


TL;DR:

conda create --name cnit python=3.9
conda activate cnit
make env

Quick Start

import numpy as np
from cnit import CNitModel, CNitModelConfig, CNitExpConfig
from cnit import Q # Local pint.quantity class for units handling

# Create model with default parameters
config = CNitModelConfig()
model = CNitModel.from_config(config)

# Set up time axis and forcing
time_axis = Q(np.arange(1850, 2101), "yr")
n_steps = len(time_axis)

# Simple forcing (constant values for illustration)
dT_s = Q(np.linspace(0, 2, n_steps), "K")  # 2°C warming
CO2_s = Q(np.linspace(280, 560, n_steps), "ppm")  # CO2 doubling

# Land use emissions (zero for simplicity)
CemsLUnet_s = Q(np.zeros(n_steps), "GtC/yr")
CemsLUgrs_s = Q(np.zeros(n_steps), "GtC/yr")

# Nitrogen inputs
NflxAD_s = Q(np.linspace(0.05, 0.15, n_steps), "GtN/yr")  # Increasing deposition
NflxFT_s = Q(np.linspace(0, 0.1, n_steps), "GtN/yr")  # Increasing fertilizer

# Nitrogen land use emissions
NemsLUnet_s = Q(np.zeros(n_steps), "GtN/yr")
NemsLUgrs_s = Q(np.zeros(n_steps), "GtN/yr")
NemsLUmin_s = Q(np.zeros(n_steps), "GtN/yr")

# Run the model
res = model.run(
    time_axis=time_axis,
    dT_s=dT_s,
    CO2_s=CO2_s,
    CemsLUnet_s=CemsLUnet_s,
    CemsLUgrs_s=CemsLUgrs_s,
    NflxAD_s=NflxAD_s,
    NflxFT_s=NflxFT_s,
    NemsLUnet_s=NemsLUnet_s,
    NemsLUgrs_s=NemsLUgrs_s,
    NemsLUmin_s=NemsLUmin_s,
)

# Access results
cveg, cveg_unit = res["CplsP"].data, res["CplsP"].units
nveg, nveg_unit = res["NplsP"].data, res["NplsP"].units
npp, npp_unit = res["CflxNPP"].data, res["CflxNPP"].units

print(f"Final plant carbon: {cveg[-1]} {cveg_unit}")
print(f"Final plant nitrogen: {nveg[-1]} {nveg_unit}")
print(f"NPP change: {npp[0]}{npp[-1]} {npp_unit}")

Documentation

The full documentation for CNit is available at https://cnit.readthedocs.io.

License

BSD 3-Clause License. See LICENSE for details.

Copyright (c) 2026, Gang Tang and contributors.

Authors and Contributors

Author, Developer, and Maintainer:
Gang Tang

Contributors:

Citation

If you use CNit in your research, please cite:

  • Tang, G., Nicholls, Z., Norton, A., Zaehle, S., and Meinshausen, M.: Synthesizing global carbon–nitrogen coupling effects – the MAGICC coupled carbon–nitrogen cycle model v1.0, Geosci. Model Dev., 18, 2193–2230, https://doi.org/10.5194/gmd-18-2193-2025, 2025.

  • Tang, G., Zaehle, S., Nicholls, Z., Norton, A., Ziehn, T., & Meinshausen, M. Understanding the Drivers of Carbon-Nitrogen Cycle Variability in CMIP6 ESMs with MAGICC CNit v2.0: Model and Calibration Updates. ESS Open Archive. June 16, 2025. https://doi.org/10.22541/essoar.175008280.09297369/v1 [accepted by Journal of Advances in Modeling Earth Systems (JAMES)]

Related Projects

MAGICC - Model for the Assessment of Greenhouse Gas Induced Climate Change,

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

cnit-2.1.0.tar.gz (69.5 kB view details)

Uploaded Source

Built Distribution

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

cnit-2.1.0-py3-none-any.whl (69.7 kB view details)

Uploaded Python 3

File details

Details for the file cnit-2.1.0.tar.gz.

File metadata

  • Download URL: cnit-2.1.0.tar.gz
  • Upload date:
  • Size: 69.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.15

File hashes

Hashes for cnit-2.1.0.tar.gz
Algorithm Hash digest
SHA256 237b869078612c3be89d410e931e6a9f761c3336e2cb5ca2ee85170cbacbc730
MD5 12b89b03a6dfc9e45495aaf50b3aa541
BLAKE2b-256 0280f50e266cc70c57caddadfbeec35c09c3f3dba49e798e1f5735f1a6a28ac2

See more details on using hashes here.

File details

Details for the file cnit-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: cnit-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 69.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.15

File hashes

Hashes for cnit-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 353f882d6ad1c4b78122a2c37efbe7ca15a2cc199d18483f05685b1aa2059448
MD5 aad796d9e9b0b8787b6c1472c3a3f6f6
BLAKE2b-256 53d79958774404199ab5efb20b2af4f44bb830de46e3d39aab2042906fdc687c

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