https://github.com/brews/co2syspy
A Python interpretation of CO2SYS
https://github.com/brews/co2syspy
chemistry co2 python seawater
Last synced: 4 months ago
JSON representation
A Python interpretation of CO2SYS
- Host: GitHub
- URL: https://github.com/brews/co2syspy
- Owner: brews
- License: gpl-3.0
- Created: 2018-02-08T20:09:06.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-02-04T07:27:48.000Z (over 6 years ago)
- Last Synced: 2025-06-10T04:41:36.260Z (about 1 year ago)
- Topics: chemistry, co2, python, seawater
- Language: Python
- Homepage:
- Size: 46.9 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# co2syspy
[](https://travis-ci.org/brews/co2syspy)
[](https://coveralls.io/github/brews/co2syspy?branch=coverage_fix)
A Python interpretation of CO2SYS (http://cdiac.ess-dive.lbl.gov/ftp/co2sys/).
This package is not stable, nor fully tested. It is also not very pythonic.
## Example
First, import the package:
```python
import co2sys
```
Use the old-school interface with `co2sys.CO2SYS()`. First, lets setup some variables to input:
```python
par1type = 1 # The first parameter supplied is of type "1", which is "alkalinity"
par2type = 2 # The first parameter supplied is of type "2", which is "DIC"
par3type = 3 # The first parameter supplied is of type "3", which is "pH"
presin = 4.036785269144779e3 # Pressure at input conditions
tempout = 0 # Temperature at output conditions.
presout = 0 # Pressure at output conditions.
pHscale = 1 # pH scale at which the input pH is reported ("1" means "Total Scale")
k1k2c = 4 # Choice of H2CO3 and HCO3- dissociation constants K1 and K2 ("4" means "Mehrbach refit")
kso4c = 1 # Choice of HSO4- dissociation constants KSO4 ("1" means "Dickson")
alk_s = 2.337701660156250e3
dic_s = 2.186364257812500e3
sal_s = 34.875812530517578
temp_s = 2.197510004043579
si_s = 49.758834838867188
p_s = 1.458118438720703
```
Now, take all of this and run with it:
```python
out, niceheaders = co2sys.CO2SYS(alk_s, dic_s, par1type, par2type, sal_s,
temp_s, tempout, presin, presout, si_s,
p_s, pHscale, k1k2c, kso4c)
```
Our output system variables are now held in `out` and the traditional CO2SYS "nice headers" are in `niceheaders`.
## Installation
Install `co2syspy` from `conda` with:
```bash
conda install co2syspy -c sbmalev
```
Install with `pip` using:
```bash
pip install co2syspy
```
## Support and development
* Please feel free to report bugs and issues, or view the source code on GitHub (https://github.com/brews/co2syspy).
## License
`co2syspy` is available under the Open Source GPLv3 (https://www.gnu.org/licenses).