lair.constants#

Physical constants, as pint quantities of lair.units.

lair.meteorology uses them as plain SI numbers. pint has no constants of its own yet (hgrecco/pint#1078), so lair keeps them here.

Each constant is a pint quantity: a number with its unit. Multiply it into a calculation and the units follow, or take the number in the unit you want with m_as. The atmospheric constants are rounded textbook values; the SI constants (Na, kb, h, c) are exact. Each page says what its constant is for and how far the rounding is from the precise value, so you can judge whether it matters for your work.

Examples

The potential temperature exponent, Rd / cp, has no unit left:

>>> from lair import constants
>>> kappa = constants.Rd / constants.cp
>>> round(float(kappa.m_as("dimensionless")), 4)
0.2856

A constant as a plain number in the unit you give, for code that does not use pint:

>>> float(constants.R_earth.m_as("m"))
6371000.0

The scale height of the atmosphere, Rd * T / g, at 250 K:

>>> from lair import units
>>> H = constants.Rd * (250 * units.K) / constants.g
>>> round(float(H.m_as("km")), 2)
7.32

Attributes

Na

The Avogadro constant, 6.02214076e23 per mole.

kb

The Boltzmann constant, 1.380649e-23 J/K.

rho_w

The density of liquid water, 997 kg/m^3.

Gamma_d

The dry adiabatic lapse rate, 9.8 K/km.

Rd

The specific gas constant of dry air, 287.05 J/(kg K).

Rv

The specific gas constant of water vapor, 461.5 J/(kg K).

g

The acceleration of gravity, 9.81 m/s^2.

cp

The specific heat of dry air at constant pressure, 1005 J/(kg K).

c_l

The specific heat of liquid water, 4186 J/(kg K).

cv

The specific heat of dry air at constant volume, 718 J/(kg K).

L_f

The latent heat of fusion of water, 3.337e5 J/kg.

L

The latent heat of vaporization of water, 2.501e6 J/kg.

L_s

The latent heat of sublimation of water, 2.8347e6 J/kg.

h

The Planck constant, 6.62607015e-34 J s.

R_earth

The mean radius of the Earth, 6371 km.

epsilon

The ratio of the gas constants of dry air and water vapor, Rd / Rv.

c

The speed of light in a vacuum, 299792458 m/s.

sigma

The Stefan-Boltzmann constant, 5.67e-8 W/(m^2 K^4).

Rstar

The universal gas constant, 8.314462618 J/(mol K).