Skip to main content

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, documentation, testing, linting, and formatting 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
# We use the _s suffix to indicate series (time-dependent) inputs.
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 (zero for simplicity)
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. (2026). Understanding the drivers of carbon–nitrogen cycle variability in CMIP6 ESMs with MAGICC CNit v2.0: Model and calibration updates. Journal of Advances in Modeling Earth Systems, 18, e2025MS005270. https://doi.org/10.1029/2025MS005270

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

Metadata

Release files for cnit 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cnit 2.2.0
File Size Uploaded Provenance Actions
cnit-2.2.0.tar.gz 76.1 kB Without provenance Details for cnit-2.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cnit 2.2.0
File Interpreter ABI Platform Actions
cnit-2.2.0-py3-none-any.whl Python 3 none any Details for cnit-2.2.0-py3-none-any.whl

Total release size: 147.0 kB

Release files / cnit-2.2.0.tar.gz

Download URL cnit-2.2.0.tar.gz
Size 76.1 kB
Tags Source
SHA-256 checksum
How to use checksums
85c62ac994c8044e89cf1c971dfb0d08ee06607bc849905e5d7cb10338656046
BLAKE2b-256 checksum
How to use checksums
dcf14e07f8d9edb5f62b78ee28e5c29665612ee89017b17a7ca4a9e2f40bfd82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.15

Release files / cnit-2.2.0-py3-none-any.whl

Download URL cnit-2.2.0-py3-none-any.whl
Size 70.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4fc5bc40348f03a846ac49e393765d718190558f13cef532c0a2473540b3d18
BLAKE2b-256 checksum
How to use checksums
da5227ecaa2bb88d959c220ccc95dabdeba0bdb7cbd0e28c3286fe82e35c5bd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.15

Security for cnit 2.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page