Humidity ratio (source code)

= Humidity ratio
{title2=$w=m_v/m_d$}

The <humidity ratio> $w$ is the <mass> of <water vapor> divided by the <mass> of <dry air> in a sample:
$$
w=\frac{m_v}{m_d}.
$$
It is commonly expressed as kilograms of <water vapor> per kilogram of <dry air>, or grams per kilogram. The denominator excludes the <water vapor> itself; the related <specific humidity> is a <mass fraction> of the entire moist sample.<Psychrometrics in the 2017 ASHRAE Handbook Fundamentals>[Section5, Eqs7–9: humidity ratio and specific humidity]{ref}

Using the <ideal gas law> for both components gives
$$
w=\frac{M_v}{M_d}\frac{p_v}{p-p_v}\approx0.621945\frac{p_v}{p-p_v},
$$
where $M_v,M_d$ are <molar masses>, $p_v$ is the water-vapor <partial pressure>, and $p$ is total <pressure>. At $p=101.325\,\mathrm{kPa}$ and $p_v=1.6\,\mathrm{kPa}$, this yields $w\approx0.00998$, or about $9.98\,\mathrm{g/kg}$ of <dry air>.<Psychrometrics in the 2017 ASHRAE Handbook Fundamentals>[Sections1and5: ideal-gas mixture and molecular-mass ratio]{ref}

Unlike <relative humidity>, the <humidity ratio> does not compare vapor pressure with <saturation vapor pressure>. Warming air without adding or removing <water vapor> can change its <relative humidity> while leaving $w$ unchanged. This distinction matters when comparing incoming and outgoing air in measurements of evaporation or biological heat loss.