openghg_inversions.convert#

Common Python functions that are called for converting time and gas species units as part of data processing.

openghg_inversions.convert.convert_to_hours(time: str | list[str]) float | list[float]#

Convert (list of) times to hours.

Parameters:

time – time or list of times as a string (e.g. “4D” or [“2D”, “1W”])

Returns: times from input converted to hours; output is is a list if the input

is a list.

openghg_inversions.convert.mol2g(value: float, species: str) float#

Convert a value in moles to grams.

Parameters:
  • value – Value associated with the number of moles of species

  • species – Atmospheric trace gas species of interest (e.g. ‘co2’)

Returns:

Corresponding value of trace gas species in grams (as float)

openghg_inversions.convert.prefix(units: str) float#

Convert unit prefix to magnitude.

Parameters:

units – Unit prefix of some quantity (e.g. T (Terra) –> 1e12)

Returns:

Unit magnitude (float)