Webtags (preserving history): Difference between revisions

m
Line 1,194: Line 1,194:
| d=n (where n runs 0 to 6) days ago; h=n (where n is any number of hours ago); m=n (where n is any number of minutes ago)
| d=n (where n runs 0 to 6) days ago; h=n (where n is any number of hours ago); m=n (where n is any number of minutes ago)
|}
|}


=== Other weather derivatives ===
=== Other weather derivatives ===
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.
Although Humidex, '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.
<pre>function Calculate_FeelsLike ($temp_degC, $wind_mph, $humidity)
 
{
The relevant formulae were previously included here, but since I have now discovered that Cumulus 1 and MX use different formulae, plus MX has been varying the Feels Like formula at different versions, it is now too complicated to list all formulae here, so only some are now included (using JavaScript, adjust for other languages):
$wind_kph = $wind_mph * 1.609344;
 
if($wind_kph <4.828)
==== Canadian Humidity Index ====
{
 
$wind_chill = $temp_degC;
If you are in USA and use Fahrenheit instead of Celsius, you will need to do a conversion for the temperature and dew point tags, and in reverse for the output. This example is for 3 hours ago, change the input parameters to suit your need.
}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);
Cumulus 1:
}
 
$vapour_pressure = (($humidity / 100) * 6.105* exp(17.27 * $temp_degC / (237.7 + $temp_degC)) / 10;
H = <#RecentOutsideTemp h=3> + 5/9 * (6.1094 * Math.exp(5417.753 *(1/273.16 - 1/ (273.16 + <#RecentDewPoint h=3> )))-10);
$apparent_temp   = -2.7 + (1.04 * $temp_degC) + (2 * $vapour_pressure) - ($wind_kph * 01.1805553);
 
if($temp_degC < 10)
Cumulus MX:
{
 
$feels_like = $wind_chill;
svp = 6.112 * Math.exp((17.62 * <#RecentOutsideTemp h=3) / (243.12 + parseFloat(<#RecentOutsideTemp h=3)));
}elseif($temp_degC > 20)
H = (5/9 * (<#RecentHumidity h=3> /100 * svp - 10)) + <#RecentOutsideTemp h=3;
{
 
$feels_like = $apparent_temp;
==== Apparent Temperature ====
}else{
 
$app_temp_mult = ($temp_degC - 10) / 10;
Note this formula uses Celsius for temperature and metres per second for wind speed. You will need to do the appropriate conversions if you use different units.  Formula is same for Cumulus 1 and MX.
$wind_chill_mult = 1 - $app_temp_mult;
 
$feels_like = ($apparent_temp * $app_temp_mult) + ($wind_chill * $wind_chill_mult);
var actualVaporPress = <#RecentHumidity h=3>/100) * 6.105 * Math.exp(17.27 * <#RecentOutsideTemp h=3>) / (237.7 + parseFloat(<#RecentOutsideTemp h=3>))));
}
var appTempDegC = parseFloat(<#RecentOutsideTemp h=3) + (0.33 * actualVaporPress) - (0.7 * <#RecentWindSpeed h=3>) - 4;
$return_array[0] = $apparent_temp;
 
$return_array[1] = $feels_like;
==== Feels Like ====
$return_array[2] = $wind_chill;
 
return $return_array;
Formula deleted, as only used from MX version 3.5.4 (25 Apr 2020) build 3075 until version 3.6.7 (4 June 2020) build 3083
}</pre>


==Today==
==Today==
5,838

edits