Webtags (preserving history): Difference between revisions

m
→‎Recent History: sequence change
m (→‎Recent History: sequence change)
Line 1,030: Line 1,030:
'''Please note that parameters specify time-stamped array element to retrieve based on counting back from current local time''' so the result for ''any period including when clocks change'' may not be quite what you anticipated.
'''Please note that parameters specify time-stamped array element to retrieve based on counting back from current local time''' so the result for ''any period including when clocks change'' may not be quite what you anticipated.


=== 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.
<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 ===
Line 1,142: Line 1,111:
| 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 ===
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>


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

edits