Specific humidity (source code)

= Specific humidity
{title2=$q=w/(1+w)$}

<Specific humidity> $q$ is the <mass fraction> of <water vapor> in moist air. For vapor <mass> $m_v$ and <dry air> <mass> $m_d$,
$$
q=\frac{m_v}{m_d+m_v}=\frac{w}{1+w},\qquad w=\frac{m_v}{m_d},
$$
where $w$ is the <humidity ratio>. Both are dimensionless, but $q$ uses the total moist <mass> as its denominator.<Psychrometrics in the 2017 ASHRAE Handbook Fundamentals>[Chapter1, Section5, Eqs7–9]{ref}

For an ideal <gas mixture>, substitute $w=\epsilon e/(p-e)$ to obtain
$$
q=\frac{\epsilon e}{p-(1-\epsilon)e},\qquad \epsilon=\frac{M_v}{M_d}\approx0.622,
$$
where $e$ is the vapor <partial pressure>, $p$ is total <pressure> and $M_v,M_d$ are <molar masses>. At $p=100\,\mathrm{kPa}$ and $e=2\,\mathrm{kPa}$, the result is $q\approx0.01254$, or $12.54\,\mathrm{g/kg}$ of moist air. These are illustrative inputs, not a measured weather observation.

Heating the same closed sample without adding, removing or condensing <water> leaves $q$ unchanged while <relative humidity> can change. This helps distinguish a change in atmospheric moisture content from a change in <temperature> when interpreting evaporation and <thermoregulation>.