Humidity Is Not Humidity: vapor_pressure_deficit and why absolute humidity changes what your app should do

The number you’re probably using is the least useful one

Relative humidity is what weather APIs return. It’s also, depending on what you’re building, the least actionable form of humidity data available. An 80% reading in Glasgow at 10°C and an 80% reading in Phoenix at 38°C are describing completely different physical situations — same percentage, wildly different moisture content in the air. If your app treats them the same way, it’s wrong in ways that won’t be obvious until someone complains.

The two derived values worth computing yourself are absolute humidity (how many grams of water vapor are actually in a cubic meter of air) and vapor pressure deficit (VPD — how far the air is from saturation, in pressure terms). WeatherAPI doesn’t surface either of these directly, but the inputs to calculate both are in every response: temp_c, humidity, and dewpoint_c.

What you need from the API response

A standard current-conditions call returns everything required:

  • current.temp_c — air temperature in Celsius
  • current.humidity — relative humidity as an integer percentage (0–100)
  • current.dewpoint_c — available in current and hourly forecast blocks

You don’t need the pro tier for this. The free plan includes all three fields in the current response. If you’re working with hourly forecast data, the same fields appear inside each hour block, so the calculation works identically across a 24-hour lookahead.

Calculating saturation vapor pressure

Both derived values start from saturation vapor pressure (SVP) — the maximum water vapor the air can hold at a given temperature before condensation occurs. The standard approximation used operationally by NWS is the August-Roche-Magnus formula:

SVP (hPa) = 6.1078 × exp((17.27 × T) / (T + 237.3))

Where T is temperature in Celsius. Actual vapor pressure (AVP) follows:

AVP = SVP × (RH / 100)

If dew point is available — and it is in WeatherAPI’s response — feed the dew point into the same SVP formula to get AVP directly. That route skips the rounding error baked into the integer humidity field, which matters when you’re close to saturation thresholds. Use it when precision counts.

VPD: the number agriculture and greenhouse operators actually want

VPD is SVP minus AVP:

VPD (hPa) = SVP - AVP

A VPD near zero means the air is almost saturated — plants can’t transpire efficiently, fungal pressure climbs, and any dehumidification system is working at capacity. Above roughly 15 hPa, the air is pulling moisture from plant leaves faster than roots can supply it: drought stress territory even with adequate soil moisture. Those are the thresholds irrigation controllers and greenhouse climate systems act on. The relative humidity number doesn’t get you there.

Here’s a minimal Python implementation using WeatherAPI’s JSON response:

import math
import requests

API_KEY = "your_key"
LOCATION = "Edinburgh"

resp = requests.get(
    "https://api.weatherapi.com/v1/current.json",
    params={"key": API_KEY, "q": LOCATION, "aqi": "no"}
)
data = resp.json()["current"]

temp_c = data["temp_c"]
rh = data["humidity"]
dewpoint_c = data["dewpoint_c"]

# Saturation vapor pressure at air temperature
svp = 6.1078 * math.exp((17.27 * temp_c) / (temp_c + 237.3))

# Actual vapor pressure via dew point (more accurate than RH route)
avp = 6.1078 * math.exp((17.27 * dewpoint_c) / (dewpoint_c + 237.3))

vpd = svp - avp

print(f"SVP: {svp:.2f} hPa")
print(f"AVP: {avp:.2f} hPa")
print(f"VPD: {vpd:.2f} hPa")

No extra dependencies beyond requests and math. Run it for two locations at identical relative humidity but different temperatures and the VPD gap is usually large enough to immediately make the case that RH alone wasn’t sufficient.

Absolute humidity: the one for ventilation and air quality

Absolute humidity (AH) is the actual mass of water vapor per unit volume — what matters for ventilation system sizing, indoor air quality comparisons across temperature-variable zones, and any calculation where you’re moving or mixing air masses.

# Absolute humidity in g/m³
# Mw = 18.015 g/mol, R = 8.314 J/(mol·K)

temp_k = temp_c + 273.15
ah = (avp * 100 * 18.015) / (8.314 * temp_k)
print(f"Absolute Humidity: {ah:.2f} g/m³")

The avp * 100 converts hPa to Pa before the ideal gas calculation. Get that wrong and your numbers are off by two orders of magnitude — an easy mistake when you’re pulling formula fragments from sources that use inconsistent units.

Where the inputs get shaky

The integer rounding on humidity is worth knowing about. RH comes back as a whole number — 73%, not 73.4%. Near saturation, a one-point rounding difference can shift AVP enough to trip a precision VPD threshold the wrong way. That’s the practical reason to prefer dewpoint_c as your AVP input whenever you have it.

The other caveat: this is surface air at the measurement or forecast point. If your use case involves crop canopy temperature, soil surface, or any layer that isn’t well-mixed ambient air, the VPD your plants or sensors actually experience will differ from what this calculation produces. That’s not an API limitation — no surface weather feed can resolve it without in-canopy sensor data.

Practical threshold logic on top of VPD

Once you have per-hour VPD from the forecast response, threshold logic is straightforward. A rough set of ranges drawn from common greenhouse management practice and WMO guidance:

  • VPD < 4 hPa: high disease risk, poor transpiration — ventilate or dehumidify
  • 4–8 hPa: low stress, generally good growing conditions
  • 8–15 hPa: moderate transpiration demand — monitor soil moisture
  • VPD > 15 hPa: high stress — irrigation trigger or shade deployment

These shift by crop — tomatoes tolerate higher VPD than leafy greens — but the shape is consistent across most literature. Crop-specific thresholds layered onto hourly forecast VPD produce a tighter signal than anything relative humidity alone can give you, without touching an additional data source.

One field, three different questions

RH tells you how close the air is to saturation as a fraction. Absolute humidity tells you how much water is physically present. VPD tells you the evaporative demand the air is placing on any wet surface inside it. Most apps use the first one because it’s what the API hands over directly. The other two are four lines of arithmetic.

If you’re building in the agriculture, greenhouse, construction-drying, or HVAC space, run VPD against a week of historical hourly data for your target location and check whether it correlates better with the outcome you actually care about than raw humidity does. It usually will — and the calculation cost is negligible compared to sourcing a specialist agro-met feed.

Scroll to Top