Skip to content

Adjust conditions

The adjust method can be used to adjust a CO2System to a different set of temperature and/or pressure conditions. How the adjustment is done depends on how many core carbonate system parameters are known.

Two parameters known

import PyCO2SYS as pyco2

# Set up the initial CO2System (e.g. under lab conditions for pH)
co2s_lab = pyco2.sys(dic=2100, pH=8.1, temperature=25, pressure=0, salinity=32)

# Adjust to a different temperature and pressure (e.g. in situ conditions)
co2s_insitu = co2s_lab.adjust(temperature=10.5, pressure=1500)

# Solve for and return fCO2 under the lab and in situ conditions
fCO2_lab = co2s_lab["fCO2"]
fCO2_insitu = co2s_insitu["fCO2"]

Both co2s_lab and co2s_insitu are fully functional and independent CO2Systems.

Allowed kwargs for adjust with two known parameters

  • temperature: the temperature to adjust to in °C.
  • pressure: the hydrostatic pressure to adjust to in dbar.

If either temperature or pressure is not provided or None, then the

If the original co2s was set up with the data kwarg from a pandas DataFrame or xarray Dataset, then the temperature and pressure provided to adjust can be pandas Seriess or xarray DataArrays, as long as their index or dimensions are consistent with the original data.

Any other system properties (e.g. salinity, total salt contents, optional settings) must be defined when creating the original, unadjusted CO2System. They cannot be added in during the adjust step.

co2s_insitu retains the minimum set of values under initial conditions that are needed to make the adjustment. These pre-adjustment values all have the suffix "__pre" within the CO2System:

# Get the pre-adjustment pH value in the adjusted CO2System
pH_lab = co2s_insitu["pH__pre"]  # same as co2s_lab["pH"]

# Solve for and return the adjusted pH value
pH_insitu = co2s_insitu["pH"]

Any uncertainties that were defined for these values are carried across to the new system.

How it works

To go from an initial to and adjusted set of temperature and/or pressure conditions, we

  1. Solve for DIC and alkalinity under the initial conditions, and then
  2. Solve from DIC and alkalinity under the adjusted conditions.

DIC and total alkalinity

In this case, adjust is not needed. DIC and alkalinity are sensitive to neither temperature nor pressure.

So adjust will work, but the result will be the same as putting the temperature and pressure of interest directly into pyco2.sys.

Two T/P-sensitive parameters at different T/P

As in previous versions of (Py)CO2SYS, there is no built-in way to handle the (rare) case where both known parameters are temperature- and/or pressure-sensitive and the two known parameters are at a different temperature and/or pressure from each other.

One parameter known

The adjust method can also be used to adjust temperature (but not pressure) if only one of pCO2, fCO2, [CO2(aq)] or xCO2 is known.

import PyCO2SYS as pyco2

# Set up the initial CO2System (e.g. under lab conditions for xCO2)
co2s_lab = pyco2.sys(xCO2=425, temperature=25, pressure=0, salinity=32)

# Adjust to a different temperature (e.g. in situ conditions)
co2s_insitu = co2s_lab.adjust(temperature=10.5)

# Solve for and return fCO2 under the lab and in situ conditions
fCO2_lab = co2s_lab["fCO2"]
fCO2_insitu = co2s_insitu["fCO2"]

Allowed kwargs for adjust with one known parameter

  • temperature: the temperature to adjust to in °C.

  • method_fCO2: how to do the temperature conversion:

    • 1: using the parameterised υh equation of H24 (default).
    • 2: using the constant υh fitted to the TOG93 dataset by H24.
    • 3: using the constant theoretical υx of H24.
    • 4: following the H24 approach, but using a user-provided \(b_h\) value (see bh below).
    • 5: using the linear fit of TOG93.
    • 6: using the quadratic fit of TOG93.

Only when method_fCO2 is 1:

  • which_fCO2_insitu: whether the input (1, default) or output (2) condition pCO2, fCO2, [CO2(aq)] and/or xCO2 values are at in situ conditions, for determining \(b_h\) with the parameterisation of H24.

Only when method_fCO2 is 4:

  • bh: \(b_h\) in J/mol.