Generated banner for Marine Carbonate Chemistry
Generated logo for Marine Carbonate Chemistry

Marine Carbonate Chemistry

K-DenseCommunityCreated by K-Dense Inc.

  • Skill
  • Tool integration
  • Science and research
  • MIT
  • Low risk
  • Has scripts

From the author

Solves seawater carbonate chemistry with PyCO2SYS for chemical oceanography, ocean acidification, and marine carbon-cycle research. Use for paired total alkalinity, dissolved inorganic carbon, pH, or seawater pCO2/fCO2 measurements; carbonate speciation; aragonite and calcite saturation; Revelle factors; lab-to-in-situ temperature and pressure corrections; and measurement uncertainty propagation. Applies to carbonate-system calculations, not general aqueous speciation or air-sea gas-flux estimation.
— the description by K-Dense Inc.

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured workflow for chemical oceanography and carbon-cycle research. It uses the PyCO2SYS library to convert paired seawater carbonate measurements into a comprehensive speciation table. The tool handles calculations for total alkalinity, DIC, pH, and pCO2/fCO2, while providing corrections for temperature and pressure, as well as uncertainty propagation. It is designed for researchers needing reproducible carbonate system analysis from bottle samples or shipboard measurements, ensuring that all assumptions and calculation parameters are documented in a provenance record.

What it does

  • Calculates carbonate speciation, mineral saturation states, and Revelle factors.
  • Performs temperature and pressure corrections for closed-sample carbonate systems.
  • Propagates measurement uncertainties to calculated parameters.
  • Validates input data against chemical constant ranges.
  • Generates a structured CSV result table and a JSON provenance file.
  • Supports multiple carbonic-acid constant parameterizations.

When to use it

  • When analyzing shipboard or laboratory seawater carbonate measurements.
  • To convert carbonate system parameters from laboratory conditions to in-situ ocean conditions.
  • When quantifying the impact of measurement uncertainty on carbonate system results.
  • To ensure reproducible and documented carbonate chemistry calculations for research publications.

Advantages

  • Provides a standardized, reproducible workflow for complex chemical calculations.
  • Includes automated flagging for data points outside validated constant ranges.
  • Maintains a detailed provenance record for every calculation run.
  • Supports rigorous uncertainty propagation for independent input errors.

Usage examples

“Solve the carbonate system for a set of samples with alkalinity and DIC measurements at 25C, correcting to 10C and 1000 dbar.”
The script processes the input CSV, applies the requested temperature and pressure corrections, and outputs a carbonate.csv file with the calculated speciation and a provenance.json file.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/k-dense-ai/marine-carbonate-chemistry/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip marine-carbonate-chemistry.zip -d .agents/skills

Documentation by K-Dense Inc.

Marine Carbonate Chemistry

Turn two independent seawater carbonate measurements into a reproducible speciation table, mineral saturation estimates, and a record of the calculation assumptions. Targets PyCO2SYS 1.8.3.4, tested with Python 3.13 and NumPy 2.5.3. As reviewed on 2026-10-01, this remains the stable PyPI release. The v2 documentation is for a beta with breaking changes; use the v1 documentation for this pin.

When to use

  • Analyze bottle samples, shipboard carbonate measurements, or acidification experiments.

  • Calculate total-scale pH, seawater pCO2/fCO2, carbonate ion, aragonite/calcite saturation state, or the Revelle factor from a valid measured pair.

  • Convert a system determined at laboratory conditions to specified ocean conditions.

  • Quantify how stated measurement uncertainties affect the calculated results.

This workflow concerns seawater carbonate equilibria. Freshwater, porewaters with substantial uncharacterized alkalinity, brines outside the selected calibration range, and reaction/transport models require additional chemistry and validation. Do not infer an air-sea flux or atmospheric carbon removal from a carbonate equilibrium alone.

Establish the measurement contract

Before running a solver, identify the two measured variables, their units, quality flags, and their temperature/pressure basis. Retain a separate source table containing station, depth, timestamps, methods, reference materials, and original QC codes, joined by sample ID. Do not turn missing values or rejected measurements into zero.

QuantityRequired convention
Total alkalinity (TA), DIC, nutrientsmicromol per kg seawater, not per litre or kg water
SalinityPractical Salinity, not Absolute Salinity in g/kg
TemperatureIn-situ/measurement temperature in degrees Celsius, not potential or Conservative Temperature
PressureSea pressure in dbar; surface sample is 0, not 1 atmosphere
pHDeclared total, seawater, free, or NBS scale, at the declared measurement conditions
pCO2 / fCO2Seawater partial pressure / fugacity in microatm; these are distinct quantities

TA and DIC remain constant during the solver's temperature/pressure conversion for a closed sample. pH and gas parameters change. Two inputs measured at different conditions cannot simply share one temperature value. Establish a consistent measurement basis first. Temperature correction does not repair sample changes caused by gas exchange, biology, evaporation, or mineral dissolution/precipitation.

Use two independent carbonate parameters. pCO2 plus fCO2 is not an independent pair. Three or more measurements enable an overdetermination check: solve independent pairs and compare predicted versus measured third parameters, including their uncertainty. Do not average inconsistent solutions to hide a calibration or scale mismatch.

Install

Create a dedicated environment in the user's working directory:

uv venv --python 3.13 .venv
uv pip install --python .venv/bin/python "PyCO2SYS==1.8.3.4" "numpy==2.5.3"

On Windows the environment's interpreter is .venv/Scripts/python.exe. The commands below use the POSIX interpreter path. Set the shell variable SKILL_DIR to this installed skill's directory. Keep inputs and generated outputs in the working directory.

Workflow

  1. Prepare paired measurements. Use the schema in references/input-and-results.md. Resolve units and quality flags before creating the input file. Supply phosphate and silicate explicitly; zero is an assumption to justify, not a missing-data code.

  2. Choose equilibrium constants. Read references/chemistry-decisions.md for pH scales, carbonic-acid constants, borate, saturation interpretation, and uncertainty limits. Match the study's validated convention and report it. The helper supports carbonic-acid options 10 and 15; other systems require a separately verified direct PyCO2SYS call.

  3. Solve with scripts/solve_carbonate.py. It validates the full input table, solves the pair, checks finite outputs and DIC species balance, then writes carbonate.csv and provenance.json into a new output directory.

  4. Review flags and consistency. Inspect calibration-range and gas-pressure flags, carbonate balance, measured-third-parameter residuals when available, and controls. A successful solve does not validate the sample, constants, or measurement method.

  5. Report at the intended conditions. Results ending _out describe the supplied output temperature/pressure. Unsuffixed results describe input conditions. Gas results retain the helper's uncorrected hydrostatic gas convention (see below). Include parameter pair, pH scale, units, constants, nutrient assumptions, uncertainty scope, software versions, and excluded/flagged samples with the result table.

Worked example: closed-sample condition correction

The following values are synthetic, not field observations. Save this as samples.csv in a working directory. The two samples differ only in DIC; the second represents a fixed-alkalinity CO2-addition comparison. Their measurements are at 25 C and 0 dbar; results are also requested at 10 C and 1000 dbar.

sample_id,par1,par2,salinity,temperature,pressure,total_phosphate,total_silicate,temperature_out,pressure_out,u_par1,u_par2
baseline,2300,2000,35,25,0,0,0,10,1000,2,2
added_co2,2300,2100,35,25,0,0,0,10,1000,2,2

Run from that working directory:

.venv/bin/python "$SKILL_DIR/scripts/solve_carbonate.py" samples.csv \
  --par1-type alkalinity --par2-type dic --k-carbonic 10 \
  --output-dir carbonate-results

For the baseline, the tested version gives input-condition total pH 8.045886, pCO2 396.958 microatm, and aragonite saturation 3.386201. At the specified output conditions, total pH is 8.241241 and aragonite saturation 2.605691. These rounded values are regression checks for this exact setup, not universal seawater benchmarks. With independent 2 micromol/kg uncertainties in TA and DIC only, u_pH_total is about 0.004580. This excludes equilibrium-constant and other input uncertainty. Both rows carry gas_pressure_correction_disabled_output: the output pH and mineral saturation include pressure effects, but the reported pCO2/fCO2 do not include the hydrostatic corrections to CO2 solubility and fugacity. Do not compare those gas values directly with a pressure-corrected subsurface sensor measurement.

For TA + measured pH, use --par2-type ph --ph-scale total only if the source explicitly identifies total-scale pH; replace par2 and u_par2 with the measured pH and its absolute standard uncertainty. A column named merely pH is insufficient to establish its scale.

Uncertainty and interpretation

Optional u_ input columns contain absolute one-standard-deviation uncertainties. They propagate to total pH, pCO2, and aragonite saturation at each requested condition. The helper assumes independent errors and treats unlisted inputs/constants as exact. For covariance, constants uncertainty, or strongly nonlinear uncertainty, follow the decision guide and validate a tailored propagation instead of calling these outputs a complete uncertainty budget.

Omega < 1 indicates thermodynamic undersaturation with respect to the named mineral. It does not establish a dissolution rate or an organism's response. A lower pH across unmatched samples is not by itself evidence of an anthropogenic acidification trend.

Sources and validation boundary

Repository tests exercise the pinned solver, independent-pair round trips, carbon balance, pH-scale equivalence, condition correction, Revelle-factor derivatives, gas-pressure conventions, uncertainty quadrature, CSV errors, and the worked example. The helper calls the local pyco2.sys Python API; it has no HTTP endpoints or authentication. Tests establish software behavior, not independent field-data validation; upstream's validation page also contains historical examples, including a removed pyco2.test interface.

Files

references/chemistry-decisions.md

Chemistry decisions that affect the answer

Constant sets and seawater composition

The helper requires --k-carbonic; it does not infer a constant set from the dataset. Its two supported options are:

OptionCarbonic-acid parameterizationDocumented calibration interval
10Lueker, Dickson & Keeling (2000)2 < T < 35 C; 19 < Practical Salinity < 43
15Waters, Millero & Woosley (2014)0 < T < 45 C; 0 < Practical Salinity < 45

These temperature/salinity intervals come from the PyCO2SYS v1 settings documentation. They are checks on one part of the model, not proof that all chemical assumptions are valid. Pressure corrections do not remove the need to assess constants and sample composition. Boundary values are flagged conservatively. Both measurement and output conditions are checked.

Choose the convention established for the study, and explain changes. The helper's --total-borate 1 uses Uppstrom (1974); 2 uses Lee et al. (2010). Neither automatically handles an altered boron-to-salinity ratio. Calcium, sulfate, and fluoride are inferred by the library's seawater relationships. Freshwater mixing, unusual ionic composition, and substantial organic alkalinity can violate these assumptions even if the selected carbonic-acid constants permit that salinity. Use direct composition-aware calculations when those terms matter; do not substitute salinity zero into a normal-seawater recipe.

Measurement-scale checks

Total, seawater, free, and NBS pH are not interchangeable. The scale belongs to the method and calibration record, not a numerical guess. NBS electrode readings in seawater warrant particular attention to calibration and activity conventions. PyCO2SYS accepts the declared input scale; the bundled report consistently emits total pH.

Gas measurements must specify seawater pCO2 or fCO2 and the equilibrator/measurement temperature. Atmospheric mole fraction in ppm is not a seawater pCO2 observation. The helper intentionally omits gas-flux calculations: a flux additionally requires consistent air/water gas quantities and an appropriate gas-transfer model.

For a closed sample, convert both known parameters at their actual input conditions and request output temperature/pressure. Never set laboratory-measured pH's input temperature to the ocean temperature just because the desired result is in situ. For subsurface gas observations, also establish whether the measurement includes hydrostatic gas corrections. The helper fixes opt_pressured_kCO2=0 and flags nonzero sea pressure; a fully pressure-corrected gas observation needs a verified direct call with the matching convention. This option controls solubility and fugacity, not the other pressure-dependent equilibria.

Uncertainty that matches the claim

The helper forwards explicitly supplied standard uncertainties to PyCO2SYS v1's finite-difference propagation. Its reported u values assume independent input errors. Missing u columns imply zero uncertainty for that input. Constant uncertainty, method bias, preservation error, and unmodeled solutes are absent from that budget.

For a more complete analysis:

  1. Define which measured quantities share calibration or preparation errors. TA and DIC errors may covary; also avoid treating the same temperature measurement as two independent uncertain inputs merely because input/output columns both exist.

  2. With independent errors, a tailored pyco2.sys call can use uncertainty_into and uncertainty_from, including suitable equilibrium-constant uncertainties. Upstream provides pyco2.uncertainty_OEDG18; inspect its assumptions before adopting it. Input/output constant uncertainties require deliberate treatment of their shared errors: pk_carbonic_1_both applies one shared pK perturbation to input/output conditions, whereas separate pk_carbonic_1 and pk_carbonic_1_out entries are independent. _both requires output conditions. __f specifies a fractional uncertainty (for example total_borate__f); the helper's CSV u_ columns always specify absolute uncertainties and do not expose these extensions.

  3. With covariance or appreciable nonlinearity, use a scientifically justified joint error model, propagate paired Monte Carlo draws through the solver, and check output quantiles and invalid draws. Document distributions, correlations, seed, convergence, and any truncation. This extension is not implemented by the bundled helper.

  4. Compare replicate precision and certified-reference-material results with the assumed uncertainties. Numerical propagation cannot recover unknown measurement bias.

Read the upstream uncertainty guide when implementing those extensions. Keep helper u values labeled as conditional, independent-input uncertainty, not a complete accuracy claim.

For a local linear covariance calculation, request grads_of and grads_wrt from pyco2.sys, assemble the gradient in the same variable order and units as the covariance matrix, and evaluate variance = gradient @ covariance @ gradient.T. The result keys are d_<result>__d_<argument>, for example d_pH_total__d_par1. Check symmetry and positive semidefiniteness of the covariance matrix and confirm finite-difference step sensitivity. This direct-call extension is not part of the helper's independent-input CSV workflow.

Interpret at the right level

  • Saturation state describes thermodynamics relative to a named mineral; it is not a kinetic dissolution model, coral health score, or universal biological threshold.

  • The Revelle factor describes the local relative pCO2 sensitivity to relative DIC change at constant TA and conditions. Use an explicit new equilibrium for a large perturbation rather than extending a local linear sensitivity indefinitely.

  • A controlled increase in DIC at fixed TA can illustrate a carbonate response to CO2 addition. It does not reproduce all drivers of a real ocean acidification time series.

  • Alkalinity addition scenarios require mixing, precipitation, and gas-exchange accounting before making carbon-removal claims; the closed-equilibrium solver alone establishes none of these budgets.

For methods context and solver validation, cite Humphreys et al. (2022) and the relevant constants/measurement-method references for the actual study.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Python

The author says: Requires Python 3.13 with PyCO2SYS 1.8.3.4 and NumPy. Network access is needed only to install packages or obtain external data; bundled calculations run locally without credentials.

Security

What our scanner noticed· Low risk

  • Instructions that use the network
  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
K-Dense Inc.
Publisher
K-Dense (Community)
Source
K-Dense-AI/scientific-agent-skills · skills/marine-carbonate-chemistry · commit a25cf9e
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE.md)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by K-Dense Inc. or K-Dense.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download marine-carbonate-chemistry.zip