my_code_base.ocean¶
This module provides routines for tackling tasks related to oceanic biogeochemistry.
temperature and salinity normalization
temperature decomposition
fgCO2 <-> pCO2 and other conversions
Submodules¶
Package Contents¶
- my_code_base.ocean.cond2sal(C, T, p)[source]¶
Compute salinity from conductivity, according to Lewis and Perkin [1981].
Example
>>> cond2sal(C=52, T=25, p=1013) 34.20810771080768
- my_code_base.ocean.ppm2uatm(xCO2, p_equ, input='wet', T=None, S=None)[source]¶
Convert mole fraction concentration (in ppm) into partial pressure (in µatm) following Dickson et al. [2007]
\[pCO_2 = xCO_2 \cdot p_\text{equ}\]- Parameters:
xCO2 (float or pandas.Series) – The measured CO2 concentration (in ppm)
p_equ (float or pandas.Series) – The measured pressure (in hPa, Pa or atm) at the equilibrator (hint: you might want to smoothen your time series)
input (str [default: "wet"]) – Either “wet” or “dry”, specifying the type of air, in which the concentration is measured. If the CO2 concentration is measured in dry air, one must correct for the water vapor pressure. In this case, make sure to also provide T (temperature in Kelvin) and S (salinity in PSU) as arguments.
T (float or pandas.Series [default: None]) – Temperature in Kelvin (needs to be provided if xCO2 is measured in dry air)
S (float or pandas.Series [default: None]) – Salinity in PSU (needs to be provided if xCO2 is measured in dry air)
- my_code_base.ocean.pressure2atm(p)[source]¶
Convert pressure given in hPa, Pa or atm into atm.
Examples
>>> pressure2atm(1013.25) 1.0 >>> pressure2atm(101325) 1.0 >>> pressure2atm(2) 2 >>> pressure2atm(pd.Series([1013.25, 1024.0])) 0 1.000000 1 1.010609 dtype: float64
- my_code_base.ocean.pressure2mbar(p)[source]¶
Convert pressure given in hPa, Pa or atm into mbar (or hPa).
Examples
>>> pressure2mbar(1013) 1013 >>> pressure2mbar(101300) 1013.0 >>> pressure2mbar(1.0) 1013.25 >>> pressure2mbar(pd.Series([1.013, 2.034])) 0 1026.42225 1 2060.95050 dtype: float64
- my_code_base.ocean.temperature2C(T)[source]¶
Convert temperatures given in Kelvin into °C. If T is a
pandas.Seriesobject, only values less than 200 are converted. All others are expected to be already in °C.Examples
>>> temperature2C(283.15) 10.0
- my_code_base.ocean.temperature2K(T)[source]¶
Convert temperatures given in °C into Kelvin. If T is a
pandas.Seriesobject, only values larger than 200 are converted. All others are assumed to be already in Kelvin.Examples
>>> temperature2K(10) 283.15
- my_code_base.ocean.water_vapor_pressure(T, S)[source]¶
Compute the water vapor pressure by means of the temperature [K] and the salinity [PSU] following Weiss and Price [1980].
- Parameters:
S (float or pandas.Series) – Salinity in PSU
T (float or pandas.Series) – Temperature (°C gets converted into Kelvin)