Make your own free website on Tripod.com

Weather Algorithms: Calculating With Humidity Variables

Last Updated: May 02, 1999

[ Algorithms Index | Index | Feedback  ]


Contents


Calculations With Dewpoint

Source Code

function calcWithDp(drybulb, dewpoint, pressure)
{
    var result = new Object();
    var havePress = (pressure != 0);

    result.rh = calcRelHumidity(e, es);

// Use variable names familiar to meteorologists.
// Feel combine these four assignments into two

    var es = calcVaporPressure(drybulb);
    var e = calcVaporPressure(dewpoint);
    result.saturvp = es;
    result.actualvp = e;

    result.abshum = calcAbsHumidity(e, drybulb);

    if (!havePress) return;
	
    result.wetbulb = calcWetbulb(pressure, drybulb,  dewpoint);
    result.mixratio = calcMixingRatio(e, pressure);
    result.spechum = calcSpecHumidity(e, pressure);

    return result;
}

Parameters

drybulb is the drybulb in Celsius.
dewpoint is the dewpoint in Celsius.
pressure is the pressure in millibars or 0 if no pressure is to be assumed.

Results

An object with these properties:


Calculating With Relative Humidity

Source Code

function calcWithRh(drybulb, rh, pressure)
{
    var result = new Object();
    var havePress = (pressure != 0);
// Calculate drybulb vapor pressure
    var es = calcVaporPressure(drybulb);
// Calculate dewpoint vapor pressure
    var e = es * rh / 100;

    result.dewpoint = calcTcFromVaporPressure(e);

    if (rh == 100) result.wetbulb = dewpoint;

    result.saturvp = es;
    result.actualvp = e;
    result.abshum = calcAbsHumidity(e, drybulb);

// Assume a reasonable default
    if (!havePress)
	pressure = 1013;

    if (rh != 100) result.wetbulb = calcWetbulb(pressure, drybulb, dewpoint);

    result.mixratio = calcMixingRatio(e, pressure);
    result.spechum = calcSpecHumidity(e, pressure);

    return result;
}

Parameters

drybulb is the drybulb in Celsius.
rh is the relative humidity in decimal.
pressure is the pressure in millibars or 0 if no pressure is to be assumed.

Results

An object with these properties:


Calculating With Wetbulb

Source Code

function calcWithWb(drybulb, wetbulb, pressure)
{
    var result = new Object();
    var es = calcVaporPressure(drybulb);
    var esw = calcVaporPressure(wetbulb);

    result.saturvp = es;

// Make an assumption since wetbulb varies little with pressures likely to occur in the atmosphere
    if (pressure == 0) pressure = 1013;

    var e = esw - (0.00066 * (1 + 0.00155 * wetbulb) * press * (drybulb - wetbulb));

// If the wetbulb is too low, quit. Otherwise, incorrect values are the results.
    if (e < 0)
        return;

    result.actualvp = e;
    result.abshum = calcAbsHumidity(e, drybulb);
    result.dewpoint = calcTcFromVaporPressure(e);
    result.rh = calcRelHumidity(e,es);
    result.mixratio = calcMixingRatio(e, pressure);
    result.spechum = calcSpecHumidity(e, pressure);

    return result;
}

Parameters

drybulb is the drybulb in Celsius.
wetbulb is the wetbulb in Celsius.
pressure is the pressure in millibars or 0 if no pressure is to be assumed.

Results

An object with these properties as long as the wetbulb is not too low:


[ Algorithms Index | Index | Feedback  ]

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