Skip to content

Validity range checker

PyCO2SYS includes a tool to check whether arguments such as temperature, salinity and pressure fall within the valid ranges required by the parameterisations used internally to calculate equilibrium constants and other marine carbonate system properties.

Many of these validity ranges are poorly constrained or unknown, so we expect that the validity ranges will be updated in the future.

Visualising validity

Once a CO2System has been created with pyco2.sys, it needs to be solved for whichever parameters are to be checked using the solve method, with store_steps=2 in order for the validity checker to work properly. Then, use the plot_graph method to visualise the results:

import PyCO2SYS as pyco2

co2s = pyco2.sys()  # Set up a default CO2System
co2s.solve(store_steps=2)  # Solve for all parameters
co2s.plot_graph(
    mode="valid",
    # optional kwargs below to plot fewer parameters
    show_unknown=False,
    show_isolated=False,
)

Hello

It is anticipated that the exact appearance of the validity graph generated by plot_graph will be adjusted in future minor releases. The description below will be kept up-to-date for the current released version of PyCO2SYS.

The output graph may look like the following:

Validity graph

Here, each parameter is represented by a circle.

The fill colour indicates the direct validity status of the parameter. This means whether all of the arguments required to calculate the parameter fall within their valid ranges:

  • Blue: all arguments are in their valid ranges (e.g., \(P_0\)).
  • Red: at least one argument is outside its valid range (e.g., \(P_1\) and \(P_2\)).
  • Grey: valid ranges not defined for this parameter (e.g., \(p\), \(t\) and \(S\)).

The arrow colours show exactly which parameters are inside (blue, e.g. \(t\) for \(P_0\)) or outside (red, e.g. \(t\) for \(P_1\) and \(P_2\)) their valid ranges, or which do not (yet) have validity ranges specified (grey, e.g. \(t\) for \(P_\mathrm{HF}\)).

If a parameter is invalid (e.g., \(P_1\) and \(P_2\)), then all other parameters it is used to calculate are also considered indirectly invalid. This is shown with red arrows and a red border around the indirectly invalid parameter (e.g. \(K_1^*\) and \(K_2^*\)).