CO2SYS

CO2SYS is a family of software programs that calculate chemical equilibria for aquatic inorganic carbon species and parameters. Their core function is to use any two of the four central inorganic carbon system parameters (pH, alkalinity, dissolved inorganic carbon, and partial pressure of carbon dioxide) to calculate various chemical properties of the system. These programs are widely used by oceanographers and limnologists to understand and predict chemical equilibria in natural waters.

History
Chemical equilibria in marine and freshwater systems were calculated according to various conventions for most of the 20th century, which led to discrepancies among laboratories' calculations and limited scientific reproducibility. CO2SYS was first published by Ernie Lewis and Doug Wallace in 1998 as a DOS-interface program written in QBasic. Subsequent developments have included several MATLAB implementations, two Microsoft Excel templates, a Python package "PyCO2SYS", and an R package inspired by CO2SYS, "seacarb". Development of the various CO2SYS programs continues as of 2021 with the addition of more chemical equilibrium parameters and compatibility with a wider range of environments, e.g. anoxic waters.

Chemical Overview
The aquatic inorganic carbon system is composed of the various ionic, dissolved, solid, and/or gaseous forms of carbon dioxide in water. These species include dissolved carbon dioxide, carbonic acid, bicarbonate anion, carbonate anion, calcium carbonate, magnesium carbonate, and others. The relative amounts of each species in a body of water depends on physical variables including temperature and salinity, as well as chemical variables like pH and gas partial pressure. Variables like alkalinity and dissolved (or total) inorganic carbon further define a mass and charge balance that constrains the total state of the system.

Given any two of the four central inorganic carbon system parameters (pH, alkalinity, dissolved inorganic carbon, partial pressure of carbon dioxide) the remainder may be derived by solving a system of equations that adhere to the principles of chemical thermodynamics.