Webtags (preserving history): Difference between revisions

m
Line 936: Line 936:


=== Other weather derivatives ===
=== Other weather derivatives ===
Although 'Apparent Temperature' is not included as a tag, it can be [[FAQ#What_formula_does_Cumulus_use_for_Apparent_Temperature.3F | calculated]] in a script from recent 'outside temperature', 'wind speed', and 'relative humidity' values (using the same time selection for all). There are other derivatives that can be calculated similarly from a set of simultaneous values.
Although 'Apparent Temperature', 'Feels Like temperature' are not included as tags here, they can be calculated in a script from recent 'outside temperature', 'wind speed', and 'relative humidity' values (using the same time selection for all). There are other derivatives that can be calculated similarly from a set of simultaneous values.
 
This PHP function calculates wind chill, apparent temperature, and feels like temperature. Note you might need to convert the units for the temperature and wind speed for the function from those reported by those recent history tags.
<pre>function Calculate_FeelsLike ($temp_degC, $wind_mph, $humidity)
{
$wind_kph = $wind_mph * 1.609344;
if($wind_kph <4.828)
{
$wind_chill = $temp_degC;
}else{
$wind_chill = 13.12 +0.6125 * $temp_degC - 11.37 * pow($wind_kph, 0.16) + 0.3965 * $temp_degC * pow($wind_kph, 0.16);
}
$vapour_pressure = (($humidity / 100) * 6.105)  * exp(17.27 * $temp_degC / (237.7 + $temp_degC)) / 10;
$apparent_temp   = -2.7 + (1.04 * $temp_degC) + (2 * $vapour_pressure) - ($wind_kph * 01.1805553);
if($temp_degC < 10)
{
$feels_like = $wind_chill;
}elseif($temp_degC > 20)
{
$feels_like = $apparent_temp;
}else{
$app_temp_mult = ($temp_degC - 10) / 10;
$wind_chill_mult = 1 - $app_temp_mult;
$feels_like = ($apparent_temp * $app_temp_mult) + ($wind_chill * $wind_chill_mult);
}
$return_array[0] = $apparent_temp;
$return_array[1] = $feels_like;
$return_array[2] = $wind_chill;
return $return_array;
}</pre>


=== During catch-up ===
=== During catch-up ===
5,838

edits