Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate T/S/P input & output conditions. #3

Open
oscarbranson opened this issue Jun 12, 2017 · 3 comments
Open

Separate T/S/P input & output conditions. #3

oscarbranson opened this issue Jun 12, 2017 · 3 comments
Assignees
Milestone

Comments

@oscarbranson
Copy link
Owner

oscarbranson commented Jun 12, 2017

Currently, input and output conditions are the same.
It would be good to be able to separate input/output T, S, P conditions.

This should be relatively simple and inexpensive, and involve a second call to MyAMI_get_Ks and re-calculating the final speciations.
Suggest wrapping this in a separate function which takes Ks, and outputs all conditions from a single parameter combination (e.g. DIC and H for Csys).

@oscarbranson oscarbranson added this to the publication milestone Jun 14, 2017
@oscarbranson oscarbranson changed the title Separate T/S input & output conditions. Separate T/S/P input & output conditions. Jun 14, 2017
@tompc35
Copy link

tompc35 commented Jul 1, 2017

@oscarbranson I could work on implementing this, as a step toward comparing with CO2SYS. Is separate input/output needed for S? I would expect T and P to differ between lab and in situ conditions, but not S.

@oscarbranson
Copy link
Owner Author

oscarbranson commented Jul 1, 2017

Probably not in practice - but it's no extra work, so might as well add it for completeness?

Just pushed an updated cbsyst.py to the co2sys_compare branch (9110fd3), which contains my notes on this so far.

I'm also heading towards re-factoring the CBsys function, as it's rather inefficient as-is.

oscarbranson added a commit that referenced this issue Jul 2, 2017
oscarbranson added a commit that referenced this issue Jul 2, 2017
More elegant way forward for #3.
oscarbranson added a commit that referenced this issue Jul 3, 2017
Needs testing, but I think this deals with #3.
@oscarbranson
Copy link
Owner Author

oscarbranson commented Jul 3, 2017

I think I've completed this.

Just need to test. Best way of testing probably against GLODAPv2 data, which have both in-situ ('phtsinsitutp') and 25 C 0 Bar ('pht25p0') variables.

Preliminary test looks good, but there's a slight offset in the residuals:
image

Method: calculate GLODAPv2 carbon system at in-situ conditions using 'standardised' pH ('pht25p0'), DIC, Temp and P. Compare output pH to GLODAPv2 in-situ pH ('phtsinsitutp'):

import pandas as pd
import cbsyst as cb  # co2sys_compare branch

gd = pd.read_csv('./GLODAPv2_pH_DIC_ALK_subset.csv')  # obtained by running get_GLODAP_data.py
calcpH = cb.CBsys(pHtot=gd.phts25p0, DIC=gd.tco2,
                  T_in=25., P_in=0., S_in=gd.salinity,
                  TP=gd.phosphate, TSi=gd.silicate,
                  T_out=gd.temperature, P_out=gd.pressure)

Note: Can't find any sensible patterns in the residuals. Could it be caused by the methods (esp. Constants) used when GLODAPv2 converted 'pht25p0' to 'phtsinsitutp'?

Still to do:

  • Review of implementation.
  • Understand offset.
  • Fix offset?
  • Update Docstrings
  • Write unittests.
  • Test more thoroughly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants