Calculating Humidity Properties

Last Updated: August 02, 2000

[ Algorithms Index | Index | Feedback  ]


Contents


Vapor Pressure From Temperature

Calculates the vapor pressure for a given temperature. There is no one algorithm for calculating vapor pressure so I've included two that you can use. Which ever one you choose, make sure to use the corresponding source in Vapor Pressure From Temperauture.

Source Code #1

function calcVaporPressure(t)
{
    return 6.112 * Math.pow(10, (7.5 * t) / (237.7 + t));
}

Source Code #2

function calcVaporPressure(t)
{
    return 6.112 * Math.exp((17.67 * t) / (243.5 + t))
}

Parameters

t is the temperature in Celsius

Results

Returns the vapor pressure in millibars.

Examples

t = 22, function #1 returns: 26.3956
t = 11, function #1 returns: 13.1192

t = 22, function #2 returns: 26.4283
t = 11, function #2 returns: 13.1180


Temperature From Vapor Pressure

Finds the temperature from a given vapor pressure.

Source Code #1

function calcTcFromVaporPressure(vp)
{
    var logs = Math.log(vp / 6.112) / Math.LN10;
    return (237.7 * logs) / (7.5 - logs);
}

Source Code #2 (no need for log10 correction)

function calcTcFromVaporPressure(vp)
{
    var logs = Math.log(vp / 6.112);
    return (243.15 * logs) / (17.67 - logs);
}

Parameters

vp is the vapor pressure in millibars

Results

Returns the corresponding temperature in Celsius.

Examples

vp = 26.3956, function #1 returns 22.0
vp = 13.1192, function #1 returns 11.0

vp =26.4283, function #2 returns 22.0
vp = 13.1180, function #2 returns 11.0


Relative Humidity From Vapor Pressure

Finds the relative humidity from the actual and saturated vapor pressures.

Source Code

function calcRelHumidityFromVp(actual, satur)
{
    return actual / satur * 100.0;
}

Parameters

actual is the vapor pressure in millibars found using the dewpoint temperature in degrees Celsius.
satur is the vapor pressure in millibars found using the drybulb temperature in degrees Celsius.

Results

Returns the relative humidity as a decimal. For a percentage, multiply by 100.

Examples

dewpoint = 11, actual = 13.1
drybulb = 22, satur = 26.4

result is: .496 or 49.6%


Wetbulb

Estimates the wetbulb temperature given pressure, drybulb, and dewpoint.

Source Code

function calcWetbulb (press, t, dp)
{
    var tmin = Math.min(dp,t);
    var tmax = Math.max(dp,t);
    var e = calcVaporPressure(dp);
    var vpcur;
    var peq;
    var diff;
    var tcur;

    while (true)
    {
        tcur = (tmax + tmin) / 2;
        vpcur = calcVaporPressure(tcur);
        peq = 0.00066 * (1+0.00155 * tcur) * press * (t - tcur);
        diff = peq - vpcur + e;

        if (Math.abs(diff) < 0.01) break;

        if (diff < 0) tmax = tcur;
        else tmin = tcur;
    }
    return tcur;
}

Parameters

press is the barometric pressure in millibars
t is a temperature in degrees Celsius
dp is the dewpoint temperature in degrees Celsius

Results

Returns the estimate of the wetbulb temperature in degrees Celsius.

Examples

press = 1013, t = 22, dp = 11, function returns: 15.5

press = 950, t = 22, dp = 11, function returns: 15.3

press = 1013, t = 0, dp = -8, function returns: -2.6


Specific Humidity

Calculates the specific humidity from the actual vapor pressure and barometric pressure.

Source Code

function calcSpecHumidity(e, press)
{
    return (0.62197 * e) / (press - (0.37803 * e)) * 1000.0;
}

Parameters

e is the vapor pressure in millibars of the dewpoint temperature.
press is the barometric pressure in millibars.

Results

Returns the specific humidity in grams per kilogram.

Examples

e = 13.12 (from dewpoint of 11 °C), press = 1013, function returns: 8.09

e = 6.11 (from dewpoint of 0 °C), press = 1013, function returns: 3.76


Mixing Ratio

Calculates the mixing ratio from the actual vapor pressure and barometric pressure.

Source Code

function calcMixingRatio(e, press)
{
    return ((0.62197 * e)/(press - e)) * 1000.0;
}

Parameters

e is the vapor pressure in millibars of the dewpoint temperature.
press is the barometric pressure in millibars.

Results

Returns the mixing ratio in grams per kilogram.

Examples

e = 13.12 (from dewpoint of 11 °C), press = 1013, function returns: 8.2

e = 6.11 (from dewpoint of 0 °C), press = 1013, function returns: 3.8


Absolute Humidity

Calculates absolute humidity from the actual vapor pressure and temperature.

Source Code

function calcAbsHumidity(e, t)
{
    return (e * 100) / (461.51 * (273.15 + t)) * 1000.0;
}

For a function that takes dewpoint temperature instead of the vapor pressure derived from the dewpoint, use this code:

function calcAbsHumidityDp(dp, t)
{
  var e = calcVaporPressure (dp);
  return calcAbsHumidity (e, t);
}

Parameters

e is the vapor pressure in millibars of the dewpoint temperature.
t is the temperature in Celsius.

Results

Returns the absolute humidity in grams per cubed meter.

Examples

e = 13.12 (from dewpoint of 11 °C), press = 1013, function returns: 9.6

e = 6.11 (from dewpoint of 0 °C), press = 1013, function returns: 4.7


[ Algorithms Index | Index | Feedback  ]

Copyright © 1997-1999 by Mark E. All Rights Reserved.