Based on CO2SYSExample2.m* for MATLAB by Steven van Heuven.*
A sample is measured in the lab to have a pH of 7.8 on the Total scale at 25 °C under atmospheric pressure.
What would its pH have been in situ in the ocean: at 2 °C and 4000 dbar pressure (roughly 4000 m depth) on the Seawater scale?
Additional properties:
The first step is to define the input and output conditions that we want to use with PyCO2SYS. In this case, we only need a single value for every variable:
# Define input and output conditions
kwargs = dict(
par1_type = 1, # The first parameter supplied is of type "1", which means "alkalinity"
par1 = 2400, # value of the first parameter
par2_type = 3, # The second parameter supplied is of type "3", which means "pH"
par2 = 7.8, # value of the second parameter
salinity = 35, # Salinity of the sample
temperature = 25, # Temperature at input conditions
temperature_out = 2, # Temperature at output conditions
pressure = 0, # Pressure at input conditions
pressure_out = 4000, # Pressure at output conditions
total_silicate = 50, # Concentration of silicate in the sample (in umol/kg)
total_phosphate = 2, # Concentration of phosphate in the sample (in umol/kg)
opt_pH_scale = 1, # pH scale at which the input pH is reported ("1" means "Total Scale")
opt_k_carbonic = 4, # Choice of H2CO3 and HCO3- dissociation constants K1 and K2 ("4" means "Mehrbach refit")
opt_k_bisulfate = 1, # Choice of HSO4- dissociation constant KSO4 ("1" means "Dickson")
opt_total_borate = 1, # Choice of boron:sal ("1" means "Uppstrom")
)
print('Conditions have been defined!')
Conditions have been defined!
Next, we run PyCO2SYS to solve the marine carbonate system under the input and output conditions and calculate related variables:
# Import PyCO2SYS
import PyCO2SYS as pyco2
# Run PyCO2SYS
results = pyco2.sys(**kwargs)
# Extract and print out the result
pH_insitu_SWS = results['pH_sws_out']
print('The in situ pH on the Seawater scale was: {:.3f}'.format(pH_insitu_SWS))
The in situ pH on the Seawater scale was: 7.990
See the documentation for more detailed information about the arguments and results of PyCO2SYS.