ARTICLE AD BOX
In a meteorological program (CumulusMX) the value of the Wet Bulb Temperature is calculated as:
public static double CalculateWetBulbC(double tempC, double dewPointC, double pressureMb) { double svpDP = SaturationVapourPressure1980(dewPointC); return (((0.00066 * pressureMb) * tempC) + ((4098 * svpDP) / (Sqr(dewPointC + 237.7)) * dewPointC)) / ((0.00066 * pressureMb) + (4098 * svpDP) / (Sqr(dewPointC + 237.7))); }With svpDP being:
public static double SaturationVapourPressure1980(double tempC) { return 6.112 * Math.Exp(17.67 * tempC / (tempC + 243.5)); }And Sqr(a) being the square of the argument (a*a).
This same number is calculated in javascript as:
(0.00066 * Pressure[i][1] * Temperature[i][1] + 4098 * 6.112 * Math.exp(17.67 * Temperature[i][1] / (243.5 + Temperature[i][1])) / Math.pow((Dewpoint[i][1] + 237.7), 2) * Dewpoint[i][1]) / (0.00066 * Pressure[i][1] + 4098 * 6.112 * Math.exp(17.67 * Temperature[i][1] / (243.5 + Temperature[i][1])) / Math.pow((Dewpoint[i][1] + 237.7), 2))Note that all elements of the calculation are pushed into one equation. The [i][1] index points to a value in a JSON array representing on a certain minute in the past three days so the WetBulb temperature can be calculated for each minute for the last three days. The C# calculation is also given for each minute in the last three three days.
You can see all those values charted here.
Now you can see those values differ:
wetbulb_1minwetbulb comes from CumulusMX C# calculation, on a one minute frequency
Natte Bol Temperatuur comes from the javascript calculation also on a minute frequency
A lot of effort has been put in the differences between the C# and the javascript equation by competent people but no errors have been found in the equations.
So, the question is: where does this difference possibly come from?
I am thinking of ways the C# runtime or the javascript actually handle complex equations like this but t.b.h. I have no idea and I would be much obliged if somebody comes up with an idea on the mechanism of the difference between the two calculations.
I am aware this is not a strict straight forward question. If you think it should be asked somewhere else, please let me know. If you need additional information, please let me know as well.
