Giter Site home page Giter Site logo

palaeocarb / kgen Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 4.0 4.29 MB

Parameters for consistently calculating Ks for carbon calculation.

Home Page: https://palaeocarb.github.io/Kgen/

License: MIT License

Python 41.10% Makefile 0.70% MATLAB 25.99% R 28.81% Objective-C 3.40%

kgen's Introduction

Kgen

Coefficients for consistently calculating and pressure correcting Ks for carbon calculation.

Test Status

Language-specific packages:

Check K values - Matlab Check K values - Python Check K values - R

Language inter-comparison:

Crosscheck Methods

Development Stuff

What KGen Does

Kgen will provide K's in a consistent, stable output format from specifically defined inputs that have been checked against external reference values and across platforms. We guarantee to keep the input and output format of Kgen stable within major version number (i.e. within the 'X' of version X.y.z), so that updates will not break [your favourite carbon calculator].

What Kgen Does Not Do

Kgen is not intended to provide Ks in the correct format for [your favourite carbon calculator]. We recommend adding Kgen as an [optional] dependency, and implementing any required input/output parsing within [your favourite carbon calculator].

Talk to Us!

If you have any ideas for improving Kgen, please Open a New Issue on GitHub to discuss how it might best be implemented.

kgen's People

Contributors

oscarbranson avatar rossidae avatar dm807cam avatar

Stargazers

Tobias Augspurger avatar DouglasCoenen avatar  avatar  avatar

Watchers

 avatar  avatar DouglasCoenen avatar  avatar

kgen's Issues

Adjust K's for secular evolution of seawater calcium and magnesium

  • Cross-checking MyAIM_V2 against seacarbx LUT
  • Script to generate MyAMI LUT for use by all packages.
  • Agree on shared form of user-facing Kgen function for K calculation and adjustment.
  • Python Kgen
    • K calculation framework.
    • MyAMI direct Fcorr calculation using refactored MyAMI
    • MyAMI Fcorr approximation using polynomial function
    • User-facing master function for K calculation and adjustment
  • MATLAB Kgen
    • K calculation framework.
    • MyAMI Fcorr approximation using polynomial function
    • User-facing master function for K calculation and adjustment
  • R Kgen
    • K calculation framework.
    • MyAMI Fcorr approximation using polynomial function
    • User-facing master function for K calculation and adjustment
  • Automate testing cross-checking of different implementations.

Test Framework

Each language should have a GitHub action to test calculated K values against 'best practices' check values, and Mg and Ca correction factors against MyAMI_V1 check values.

The output of each language should be checked against the other two.

Python

  • Test against 'best practices' Ks
  • Test against MyAMI_V1 Handled in pymyami module
  • GitHub Action
  • Passing Tests

MATLAB

  • Test against 'best practices' Ks
  • (Test against MyAMI_V1 - maybe cross-comparison below is enough?)
  • GitHub Action
  • Passing Tests

R

  • Test against 'best practices' Ks
  • Test against MyAMI_V1 Directly imports pymyami, where this is already checked
  • GitHub Action
  • Passing Tests

Cross Checking

  • Calculate values in each language
  • Output to text files
  • Compare outputs of each language to the other two.
  • Passing Tests
  • Action to check that K coefficients are the same in all languages

pH Scales

What pH scale do we use?

At present all use the 'Best Practices' coefficients. This means that all are on the Total scale, except:

KS

Free Scale (corrected for seawater density). THIS IS FINE

KSi, KP1, KP2, KP3, KW

Footnote 5: "0.015 has been subtracted from the constant term in each of these expressions: (49), (52), (55) to convert—approximately—from the SWS pH scale (including HF) used by Millero (1995) to the “total” hydrogen ion scale used here."

HF

Is on the Free and Total Scale?!

pH Scales

pH_free = -log10(H_free)
pH_total = -log10(H_free + HSO4) = -log10(H_total)
pH_SWS = -log10(H_free + HSO4 + HF) = -log10(H_SWS)

Pressure Correction

Is on SWS? Maybe? What should it be?

Some of the original work by Pytkowicz is on the NBS scale.

KSi

The original Millero paper says "The values for deltaV_Si and deltaKappa_Si have been estimated from the values for boric acid". Unfortunately no values for deltaV_Si or deltaKappa_Si are in the table provided...

We're currently using 0's for K_Si pressure corrections. Is it safe to assume that 'estimated from' means we should be using table values for boric acid for Si as well?

Pymyami version checks

Add a check in Kgen for R that checks local pymyami version number against version number specified in the package and update pymyami if numbers mismatch.

Check if there is an option to specify python packages in the DESCRIPTION file as can be done for Rcpp.

GitHub Action

This is just a reminder to create a Github Action to automatically keep coefficient files synced between the main folder and the Python/Matlab/R package folders.

For R, the coefficient files must reside in "r/inst/".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.