A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

PyCO2SYS

Marine carbonate system calculations in Python.
https://github.com/mvdh7/pyco2sys

Category: Hydrosphere
Sub Category: Ocean Carbon and Temperature

Keywords

carbon-dioxide chemistry chemistry-solver co2sys marine-chemistry oceanography python seawater-carbonate-chemistry

Keywords from Contributors

seawater alkalinity

Last synced: 4 minutes ago
JSON representation

Repository metadata

Marine carbonate system calculations in Python

README.md

PyCO2SYS

Tests
pypi badge
Conda Version
DOI
Docs
Coverage
License: GPL v3
Code style: black

Introduction

PyCO2SYS is a Python implementation of CO2SYS, based on the MATLAB v2.0.5 but also including the updates made for MATLAB CO2SYS v3 as well as some additional related calculations. PyCO2SYS solves the full marine carbonate system from the values of any two of its parameters.

Every combination of input parameters has been tested, with differences in the results small enough to be attributable to floating point errors and iterative solver endpoint differences (i.e. negligible). See the scripts in validate to see how and check this for yourself, and their discussion in the online docs. Please let us know ASAP if you discover a discrepancy that we have not spotted!

Documentation is available online at PyCO2SYS.readthedocs.io.

There are also some usage examples that you can either download or run live in your web browser (with no Python installation required) at PyCO2SYS-examples.

Citation

A paper describing PyCO2SYS is freely available:

Humphreys, M. P., Lewis, E. R., Sharp, J. D., and Pierrot, D. (2022). PyCO2SYS v1.8: marine carbonate system calculations in Python. Geoscientific Model Development 15, 15-43. doi:10.5194/gmd-15-15-2022.

Please also specify the full version number that you used. You can find this in Python with:

import PyCO2SYS as pyco2
pyco2.hello()

As per the instructions in the the CO2SYS-MATLAB repo, you should also consider citing the original work by Lewis and Wallace (1998).

Installation

If you manage Python with conda, we recommend that you first install NumPy, pandas and xarray into the environment where PyCO2SYS is to be installed with conda.

With pip

Install from the Python Package Index:

pip install PyCO2SYS

Update an existing installation:

pip install PyCO2SYS --upgrade --no-cache-dir

With conda/mamba

Install from the conda-forge channel:

conda install PyCO2SYS -c conda-forge

Documentation

Documentation for the current release, based on the main branch, is available at PyCO2SYS.readthedocs.io and at mvdh.xyz/PyCO2SYS.

Basic use

The only function you need is pyco2.sys. To solve the marine carbonate system from two of its parameters (par1 and par2), just use:

import PyCO2SYS as pyco2
results = pyco2.sys(par1, par2, par1_type, par2_type, **kwargs)

The keys to the results dict are described in the documentation. Arguments should be provided as scalars or NumPy arrays in any mutually broadcastable combination. A large number of optional kwargs can be provided to specify everything beyond the carbonate system parameters — read the docs!.

You can also look at the examples Notebooks that you can try out without needing to install anything on your computer.

About

PyCO2SYS is maintained by Dr Matthew Humphreys at the NIOZ (Royal Netherlands Institute for Sea Research) with the support of the main developers of all previous versions of CO2SYS.

Contributions are welcome - please check the guidelines before setting to work.

License

PyCO2SYS is licensed under the GNU General Public License version 3 (GPLv3).


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 6 days ago

Total Commits: 970
Total Committers: 6
Avg Commits per committer: 161.667
Development Distribution Score (DDS): 0.044

Commits in past year: 28
Committers in past year: 1
Avg Commits per committer in past year: 28.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Matthew Humphreys m****s@i****m 927
Matthew Humphreys m****s@g****m 30
Luke Gregor l****e@g****m 5
d-sandborn d****e@g****m 4
Ben Cala 1****1 2
AJSchiller 5****r 2

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 30
Total pull requests: 55
Average time to close issues: 2 months
Average time to close pull requests: 2 days
Total issue authors: 9
Total pull request authors: 6
Average comments per issue: 1.53
Average comments per pull request: 0.16
Merged pull request: 49
Bot issues: 0
Bot pull requests: 0

Past year issues: 5
Past year pull requests: 10
Past year average time to close issues: about 10 hours
Past year average time to close pull requests: 2 days
Past year issue authors: 3
Past year pull request authors: 3
Past year average comments per issue: 1.6
Past year average comments per pull request: 0.4
Past year merged pull request: 7
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/mvdh7/pyco2sys

Top Issue Authors

  • mvdh7 (19)
  • VeckoTheGecko (2)
  • pfheiter (2)
  • uliw (2)
  • gmacgilchrist (1)
  • davidclemens (1)
  • d-sandborn (1)
  • lukegre (1)
  • rossidae (1)

Top Pull Request Authors

  • mvdh7 (40)
  • VeckoTheGecko (4)
  • bcala1 (4)
  • AJSchiller (3)
  • d-sandborn (2)
  • lukegre (2)

Top Issue Labels

  • enhancement (12)
  • reorganisation (6)
  • documentation (5)
  • intercomparison (1)
  • good first issue (1)

Top Pull Request Labels


Package metadata

pypi.org: pyco2sys

PyCO2SYS: marine carbonate system calculations in Python

  • Homepage:
  • Documentation: https://pyco2sys.readthedocs.io/
  • Licenses: GNU General Public License v3 (GPLv3)
  • Latest release: 1.8.3 (published about 1 year ago)
  • Last Synced: 2025-04-26T14:01:35.690Z (1 day ago)
  • Versions: 26
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 1,742 Last month
  • Rankings:
    • Dependent packages count: 7.306%
    • Stargazers count: 10.088%
    • Forks count: 11.462%
    • Average: 12.866%
    • Downloads: 13.399%
    • Dependent repos count: 22.077%
  • Maintainers (1)

Dependencies

docs/requirements.txt pypi
  • mkdocs-material ==7.1.4
.github/workflows/docs.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/python-package.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
pyproject.toml pypi
  • PyCO2SYS *
  • autograd *
  • numpy *

Score: 13.35004063591908