Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:oscarbranson/cbsyst into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarbranson committed Nov 12, 2024
2 parents 53db6a5 + 169c47d commit afd3c02
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions cbsyst/cbsyst.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def Csys(
pHsws=None, pHfree=None, pHNBS=None,
unit="umol", Ks=None,
pdict=None,
OmegaC=None, OmegaA=None
OmegaC=None, OmegaA=None,
MyAMI_mode="calculate"
):
"""
Calculate the carbon chemistry of seawater from a minimal parameter set.
Expand Down Expand Up @@ -54,7 +55,7 @@ def Csys(
pH, DIC, CO2, HCO3, CO3, TA, OmegaC, OmegaA : array-like
Carbon system parameters. Two of these must be provided.
BT : array-like
Total B at the input salinity used in Alkalinity calculations.
Total B at the input salinity (in umol/kg) used in Alkalinity calculations.
If missing, this is calculated as 0.000416 * Sal/35
(Uppstrom et al. 1974).
Ca, Mg : array-like
Expand Down Expand Up @@ -145,7 +146,7 @@ def Csys(
if isinstance(Ks, dict):
ps.Ks = Bunch(Ks)
else:
ps.Ks = Bunch(calc_Ks(temp_c=ps.T_in, sal=ps.S_in, p_bar=ps.P_in, magnesium=ps.Mg, calcium=ps.Ca, sulphate=ps.ST, fluorine=ps.FT))
ps.Ks = Bunch(calc_Ks(temp_c=ps.T_in, sal=ps.S_in, p_bar=ps.P_in, magnesium=ps.Mg, calcium=ps.Ca, sulphate=ps.ST, fluorine=ps.FT, MyAMI_mode=ps.MyAMI_mode))

# Calculate pH scales at input conditions (does nothing if no pH given)
ps.update(
Expand Down Expand Up @@ -279,6 +280,7 @@ def Bsys(
pHNBS=None,
Ks=None,
pdict=None,
MyAMI_mode="calculate"
):
"""
Calculate the boron chemistry of seawater from a minimal parameter set.
Expand Down Expand Up @@ -356,7 +358,7 @@ def Bsys(
ps[p] = np.nan

# Calculate Ks
ps.Ks = Bunch(calc_Ks(temp_c=ps.T_in, sal=ps.S_in, p_bar=ps.P_in, magnesium=ps.Mg, calcium=ps.Ca, sulphate=ps.ST, fluorine=ps.FT))
ps.Ks = Bunch(calc_Ks(temp_c=ps.T_in, sal=ps.S_in, p_bar=ps.P_in, magnesium=ps.Mg, calcium=ps.Ca, sulphate=ps.ST, fluorine=ps.FT, MyAMI_mode=ps.MyAMI_mode))

# Calculate pH scales (does nothing if no pH given)
ps.update(
Expand Down Expand Up @@ -447,6 +449,7 @@ def ABsys(
pHNBS=None,
Ks=None,
pdict=None,
MyAMI_mode="calculate"
):
"""
Calculate the boron isotope chemistry of seawater from a minimal parameter set.
Expand Down Expand Up @@ -516,7 +519,7 @@ def ABsys(
if isinstance(Ks, dict):
ps.Ks = Bunch(Ks)
else:
ps.Ks = Bunch(calc_Ks(temp_c=ps.T_in, sal=ps.S_in, p_bar=ps.P_in, magnesium=ps.Mg, calcium=ps.Ca, sulphate=ps.ST, fluorine=ps.FT))
ps.Ks = Bunch(calc_Ks(temp_c=ps.T_in, sal=ps.S_in, p_bar=ps.P_in, magnesium=ps.Mg, calcium=ps.Ca, sulphate=ps.ST, fluorine=ps.FT, MyAMI_mode=ps.MyAMI_mode))

# Calculate pH scales (does nothing if no pH given)
ps.update(
Expand Down Expand Up @@ -623,6 +626,7 @@ def CBsys(
Ks=None,
pdict=None,
unit="umol",
MyAMI_mode="calculate"
):
"""
Calculate carbon, boron and boron isotope chemistry of seawater from a minimal parameter set.
Expand Down Expand Up @@ -756,7 +760,7 @@ def CBsys(
if isinstance(Ks, dict):
ps.Ks = Bunch(Ks)
else:
ps.Ks = Bunch(calc_Ks(temp_c=ps.T_in, sal=ps.S_in, p_bar=ps.P_in, magnesium=ps.Mg, calcium=ps.Ca, sulphate=ps.ST, fluorine=ps.FT))
ps.Ks = Bunch(calc_Ks(temp_c=ps.T_in, sal=ps.S_in, p_bar=ps.P_in, magnesium=ps.Mg, calcium=ps.Ca, sulphate=ps.ST, fluorine=ps.FT, MyAMI_mode=ps.MyAMI_mode))

# calculate alpha
if alphaB is None:
Expand Down
Binary file modified tests/test_data/GLODAP_data/Figures/DIC_comparison.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/test_data/GLODAP_data/Figures/TA_comparison.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/test_data/GLODAP_data/Figures/pH_comparison.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit afd3c02

Please sign in to comment.