Recent Releases of pyco2sys
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
What's Changed
- V2 beta dev by @mvdh7 in https://github.com/mvdh7/PyCO2SYS/pull/91
Full Changelog: https://github.com/mvdh7/PyCO2SYS/compare/v2.0.0-b4...v2.0.0-b5
- Python
Published by mvdh7 7 months ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
What's Changed
- Merge pull request #88 from mvdh7/v2-beta-dev by @mvdh7 in https://github.com/mvdh7/PyCO2SYS/pull/89
- Merge for v2.0.0-b4 by @mvdh7 in https://github.com/mvdh7/PyCO2SYS/pull/90
Full Changelog: https://github.com/mvdh7/PyCO2SYS/compare/v2.0.0-b3...v2.0.0-b4
- Python
Published by mvdh7 7 months ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
What's Changed
- mg calcite stuff by @bcala1 in https://github.com/mvdh7/PyCO2SYS/pull/87
- Bug fixes by @mvdh7 in https://github.com/mvdh7/PyCO2SYS/pull/88
Full Changelog: https://github.com/mvdh7/PyCO2SYS/compare/v2.0.0-b2...v2.0.0-b3
- Python
Published by mvdh7 7 months ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
What's Changed
- Found some bugs... by @mvdh7 in https://github.com/mvdh7/PyCO2SYS/pull/84
- Fix shortcuts bug by @mvdh7 in https://github.com/mvdh7/PyCO2SYS/pull/85
Full Changelog: https://github.com/mvdh7/PyCO2SYS/compare/v2.0.0-b1...v2.0.0-b2
- Python
Published by mvdh7 9 months ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
The first public beta for PyCO2SYS v2.
What's Changed
- Dependabot, pre commit, and ruff configuration by @VeckoTheGecko in https://github.com/mvdh7/PyCO2SYS/pull/73
- added Mg calcite solubility by @bcala1 in https://github.com/mvdh7/PyCO2SYS/pull/78
- Fix solve bug for icase 0 by @mvdh7 in https://github.com/mvdh7/PyCO2SYS/pull/79
- Bug fix for .adjust() by @mvdh7 in https://github.com/mvdh7/PyCO2SYS/pull/80
- Initial validity checker added by @mvdh7 in https://github.com/mvdh7/PyCO2SYS/pull/81
- Implementation of Mg calcite solubility by @bcala1 in https://github.com/mvdh7/PyCO2SYS/pull/82
- Merge jax-uncertainty sub-branch by @mvdh7 in https://github.com/mvdh7/PyCO2SYS/pull/83
New Contributors
- @VeckoTheGecko made their first contribution in https://github.com/mvdh7/PyCO2SYS/pull/73
Full Changelog: https://github.com/mvdh7/PyCO2SYS/compare/v1.8.3.4...v2.0.0-b1
- Python
Published by mvdh7 9 months ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
Changes in v1.8.3.4
- Removed self-dependency in pyproject.toml.
- Python
Published by mvdh7 about 1 year ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
Changes in v1.8.3.3
- Numpy version restriction to <2 removed, as Autograd incompatibility has been resolved.
- Python
Published by mvdh7 over 1 year ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
Changes in v1.8.3.2
- Numpy version restricted to <2 to work around Autograd incompatibility (removal of msort function).
- Python
Published by mvdh7 over 1 year ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
Changes in v1.8.3
New features
- Added
"dlnfCO2_dT"and"dlnpCO2_dT"results, the theoretical effect of temperature on the natural log of ƒCO2 and pCO2. - Added the PLR18 parameterisation of the carbonic acid constants for sea-ice brines.
Default options
- Reverted default
opt_k_carbonicto10(i.e., LDK00) for consistency with the best practice guide.
Bug fixes
- Updated
pyco2.equilibria.p1atm.kH2CO3_NBS_MCHP73(used foropt_k_carbonicoptions6and7) to update any salinity values less than 10–16 to be 10–16, because zero salinities give a NaN for K2, which causes problems for Autograd. This should not make any practical difference, because the parameterisation is only valid for salinities above 19. - Added
opt_pressured_kCO2to results dict and incorporated it correctly into the uncertainty propagation functions.
Technical
- Updated from building with setup.py to pyproject.toml.
- Python
Published by mvdh7 about 2 years ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
Changes in v1.8.2
New features
- Added
opt_pressured_kCO2to enable pressure corrections for the fugacity factor and CO2 solubility constant following W74. These have been added to CO2SYS-MATLAB by Jon Sharp at the same time with consistent results (differences less than 10−4 %). These pressure corrections are not enabled by default, for consistency with previous versions.
Bug fixes
- Fixed logicals in
solve.core()that had meant no results were returned for parameter type combinations7, 10,7, 11,8, 10and8, 11. - Updated Autograd version for compatibility with Python 3.11.
- Python
Published by mvdh7 about 3 years ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
Changes in v1.8.1
Breaking changes
- For consistency with other settings,
buffers_modekwarg key changed toopt_buffers_modeand its values are now integers rather than strings.
New features
- Adds new
par1_type/par2_typeoptions10and11for saturation states with respect to calcite and aragonite. - Adds KSK18 parameterisation for estimating total borate from salinity.
Dependencies
- Switched to Autograd v1.4.
- Python
Published by mvdh7 almost 4 years ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
Changes in v1.8.0
New features
- Adds
pressure_atmosphereandpressure_atmosphere_outarguments, rather than assuming 1 atm total barometric pressure.
Behind-the-scenes improvements
- Adds additional constraint to the initial pH estimate for more robust results for the alkalinity-CO2 fugacity parameter pair.
- Difference derivatives for uncertainties now have a fixed step size for each argument, instead of scaling depending on arguments, for more reproducible results.
- Python
Published by mvdh7 over 4 years ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
PyCO2SYS is a Python toolbox for solving the marine carbonate system and calculating related seawater properties. Its core is a Python implementation of CO2SYS for MATLAB. Documentation is available at PyCO2SYS.readthedocs.io.
Changes in v1.7.1
Bug fixes
- Improved handling of zero-valued inputs.
- Adjusted
CO2SYS_wrapto work with latest pandas release.
- Python
Published by mvdh7 over 4 years ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
PyCO2SYS is a Python toolbox for solving the marine carbonate system and calculating related seawater properties. Its core is a Python implementation of CO2SYS for MATLAB. Documentation is available at PyCO2SYS.readthedocs.io.
Changes in v1.7.0
New features
- Can now run
pyco2.syswith no carbonate system parameter arguments provided, to just return all the equilibrium constants etc. under the specified conditions. - Can also run
pyco2.syswith only one carbonate system parameter argument. This does not solve the carbonate system, but does calculate all that can be calculated with that parameter. - Added carbonic acid constants parameterisation of SB21.
- Added bisulfate dissociation constant parameterisation of WM13/WMW14.
- Added spreadsheet-to-spreadsheet function
pyco2.ezio(with thanks to Daniel Sandborn). - Integrated uncertainty propagation into the main
pyco2.sysfunction and expanded its capabilities.
Internal updates
- Switched default first-guess pH for solving from the alkalinity-carbonate ion parameter pair at low alkalinity from 10 to 3.
- Renamed various internal functions and variables for better consistency with the Pythonic
pyco2.sysi/o syntax. - Removed the
PyCO2SYS.testmodule, instead defining the round-robin test functions it contained directly in the test suite. - Added various internal settings for testing and validation against older CO2SYS-MATLAB versions.
- Adjust aqueous CO2 calculation for better consistency with CO2SYS-MATLAB (but negligible changes in the results).
- Can now use
PyCO2SYS.hello()to find version number and credits (alias forPyCO2SYS.say_hello()). - The final component of DIC (or DIC itself) to be calculated is now always computed by difference from the known components.
- Various functions in
convertmodule renamed.
Validation
- Rigorous validation against various CO2SYS-MATLAB versions performed, as described in forthcoming PyCO2SYS manuscript (Humphreys et al., in prep.).
Bug fixes
par1,par2,par1_typeandpar2_typearguments now always get broadcasted to the maximum size, even if they are scalar.- Erroneous
"k_phosphate_*"keys corrected to"k_phosphoric_". - Override values for equilibrium constants under output conditions now assigned correctly.
- Fixed minor errors in initial pH estimates when solving from alkalinity and either DIC or [CO$_2$(aq)].
- Python
Published by mvdh7 almost 5 years ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
PyCO2SYS is a Python toolbox for solving the marine carbonate system and calculating related seawater properties. Its core is a Python implementation of CO2SYS for MATLAB. Documentation is available at PyCO2SYS.rtfd.io.
Changes in v1.6.0
Bug fixes
- Updates the total alkalinity equation to fix minor error in pH scale conversions inherited from CO2SYS-MATLAB (see related note in v1.5.0 release notes).
New inputs and outputs
- Enables inputting total molalities and equilibrium constants for up to two additional contributors to total alkalinity.
- Full chemical speciation returned in the output dict of
pyco2.sys, not just the alkalinity components as before.
New syntax
- Adds
sysas an alias forCO2SYS_ndat the top level. Recommended Python-style syntax is thus nowpyco2.sys.
- Python
Published by mvdh7 over 5 years ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
PyCO2SYS is a Python toolbox for solving the marine carbonate system and calculating related seawater properties. Its core is a Python implementation of CO2SYS for MATLAB. Documentation is available at PyCO2SYS.rtfd.io.
Changes in v1.5.1
Bug fixes
- Switched
dx-scaling function inPyCO2SYS.uncertaintiesto usenumpy.nanmedianinstead ofnumpy.median. - Fixed
PyCO2SYS.uncertainties.propagate_ndbug that prevented calculations on non-scalar arguments.
- Python
Published by mvdh7 over 5 years ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
PyCO2SYS is a Python toolbox for solving the marine carbonate system and calculating related seawater properties. Its core is a Python implementation of CO2SYS for MATLAB. Documentation is available at PyCO2SYS.rtfd.io.
Changes in v1.5.0
New top-level functions
- Adds
PyCO2SYS.CO2SYS_ndtop-level function with a more Pythonic interface and with NumPy broadcasting of $n$-dimensional inputs. - In
PyCO2SYS.CO2SYS_nd, results at "output" conditions are only calculated if output temperature or pressure is provided. - Adds corresponding
PyCO2SYS.uncertainty.forward_ndandPyCO2SYS.uncertainty.propagate_ndfunctions for uncertainty propagation.
Alternative calculations
- New alkalinity equation fixing pH scale conversion bug inherited from CO2SYS-MATLAB is available, but not yet implemented by default.
Extra arguments and results
- Solubility constants for aragonite and calcite available directly as outputs from
PyCO2SYS.CO2SYSandPyCO2SYS.CO2SYS_nd - Explicit values for the solubility constants can be given as arguments to override the default internal calculation.
Internal reorganisation
- All 2-to-3 functions in
PyCO2SYS.solve.getnow have a more consistent set of inputs. - Revised pH scale conversion functions for consistency and added tests for their internal accuracy.
- Switched preallocations to use
np.shapenotnp.sizein preparation for working with $n$-dimensional inputs. - Updated style to import the whole NumPy module as
npinstead of individual functions separately. - Converted
PyCO2SYS.engineto a sub-module.
- Python
Published by mvdh7 over 5 years ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
PyCO2SYS is a Python toolbox for solving the marine carbonate system and calculating related seawater properties. Its core is a Python implementation of CO2SYS for MATLAB. Documentation is available at PyCO2SYS.rtfd.io.
Changes in v1.4.3
Bug fixes
- Corrected missing a pH scale conversion in SLH20 option for carbonic acid dissociation. Any calculations with this option in PyCO2SYS v1.4.1 or v1.4.2 should be updated!
Validation
- Results validated against new release candidate version of CO2SYS-MATLAB v3.
New API
- New wrapper function with the same input order and default gas constant option as the new CO2SYS-MATLAB v3 available in
PyCO2SYS.api.CO2SYS_MATLABv3.
Internal reorganisation
_approxfunction inputs inPyCO2SYS.solve.deltaupdated to match the exact Autograd functions for easier switching.
- Python
Published by mvdh7 over 5 years ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
PyCO2SYS is a Python toolbox for solving the marine carbonate system and calculating related seawater properties. Its core is a Python implementation of CO2SYS for MATLAB. Documentation is available at PyCO2SYS.rtfd.io.
Changes in v1.4.2
Bug fixes
- Swapped order of
totalsandKsarguments for all functions inPyCO2SYS.solve.deltafor consistency with other modules. - Inverted the alkalinity-pH residual equations in
PyCO2SYS.solve.delta.
Reorganisation
- Broke out some parts of
PyCO2SYS.equilibria.assembleinto separate functions.
- Python
Published by mvdh7 over 5 years ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
PyCO2SYS is a Python toolbox for solving the marine carbonate system and calculating related seawater properties. Its core is a Python implementation of CO2SYS for MATLAB. Documentation is available at PyCO2SYS.rtfd.io.
Changes in v1.4.1
Extra calculation options
- Added the 2018 CODATA value for the universal gas constant R as an option for consistency with forthcoming CO2SYS-MATLAB v3. The original DOEv2 version remains default.
- Added the SLH20 equations as option
16for the carbonic acid dissociation constants.
- Python
Published by mvdh7 over 5 years ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
PyCO2SYS is a Python toolbox for solving the marine carbonate system and calculating related seawater properties. Its core is a Python implementation of CO2SYS for MATLAB. Documentation is available at PyCO2SYS.rtfd.io.
Changes in v1.4.0
New features
- Added
uncertaintymodule with functions to evaluate derivatives of PyCO2SYS outputs with respect to inputs, along with corresponding documentation. - Specific input values can optionally be provided for all total concentrations and equilibrium constants that are estimated internally from salinity, temperature and pressure.
General improvements
- Added basic sanity checking to prevent some invalid marine carbonate system parameter input values.
- Nutrient concentrations have always been set to zero internally for
K1K2CONSTANTSoptions6and8, and salinity too for8, regardless of the input values. This is now reflected in the output values of these variables in theCO2dict.
New outputs
- Substrate:inhibitor ratio (SIR) of B15, calculated with
SIratioin new modulebio. - Inputs
PAR1andPAR2. - The "Peng correction" factor.
- The fugacity factor for converting between CO2 partial pressure and fugacity.
- The activity coefficient of the H+ ion for NBS pH scale conversions.
Validation
- Calculations compare very favourably against the forthcoming CO2SYS for MATLAB v3 - see the validation documentation for a discussion of the results.
- Python
Published by mvdh7 over 5 years ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
Identical to v1.3.0, but fixing Zenodo error.
- Python
Published by mvdh7 almost 6 years ago
pyco2sys - PyCO2SYS: marine carbonate system calculations in Python
PyCO2SYS is a Python toolbox for solving the marine carbonate system and calculating related seawater properties. Its core is a Python implementation of CO2SYS for MATLAB. Documentation is online: pyco2sys.readthedocs.io.
Changes in v1.3.0
New features
- Added bicarbonate ion (type
7) and aqueous CO2 (type8) as options for known input marine carbonate system variables. - Added module
testwith functions to perform internal consistency checks onPyCO2SYS.CO2SYScalculations and compare results with those from other sources. - Added module
apiwith a wrapper forPyCO2SYS.CO2SYSto allow inputs as Pandas Series and/or Xarray DataArrays.
Improved calculations
- The Revelle factor and all other buffer factors added in v1.2 are now evaluated using automatic differentiation, which means that the effects of all equilibrating species are taken into account.
- The original, non-automatic functions that do not account for nutrient effects are still available in
buffers.explicit. - Can switch between calculation methods using new optional input
buffers_mode.
- The original, non-automatic functions that do not account for nutrient effects are still available in
- Corrected Revelle factor calculations:
- Added missing "Peng correction" to Revelle factor calculation at output conditions. Note that this correction is currently also missing from CO2SYS for MATLAB!
- Decreased DIC perturbation size for more accurate finite-difference "explicit" evaluation.
- Finite-difference calculation now references the correct DIC value.
- Implemented better initial guesses for pH in all iterative solvers in
solve.getfollowing M13 and OE15. - Switched to using exact slopes in iterative solvers in
solve.get, evaluated using Autograd in new submodulesolve.delta. - Updated entire package to be Autograd-able.
- Return NaN instead of negative DIC if an impossible pH-alkalinity combination is given as input (i.e. pH is too high).
- Return NaN where DIC and one of its components is given if the component is impossibly large.
Internal reorganisation
- Major internal reorganisation that is probably not fully captured in these notes.
- Renamed modules:
assembleis nowengine.concentrationsis nowsalts.extrais nowbuffers.explicit.
- Module
equilibrianow contains sub-modules:p1atmfor calculating constants at atmospheric pressure.pcxfor determining pressure correction factors.pressuredfor calculating constants at given pressure.
- Module
solvenow contains sub-modules:initialiseto generate first-guess estimates of pH for the TA-pH solvers.getto calculate a new system variable from various input pairs.
- Added module
solubilityfor mineral solubility calculations. - Relocated
_CaSolubilityfunction from root tosolubility.CaCO3.- Separated out its internal calculations into a set of subfunctions also in the
solubilitymodule. - Added calcium molinity
TCaas an input, instead of being evaluated internally.
- Separated out its internal calculations into a set of subfunctions also in the
- Added calcium molininty
TCa(estimated from salinity) into the mainCO2dictoutput fromPyCO2SYS.CO2SYS. - Relocated
_RevelleFactorfunction from root tobuffers.RevelleFactor. - Relocated
_FindpHOnAllScalesfunction from root toconvert.pH2allscales. - Added module
constantsfor storing values of universal physical constants. - Lists of equilibrium constants and total concentrations now passed around internally as dicts, for safety.
- Total sulfate and bisulfate dissociation constant renamed from
TSandKStoTSO4andKSO4internally to avoid confusion with sulfide species. - The as-close-as-possible MATLAB clone in
PyCO2SYS.originalno longer produces a dict but just the originalDATA,HEADERSandNICEHEADERSoutputs.
Miscellaneous
- Documentation substantially expanded and switched to using Material for MkDocs.
- Validation section added with internal consistency checks and an external comparison of PyCO2SYS calculations with CO2SYS for MATLAB.
- All code now formatted with Black (except for module
original). - Version number now reported with
PyCO2SYS.say_hello()in homage to the original MS-DOS program.
- Python
Published by mvdh7 almost 6 years ago
pyco2sys - PyCO2SYS v1.2.1: marine carbonate system calculations in Python
PyCO2SYS is a Python implementation of CO2SYS, based on the MATLAB v2.0.5 but also including the updates made for tentatively forthcoming MATLAB v1.21 as well as some additional related calculations. This software calculates the full marine carbonate system from values of any two of its variables.
Changes in v1.2.1:
- Fixed typo in ESM10 equations that had been carried through into
extra.buffers_ESM10function (thanks Jim Orr!).
- Python
Published by mvdh7 almost 6 years ago
pyco2sys - Calculate buffer factors
- Added module
extracontaining functions to calculate variables not included in CO2SYS for MATLAB: - Added all functions in
extrato theCO2dictoutput of the mainCO2SYSfunction, and documented in the Github repo README.
- Python
Published by mvdh7 almost 6 years ago
pyco2sys - Function tidy-up before integration with Calkulate
- Removed unnecessary
WhoseTBinput toassemble.equilibria.
- Python
Published by mvdh7 almost 6 years ago
pyco2sys - New inputs: carbonate ion, hydrogen sulfide and ammonium
Adding extra optional inputs for consistency with Pierrot et al.'s tentatively forthcoming MATLAB "v1.21". Continuing to reorganise subfunctions into more Pythonic modules, while avoiding changing the actual mechanics of calculations.
- Updated pH-solving iterative functions so that iteration stops separately for each row once it reaches the tolerance threshold.
- Extracted all functions for solving the CO2 system into a separate module (
solve). - Extracted other key subfunctions into module
assemble. - Added total ammonium (
NH3) and hydrogen sulfide (H2S) concentrations as optional inputs to be included in the alkalinity model. - Added optional input to choose between different equations for hydrogen fluoride dissociation constant (
KFCONSTANT). - Added functions to enable carbonate ion as an input carbonate system variable.
- Output is now only the
CO2dictdict, not the originalDATA,HEADERSandNICEHEADERS. - Eliminated all global variables throughout the entire program.
- Python
Published by mvdh7 almost 6 years ago
pyco2sys - Starting to make things more Pythonic
Extracted all equations for concentrations and equilibrium constants into functions in separate modules.
Eliminated all global variables from the
_Constantsfunction.Moved the as-close-as-possible version into module
original. The defaultfrom PyCO2SYS import CO2SYSnow imports the more Pythonic implementation.
- Python
Published by mvdh7 almost 6 years ago