lair.noaa.CarbonTrackerCH4.calc_molefractions_pressure#

static CarbonTrackerCH4.calc_molefractions_pressure(molefractions)[source]#

Calculate the pressure at each level in the molefractions Dataset.

Parameters:

molefractions (xr.Dataset) – The molefractions Dataset.

Returns:

xr.Dataset – The molefractions Dataset with the pressure calculated: a variable P, in hPa, from the hybrid coefficients at and bt and the surface pressure (at + bt * surf_pressure). The Dataset passed is changed too.

Return type:

Dataset

See also

CarbonTrackerCH4.molefractions

The Dataset it takes.

Examples

Two levels over one cell, with a surface pressure of 850 hPa:

>>> import xarray as xr
>>> from lair.noaa import CarbonTrackerCH4
>>> mf = xr.Dataset(
...     {
...         "at": ("boundary", [0.0, 5000.0]),
...         "bt": ("boundary", [1.0, 0.5]),
...         "surf_pressure": 85000.0,
...     }
... )
>>> CarbonTrackerCH4.calc_molefractions_pressure(mf)["P"].values
array([850., 475.])