Page 2 of 2

Re: Apparent Temperature

Posted: Wed 09 Feb 2011 1:06 am
by gemini06720
steve wrote:Does your calculated value agree with the Cumulus <#apptemp> web tag? Hopefully!
Steve, I just created a PHP function with the information provided by 'fracto' and I have added the apparent temperature on my [link removed] (both, the calculated one and the one provided by Cumulus) - at the time of writing this message, both temperatures were equal.

Re: Apparent Temperature

Posted: Thu 10 Feb 2011 9:30 pm
by fractonimbus
Interesting to see slight differences. This can probably be explained by the computation processes used by the different languages. Since this is an empirical index, small differences are not important. I checked them in parallel for several hours, at higher dry bulb temperatures (summer here in Oz), and there were no differences that I noticed.

BTW, Ray, nice looking, comprehensive web page.

DN

Re: Apparent Temperature

Posted: Thu 10 Feb 2011 10:04 pm
by steve
Currently showing 0.9 and 1.6; I'm surprised there's such a difference.

Re: Apparent Temperature

Posted: Thu 10 Feb 2011 10:17 pm
by steve
I think the difference is because I'm using a slightly different formula for vapour pressure (there are quite a few).

Re: Apparent Temperature

Posted: Sat 18 Jun 2011 11:43 am
by MickinMoulden
beteljuice wrote:If the original precedence is correct, then I think this is the way it should look (untested !!!)

Code: Select all

<script type="text/javascript">

/* Apparent Temperature

Version including the effects of temperature, humidity, and wind: AT = Ta + 0.33×e − 0.70×ws − 4.00

Ta = Dry bulb temperature (°C)

e = Water vapour pressure (hPa) [humidity]

ws = Wind speed (m/s) at an elevation of 10 meters

The vapour pressure can be calculated from the temperature and relative humidity using the equation: 

e = rh / 100 × 6.105 × exp ( 17.27 × Ta / ( 237.7 + Ta ) )

where: 

rh = Relative Humidity [%]

*/


my_Ta = <#temp>; // degrees C

my_e = <#hum> / 100 * Math.exp( 17.27 * my_Ta / ( 237.7 + my_Ta));

my_ws = <#wlatest> * 0.27777; // windspeed converted from km/h to m/s

my_AT = my_Ta + 0.33 * my_e - 0.7 * my_ws - 4; // precedence is my_Ta + (0.33 * my_e) - (0.7 * my_ws) - 4


// tidy up

my_AT = ( Math.round(100* my_AT)/100, 1).toFixed(1); // rounds up to one decimal with trailing .0 if required


document.write(my_AT);
</script>

Your code looks great Beatle Juice. I have tested it, and just a few adjustments:
replace the my_e with:

Code: Select all

my_e = <#hum> / 100 * 6.105 * Math.exp( 17.27 * my_Ta / ( 237.7 + my_Ta));

and:

Code: Select all

precedence is my_Ta + (0.33 * my_e) - (0.7 * my_ws) - 4
I used this. The original equation didn't work at the time, but may have been atributed to the following problem:

Code: Select all

my_AT = ( Math.round(100* my_AT)/100, 1).toFixed(1); // rounds up to one decimal with trailing .0 if required
should take out the ",1". I put:

Code: Select all

var AT = (Math.round(10 * AT)/10) .toFixed(1); 
. Of course you can times by 100 then divide by 100. Makes no difference.
then change to this:

Code: Select all

document.write(my_AT + "<#tempunit>");
just to tidy it up.
I've tested it and compared it with the chart supplied here: http://www.bom.gov.au/info/thermal_stress/ and works well (spot on).
Thanks for all the hard work Beetle Juice. I was going to do it after finding the equation on the BOM.gov.au site, but once again, why re-invent the wheel when you have Sandaysoft.com!

Re: Apparent Temperature

Posted: Sat 18 Jun 2011 2:25 pm
by beteljuice
Your code looks great Beatle Juice. I have tested it, and just a few adjustments:
replace the my_e with:

Code: Select all

my_e = <#hum> / 100 * 6.105 * Math.exp( 17.27 * my_Ta / ( 237.7 + my_Ta));
That and the extra ", 1"
My bad :oops: - good job I put the "English" formula so you found it