Feels Like: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
m (→‎Web implementation: Getting headings right)
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:


=Introduction=
=Introduction=

''Feels Like'' is a concept often quoted in weather forecasts, as the name suggests it attempts to quantify what a human detects as the warming or cooling effect.
''Feels Like'' is a concept often quoted in weather forecasts, as the name suggests it attempts to quantify what human skin detects as the temperature, taking into account any warming or cooling effect of exposure to different humidity levels, high wind, or shade/sunshine. The best way to quantify that has been discussed in many scientific papers following on from experimentation in various laboratories, and so different formulae have been used at different times as more is learnt about how the body reacts to different conditions.
A number of formulae are used, all involve the air temperature and at least one of the following:

All formulae involve the air temperature and at least one of the following variables as well as air temperature:
* (relative) humidity
* (relative) humidity
* wind (speed)
* wind (speed)
* sunshine (radiation)
* sunshine (radiation)
Look up [[Apparent_temperature]], [[Heat_index]], [[Humidex]], or [[Wind_chill]].
Davis stations also provide [[Webtags#Davis | THW index and THWS index ]]


= Web implementation =
Ever thought that you want to display a 'Feels Like' temperature?


The preferred expression varies as research into the effects of the 3 variables listed above on how temperature is perceived by bare skin on the human body continues. There has in the past been much divergence between different nations, but most now use that developed by scientists and medical experts on the Joint Action Group for Temperature Indices (JAG/TI).
# Would you like to display [[Wind chill]] when it is cold and windy, [[Heat index]] when it is hot and humid, and [[Apparent temperature]] at other times?

The official feels like temperature index formula of JAG/TI-2000 (temperature is measured at 1.50 metres, and wind speed at 10 metres, above ground):

<tt>G = 13.12 + 0.6215 x Temperature<sub>air in Celsius</sub> − (11.37 x (wind_speed<sub>m s<sup>-1</sup></sub> x 3.6)<sup>0.16</sup> + 0.3965 x Temperature<sub>air in Celsius</sub> x (wind_speed<sub>m s<sup>-1</sup></sub> x 3,6) x 2.3<sup>0.16</sup></tt>

Cumulus MX from version 3.6.0 fully supports (in terms of derived outputs just listed) another of the Joint Action Group for Temperature Indices (JAG/TI) formulae for '''feels like'''.

{{TOCright}}

= The various ways to express Feels Like =

#Different organisations use different formulae.
#All those calculations have been very popular, at different dates. Often used by many people, they may have been expressed using a distinctive name or called Feels Like temperature.
#You will find, when some of these formulae are quoted, that a year is given as well as the name.
#*This reflects that scientific advance refines the understanding of how the weather affects the human body, and this leads to a change in the definition of many of them.
#Consequently, the date of the relevant scientific paper or committee meeting is relevant to understanding how the named parameter was calculated.


Davis stations also provide, two other ways of expressing Feels Like, to the legacy Cumulus [[Webtags#Davis | THW index and THWS index ]] (former not available to MX).

You can research this in your own time. Here we are only concerned with what legacy Cumulus and its MX replacement do.

==How to express '''Feels Like''' if the air temperature is below 10 <sup>o</sup>Celsius (50 <sup>o</sup>Fahrenheit)==

* [[Wind chill]] is usually used for feels like (this ignores effects of humidity and sunshine)
** Some weather station calculate '''Wind Chill''' and supply it to Cumulus software, you can choose whether to use that or the derivative calculated by Cumulus
**Prior to 2001, Wind Chill was expressed in '''Watts metres<sup>-2</sup>''', a measure of the energy leaving your skin.
** The most recent formula expresses wind Chill as an equivalent temperature, this is formula known to Steve Loft, was that developed by scientists and medical experts on the Joint Action Group for Temperature Indices (JAG/TI) issued in November 2001. Steve said the legacy software used the "North American" formula as described by Wikipedia. This is because Canada used a different formula, with a closer relationship to just the air temperature, based on the effect of winds varying between different terrains.
** This Wind Chill Temperature is officially defined for temperatures at or below 10 °C (50 °F) and wind speeds above 4.828 kilometres per hour (3.0 mph) but below 177 kilometres per hour (110 mph)
**The legacy Cumulus formula (by default) calculates only within those limits: <math>T_\mathrm{wc}=13.12 + {(0.6215 * Temperature_\mathrm{air in Celsius}}) + (0.3965 * Temperature_\mathrm{air_in_Celsius} - 11.37) * /text{wind_speed}_\mathrm{km per hour} ^ {0.16}</math>
*** The various constants in that formula are based on assumptions about size of face, its height above ground, the speed a person moves at and body thermal conductance
** From Cumulus release version 3.6.10 build 3086, the same formula is used for both '''Feels like''' and (if it is asked to calculate it) '''Wind Chill'''
at such air temperatures.
**Wind Chill is greater if temperature gets lower, or wind speed gets higher

== How to express '''Feels Like''' for highest temperatures==

* There is much more divergence on what formula to use at higher temperature, reflecting that the highest temperature seen vary across the world, and because other factors like humidity also vary it is harder for Scientists to agree on what is the best way to measure effects.
** In the USA, a dimensionless [[Heat index]] measure is used, for temperatures above 27 °C (80 °F). The measure combines air temperature and relative humidity, and thus gives an indication of evaporation rate.
***From a very early build Cumulus used the formula exactly as defined in Wikipedia for heat index. <tt>HI = c_1 + c_2 x T°F + c_3 x RH + c_4 x T°F x R + c_5 x T<sup>2</sup> + c_6 * RH<sup>2</sup> + c_7 x T°F<sup>2</sup> x RH + c_8 x T°F x RH<sup>2</sup> + c_9 x T°F<sup>2</sup> x RH<sup>2</sup></tt>
***This was improved from version 1.9.0 (11 Sept 2010) in Cumulus 1 with a new formula covering a greater range of humidities accurately. Steve Loft did not document this change, however his MX beta source (as handed over to the community) uses Rothfusz adjustments to reduce the index reported if the relative humidity is below 13%, and he stated he created MX beta from a machine-level translation of Cumulus 1.9.4.
***The current MX release has not changed that MX beta code, it uses a minimum of 80 <sup>o</sup>Fahrenheit air temperature cut-off in MX, and on the assumption that this measure is only of interest in USA, the calculation is entirely done in Fahrenheit. Mark did remove any temperature conversion of output.
*** In the UK, with its cooler climate, some people use a modified formula for Heat Index with the cut-off revised to 20 <sup>o</sup>Celsius (68 <sup>o</sup>Fahrenheit). (All Cumulus releases, for temperatures below 80 <sup>o</sup>Fahrenheit, will show the air temperature wherever Heat Index would appear).
** In Canada, [[Humidex|Humidity Index]] also combines the effects of heat and humidity. The actual formula involves air temperature and dew point:
<tt>Humidity Index = Temperature<sup>air_in_Celsius</sup> + 5÷9 x 6.11 x 2.71828<sup>5417.7530</sup> x 1÷273.16 - 1÷273.15 + T<sup>{dew_in_Celsius</sup> - 10</tt>

:5417.7530 is a rounded constant based on the molecular weight of water, Enthalpy of vaporization|latent heat of evaporation, and the universal gas constant. The humidity adjustment approximately amounts to one Fahrenheit degree for every millibar by which the Vapour pressure of water(partial pressure of water) in the atmosphere exceeds 10 mb.

** In Australia, [[Apparent temperature]] uses a mathematical model of the effects of temperature, humidity, wind speed, and (optionally) solar radiation.
*** From Version 1.9.1 (6 April 2011) the original Cumulus implemented the 1971 formula by Steadman (without solar radiation) when reporting '''Apparent Temperature'''.
***All releases of MX use that same formula for any output labelled '''Apparent Temperature'''.
*** There are many alternative formulae for calculating the vapour pressure of water, so there is a certain lack of consistency in how any '''Feels Like Temperature''' based on ''Apparent Temperature'' is reported. Cumulus MX has tried various formulas for calculating vapour pressure.
***For versions 3.5.4 (25 Apr 2020 build 3075) to version 3.6.7 (4 June 2020 build 3083) of MX used a different formula for water vapour to that used for version 3.6.8 build 3084. These differences affected the calculation these releases did for '''Feels Like Temperature''' at higher air temperatures. Because these have been superseded, I have deleted the formula that was quoted here.

===How to express '''Feels Like''' when air temperature is above 20 <sup>o</sup>Celsius (68 <sup>o</sup>Fahrenheit)===

* From Cumulus release version 3.6.10 build 3086, Cumulus reports exactly same for both '''Feels like''' and '''Apparent Temperature'''
at such air temperatures.


===How to express '''Feels Like''' when air temperature is 10 <sup>o</sup>Celsius (50 <sup>o</sup>Fahrenheit) to 20 <sup>o</sup>Celsius (68 <sup>o</sup>Fahrenheit) inclusive===

*Traditionally, (as described in code provided at end of this page) [[Apparent temperature]] was considered the best indicator to use.
**This was because it was the only "feels like" derivative that the legacy Cumulus calculated in this temperature range
* The '''Feels Like temperature''' reported by MX within this range of air temperatures is calculated by applying a modification of the Wind Chill formula and adding in a modification of the Apparent Temperature (as used for higher temperatures)
** The two are blended together, so the weighting of the Wind Chill element decreases as you move up from the lower temperature limit, and the weighting of the Apparent temperature element increases as you move closer to the upper temperature limit.
** For versions 3.5.4 (25 Apr 2020 build 3075) to version 3.6.7 (4 June 2020 build 3083) of MX used a different formula for water vapour to that used for version 3.6.8 build 3084. These differences affected the calculation these releases did for '''Feels Like Temperature''' in this temperature range.
** From Cumulus release version 3.6.10 build 3086, the apparent temperature element (before weighting) is based on the same formula as used to report 'Apparent Temperature'.

=Support for these derivived parameters in daily extremes, monthly extremes, yearly extremes, all-time extremes, and monthly all-time extremes=

*The extent to which these different expressions for feels like are supported in Cumulus varies depending on which release you are running
*Earlier releases have limited support:
** Wind Chill (based on formula discussed above)
***Prior to version 1.8.8, Wind Chill was reported even if the calculated number made no sense because there was a problem with either the temperature or the wind speed being used
***Wind Chill is fully suported for lowest extreme (daily, monthly, monthly-all-time, yearly, and all-time) in releases from version 1.8.8 (1 Dec 2009), including all MX releases.
**The Canadian Humidity Index (Humidex)
*** is only available for "current conditions" in the legacy Cumulus
*** is fully supported for highest extreme (daily, monthly, monthly-all-time, yearly, and all-time) in releases from 3.7.0
**The USA Heat Index
*** is fully supported for both legacy Cumulus and MX
**The Australian Apparent Temperature (as reported when labelled as such)
***is fully supported for both lowest and highest extremes (daily, monthly, monthly-all-time, yearly, and all-time) from Version 1.9.1 (6 April 2011), including all MX releases.
**Feels like (as a separate derivative)
***Calculated correctly from Cumulus release version 3.6.10 build 3086, and is fully supported for both lowest and highest extremes (daily, monthly, monthly-all-time, yearly, and all-time)



<hr>



= Rest of this article =

The rest of this article was written for versions of Cumulus that did not report '''JAG/TI feels like''', and uses JavaScript for deciding whether to display Heat Index, Apparent Temperature, or Wind Chill, based on the current weather conditions. It was designed to work with standard Cumulus web templates that produce HTML and do not use PHP.


== Web implementation ==

#Want to display a 'Feels Like' temperature (and you are using a version of Cumulus that does not give you it) with a figure that is useful at all possible temperatures)?
# Would you like to display [[Wind chill]] when it is cold and windy, [[Heat index]] or [[Humidex]] when it is hot and humid, and [[Apparent temperature]] at other times?
#* (Note that Humidex is available if you want to display a feel like current coditions, but for highest on daily or longer period only heat Index is available in legacy Cumulus)
# Do you understand how to call JavaScript code from HTML?
# Do you understand how to call JavaScript code from HTML?
# Can you modify a Cascading [[Stylesheets]] (CSS) file to include new classes to define the appearance of various items?
# Can you modify a Cascading [[Stylesheets]] (CSS) file to include new classes to define the appearance of various items?
Line 17: Line 120:
If you can answer yes to all these questions, the following JavaScript code may be useful to you. Depending on the element id that it finds on your HTML page, it either inserts an appropriate 'Feels Like temperature' as a figure, or it draws up a temperature bar graph in the standard Cumulus style, but shows the current value for a parameter selected depending on the current conditions (although it also draws any maximum and/or minimum values of that parameter that are available).
If you can answer yes to all these questions, the following JavaScript code may be useful to you. Depending on the element id that it finds on your HTML page, it either inserts an appropriate 'Feels Like temperature' as a figure, or it draws up a temperature bar graph in the standard Cumulus style, but shows the current value for a parameter selected depending on the current conditions (although it also draws any maximum and/or minimum values of that parameter that are available).


If you can understand the standard Cumulus gaugesT.htm template, then you can use that as a starting point. You might want to modify that template page, or you might want to modify (or create) another template page.


===Modifying the table on "indexT.htm" to display a feels like figure ===
You need to include something like the script that appears at the bottom of the standard gaugesT.htm in respect of defining temperature, humidity and wind speed:
==HTML code to translate web tags to JavaScript variables (as modified for additional parameters)==
This is needed on any web page if you want to use the new script.
<pre><script>/* -------------------------------- Convert Cumulus tags into Javascript variables for selecting 'Feels Like' parameter------------------------------------- */
var tempscale= "<#tempunitnodeg>"; // This is temperature unit, it contains F or C (without the HTML code for degree because JavaScript cannot understand it)
var tempos = new Array("<#temp>","<#tempTL>","<#tempTH>","<#temptrendtext>","<#temptrendenglish>");/* OUTSIDE TEMPERATURE (current, today low, today high, trend description to display on mouseover, trend value to determine image to show) */
var ExtraSensor1Name = ""; /* Extra temperature/humidity sensor one name prefix */
var tempex1 = new Array("","","","");/* EXTRA TEMPERATURE ONE parameters (required even if not used) */
var ExtraSensor2Name = ""; /* Extra temperature/humidity sensor two name prefix */
var tempex2 = new Array("","","","");/* EXTRA TEMPERATURE TWO parameters (required even if not used) */
var TempColor = ""; // If set defines the bar chart column colour for standard Cumulus charts like dewpoint
var tempdp = new Array("<#dew>","<#dewpointTL>","<#dewpointTH>","","");/* DEW POINT (current, today low, today high) */
var tempapp = new Array("<#apptemp>","<#apptempTL>","<#apptempTH>","","");/* APPARENT TEMPERATURE (current, today low, today high)*/
var temphi = new Array("<#heatindex>","unavailable","<#heatindexTH>","","");/* HEAT INDEX (current, - , today high) */
var tempwc = new Array("<#wchill>","<#wchillTL>","unavailable","","");/* WIND CHILL (current, today low) */
var tempis = new Array("not used","","","");/* INDOOR TEMPERATURE (not used by feels like routine) */
var humos = new Array("<#hum>","<#humTL>","<#ThumTL>","<#humTH>", "<#ThumTH>");/* OUTSIDE HUMIDITY latest, minimum, time of minimum, maximum, time of maximum*/
// Wind histogram data (Modified from Cumulus original - needs more work as degree symbol giving warning messages on validation for HTML5)
var winddata = new Array("<#wgust>","<#bearing>","<#wspeed>","<#avgbearing>","<#wgustTM>", "<#windunit>", "<#bearingTM>&#176; at <#TwgustTM>");/* WIND SPEEDS (latest gust, its bearing, average wind speed, average bearing, maximum gust today, unit for wind speeds, bearing of maximum gust today with symbol for degrees, time of maximum gust) */
</script></pre>



== HTML amendment to call new script ==
[[File:Feels_like_numerical.png|200px|thumb|left|set of values]] The element <tt>id="variable_figure"</tt> in the replacement below would result in the numerical value being inserted as per screen image on left. Moving your mouse over the figure would display the information about the parameter being shown. This could be suitable for your 'now' page (the standard Cumulus indexT.htm displays wind chill, heat index and apparent temperature, but maybe you want to alter that?
Supposing you stored the new script below in a file called "temperature.js" in the same directory as the calling html, then the HTML needs a call to the new script (insert just before the end of the HTML body) like this:


===HTML amendment to call new script===

Supposing you stored the new script below in a file called "temperature.js" in the same directory as the calling html, then the HTML needs a call to the new script.

There are two options:
#Modify the "indexT.htm" template to include the extra value setting bit of script in it
#The insertion point is just before <tt>&lt;/head&gt;</tt>.
#Create a template file "temperatureT.js"
#* It will need to be added to the extra web file list, use browse to find it in the local box, put the right path to "temperature.js" in the remote box, mark "Process", mark "realtime" and "FTP" as you would for any other extra files.
#*It will include the value setting bit of script shown, then when Cumulus processes the JavaScript template it will replace the web tags included with variables so ensuring the variable names in the script have the correct values for the formulae in calculation bit of script shown

Look for:
<pre></body></pre>

Replace that with:
<pre><script src="temperature.js"></script>
<pre><script src="temperature.js"></script>
</body></pre>
</body></pre>
== Defining HTML insert position ==
The HTML needs an element id for determining where the script inserts the Feels Like data.
=== Option 1 - Modifying a table to display a figure ===
[[File:Feels_like_numerical.png|200px|thumb|left|set of values]]
The element id shown below would result in the numerical value being inserted as per screen image on left. Moving your mouse over the figure would display the information about the parameter being shown. This could be suitable for your 'now' page (the standard Cumulus indexT.htm displays wind chill, heat index and apparent temperature, but maybe you want to alter that? (Note this element id is not relevant to the gauges page, unless you want to display numerical values without a graphic).
=== HTML table rows to replace ===
<pre><tr class="td_temperature_data">
<td>Windchill</td>
<td><#wchill>&nbsp;<#tempunit></td>
<td>Humidity</td>
<td><#hum>%</td>
</tr>
<tr class="td_temperature_data">
<td>Heat Index</td>
<td><#heatindex>&nbsp;<#tempunit></td>
<td>Apparent Temperature</td>
<td><#apptemp>&nbsp;<#tempunit></td>
</tr></pre>
=== HTML code required for inserting figure ===
<pre><tr class="td_temperature_data"><td colspan="4" id="variable_figure" title="'Feels Like' - need to have JavaScript enabled for automatic selection of parameter to show here">
<small>Feels Like (title varies)</small> <br><!-- insert position for variable numerical value --></td></tr></pre>
=== Option 2 - Modifying the Gauges page to display a different bar chart ===
Perhaps you use the standard gaugesT.htm template, but want to change it so it displays an appropriate Feels Like graphic (see screen shot)?
[[File:Feels_like_graphic.png|50px|thumb|left|bar chart]]
Then you need to note the differences between the temperature and wind histogram data transfer shown above and that appearing at the foot of the standard Cumulus page. If you are able to cope with the necessary coding changes, you could replace the following code with the code that follows it (but there may be sizing issues to sort out).
=== HTML code for Inside Temperature can be replaced ===
<pre><td width="33%" align="center" bgcolor="#EFEFEF"><div id="insidetemp">small</div></td></pre>
=== HTML code required for varying chart ===
<pre><td class="plots"><div id="feels_like"></div></td></pre>
The class ''plots'' will need adding to the [[Stylesheet | CSS]], it could contain the width and align clauses that you removed or any other formatting you require.


====Script for setting values====
= New JavaScript Code required =
This script introduces a number of new classes, to move styling that in the standard Cumulus ''dashboard.js'' is defined inside the script, out to an external CSS. For brevity, the list of new classes is not listed here, it is assumed you know enough to work out the list yourself, and you will probably want to use your own styling anyway.
<pre><nowiki>/* ----------------------Apparent Temperature, Wind Chill or Heat Index-------------------*/
// --- variables required ---
var gauges_images=”dbimages”; // directory where temperature scale image is stored
var divid = new Array("outsidetemp","apptemp","dewpoint","heatindex","windchill","windchill/heatindex");var ddata = new Array(tempos, tempapp, tempdp, temphi, tempwc);var dColour = new Array("#c60","#f90","sienna","purple","cyan");var esn1 = "Extra Temperature 1";var esn2 = "Extra Temperature 2";if(ExtraSensor1Name) esn1 = ExtraSensor1Name + " Temperature";if(ExtraSensor2Name) esn2 = ExtraSensor2Name + " Temperature";var divti = new Array("Outside Temperature","Apparent Temperature",esn1,esn2,"Dew Point","Heat Index","Wind Chill");
var dtext =new Array("This routine automatically decides which parameter best represents the 'Feels Like' temperature by checking the maximum wind gust speed and the minimum and maximum temperature for this meteorological day.: These are used to pick between 'Wind Chill' (low minimum temperature, high wind gust), 'Heat Index' (high maximum temperature, ) and 'Apparent Temperature' (all other cases).",


If you are inserting into "indexT.htm" template, you must insert new lines just before <tt>&lt;/head&gt;</tt>. First type <tt>&lt;script&gt;</tt>; then type the code shown below, and finally type <tt>&lt;/script&gt;</tt>.
"Apparent Temperature (AT) is displayed when minimum temperature is not low enough (or wind not strong enough) to show 'Wind Chill' and maximum temperature (and/or humidity) not high enough to show 'Heat Index'. The AT is defined (in Australia) as; the temperature, at the reference humidity level, producing the same amount of discomfort as that experienced under the current ambient temperature and humidity: The (Australian) Apparent Temperature (AT) is calculated from a formula combining measurements of air temperature (Ta), wind speed (ws) and relative humidity (rh). &nbsp; AT = Ta + 0.33×rh / 100 × 6.105 × exp ( 17.27 × Ta / ( 237.7 + Ta ) ) - 1.57×ws - 4.0 Taking account of temperature, wind and humidity and using a dewpoint of 14&deg;C as a reference comfort level makes this a better indication of what your body feels than the other measures listed, but strictly it only applies in the shade.",


If you are creating a "temperatureT.js" template, then it should contain what is shown below as well as what is listed for the formulae part of "temperature.js".
"The (USA) Heat Index only applies if the actual temperature is at or above 27 °C (80 °F) and relative humidity peaks above 40% .: The index modifies air temperature using relative humidity in an attempt to determine the human-perceived equivalent temperature (how hot it feels).",


<pre>
"Wind Chill Temperature only applies for temperatures at or below 10 °C (50 °F) and wind speeds above 3.0 mph (4.8 kilometres per hour, 1.34 metres per second, or 2.6 knots) (it is selected if the outdoor temperature today is or has fallen below 10.5, 51 respectively and today's maximum measured gust has exceeded quoted figure).: Wind Chill modifies air temperature using wind speed in an attempt to determine the exposed skin-perceived equivalent temperature (how cold it feels).");
var tempscale= "<#tempunitnodeg>"; // This is temperature unit, it contains F or C (without the HTML code for degree because JavaScript cannot understand it)
//---------------------------------------------------------------
var air_temp = "<#RCtemp>"; /* OUTSIDE TEMPERATURE */
function dovariablebarchart(eidh){
var m, n, mo=[], tu = "°" + tempscale;
var temp_wc = "<#RCwchill>"; // wind chill
var app_temp = Math.round(<#RCtemp> + (0.33 * (<#RChum> / 100 * 6.105 * exp (17.27 * <#RCtemp> / (237.7 + <#temp>) ))) - (0.7 * $RCwspeed) - 4.0, 2); /* Not provided in remove commas option directly, but if you use decimal points, not decimal commas then the right hand side can be simplified to '''"<#apptemp>";''' */
/*-- some javascript code that inserts 'Apparent Temperature' normally; but replaces that with 'Wind Chill' if minimum temperature is below 12 degrees Celsius, or replaces it with 'Heat Index' if maximum temperature is above 24 degrees Celsius */
var humidex = Math.round(<#RCtemp> + 5/9 * (6.1094 * Math.exp(5417.753 * ((1/273.16) - 1/(273.16 + <#RCdew>)))) - 10); // based on temperature over 15 in Celsius, remove "5/9 *" term if you use Fahrenheit
var heat_index = "<#RCheatindex>"; // can choose to use this instead of previous
var wind_speed_unit = "<#windunit>";
var wind_gust_speed = "<#wgust>"; // for wind chill, here consider highest wind speed, could use average instead
</pre>

====Script for doing formulae and inserting text into HTML====

The following script is loaded when the browser has finished creating the table structure (that is why the call to this script is placed just before <pre></body></pre>.

if you are writing a script template, then the code shown above will be needed at the start of the script, otherwise the browser will have set the Javascript values when it processed <tt>&lt;/head&gt;</tt>.

The code shown below does two tasks:
#It uses formulae within conditions to determine by examing the current air temperature, what to show for feels like
#It uses instructions to modify what the browser is showing so the blank table cells on the page show the right title and the right value

<pre>
var m, n, tu = " °" + tempscale;
/* are units Celsius or Fahrenheit? */
/* are units Celsius or Fahrenheit? */
if(tempscale=="C"){ // Celsius
if(tempscale=="C"){ // Celsius
n= 10.5; // wind chill
n= 10.5; // wind chill
m = 27; // heat index
m = 15; // humidex
u = 27; // heat index
}else{ // Fahrenheit
}else{ // Fahrenheit
n = 51; // wind chill
n = 51; // wind chill
m = 80; // heat index
m = 60; // humidex
u = 80; // heat index
}
}
var label, value, display_unit;
var gust;
if(air_temp < n)
switch(winddata[5]){
{
case "mph" : gust=3.0; break;
label = "Wind Chill";
case "km/h" : gust=4.8; break;
display_unit = tu;
case "m/s" : gust= 1.34; break;
value = temp_wc;
case "kts" : gust=2.6 ; break;
}else if(air_temp > m) // replace m by u if want heat index
default : gust=0.0;
{
label = "Humidex"; // if want replace "Humidex" by "Heat Index"
display_unit = "";
value = humidex; // if want replace humidex by heat_index
}else{
label = "Apparent";
display_unit = tu;
value = app_temp;
}
if(document.getElementById("fl_label"))
{
eidh=document.getElementById("fl_label");
eidh.innerHTML += label;// variable title written
}
}

var motext = dtext[1];var modata = ddata[1];var selectid = divid[1];var selectColour = dColour[1];var tit=divti[1];// apparent is default plot
if(document.getElementById("variable_figure"))
if((tempos[2] > m) && (humos[3] > 40)) { // check maximum
{
motext = dtext[2];modata = ddata[3];selectid = divid[3];selectColour = dColour[3];tit=divti[5]; //heat index plot
eidv=document.getElementById("variable_figure");
} else if ((tempos[1] <n) && (gust < winddata[4])) { // check minimum temp and maximum wind gust
eidv.innerHTML += value;// variable value written
motext = dtext[3];modata = ddata[4];selectid = divid[4];selectColour = dColour[4];tit=divti[6]; // wind chill plot
}// end of if else group checking minimum and maximum temperatures
mo[0]=dtext[0];eidh.title ="header=["+'<img class="vam" src="'+gauges_images+'/information.png" alt=" graphic with little i representing information">'+"Feels Like ("+tu+")] body=["+getmo(mo)+"]";eidh.innerHTML += tit;// variable title written, check if summary page, if so appropriate figure is required and heading box requires a title
if(document.getElementById("variable_figure")){eidw=document.getElementById("variable_figure");n=modata[1];if(!isNaN(n)){ // check if minimum measurement is available
n =", "+"Min="+modata[1] + " °" + tempscale;} else {n="";}m=modata[2];if(!isNaN(m)){ // check if maximum measurement is available
m =", "+"Max="+modata[2] + " °" + tempscale;} else {m="";}eidw.innerHTML=("Latest="+modata[0] + " °" + tempscale+n+m);mo[0]=motext;eidw.title="header=["+'<img class="vam" src="'+gauges_images+'/information.png" alt=" graphic with little i representing information">'+tit+" ("+tu+")] body=["+getmo(mo)+"]";} // end of summary page coding
// rest of function only followed if bar chart to be drawn
if(document.getElementById("windchill/heatindex")){eidw=document.getElementById("windchill/heatindex");var size=eidw.innerHTMLdotemps(tit,selectid,eidw,size,modata, motext, selectColour);}} // end of function
//------------------------------------------------------------------------------
//variables for mouseover popup
var mod =0;//mouseover popup delay (msecs))
var fst = "position:relative; cursor:pointer; ";
var tds = "font-family: Verdana,Arial,Helvetica; font-size: 9px; color: #000055; "
//------------------------------------------------------------------------------
/* COMMON SUBROUTINE used by ALL CALLS FOR MOUSE OVER TEXT to create body table when using BOXOVER script */
function getmo(mot){
// Based on script included with Cumulus, but modified to use classes to refer to external Cascading Style Sheet instead of style attributes embedded in script – see comments that follow
var st = " ";
st += "<table class='b_green cmo'>"; // defines a background colour
for (var j=0;j<mot.length;j++){
st += "<tr><td class='labels'>"; // for example labels could be bold and have a background colour
st += mot[j].substring(0,mot[j].indexOf(":")+1); // Extract string up to colon into first cell of row
st += "</td><td class='site-data'>";// numbers are centered or whatever suits you
st += mot[j].substring(mot[j].indexOf(":")+1); // Extract string after colon into second cell of row
st += "</td></tr>";
}
st += "</table>";
return st;
}
}
/* ------------------------ ALL TEMPERATURE BASED BAR CHARTS ------------------ */
function dotemps(tit,id,eid,size,data, text, nowColour){
var tgd,factor, bottom, scale, maxm, t, h, l, r, tu, val, fst= "position:relative; cursor:pointer; ";
if(size=="small"){
tgd="<div id='"+id+"' style='"+fst+"width:90px;'><img
src='”+gauges_images+”/thermos.gif''></div>”;
factor=2;
bottom=195;
}else{
tgd="<div id='"+id+"' style='"+fst+"width:90px;'><img src='”+gauges_images+”/thermol.gif'></div>";
factor=1;
bottom=375;
}
eid.parentNode.innerHTML=tgd;
eid=document.getElementById(id);
tu = "°" + tempscale;
if(tempscale=="C"){ // Celsius
scale=3.6/factor;
maxm=60;
}else{ // Fahrenheit
scale=2/factor;
maxm=140;
}
var valnow= parseFloat(data[0]);
t=parseInt(((maxm - valnow) * scale)+16);
h=(bottom-t)+1;// calculate length of column (origin is top left, so draw downwards)
l=25; // left hand end of horizontal lines for maximum
r=66; // right hand end of horizontal lines for minimum
// Other end of horizontal lines for maximum and minimum set at 45 - Modified so lines do not overlap and always show
var jg=new jsGraphics(id);
jg.setColor(nowColour || "#cc9"); // column fill colour taken from either calling code or default here
var mo = new Array()
var c = 0;
mo[c]=text; // descriptive text re observation or calculation
c++; // increment array index
if(!isNaN(t)){ // check if measurement is numerical
jg.fillEllipse(36,(bottom-16),20,20); // bulb of thermonmeter added by SFWS
jg.fillRect(41,t,9,h); // left and width of column plot are constants
mo[c]="<span class='sienna'>Current:</span>"+valnow+" "+tu; // semi-colon separates cells of table
} else mo[c]="Current temperature: Not Available"; // colon separates cells of table
c++;
if(data[1]){ // if minimum available
jg.setColor("navy");
jg.setStroke(2);
val= parseFloat(data[1]);
t=parseInt(((maxm - val)*scale)+16);
if(!isNaN(t))jg.drawLine(45,t,r,t);
mo[c]="<span class='navy'>Minimum This Meteorological Day:</span>"+val+" "+tu;
c++;
}
if(data[2]){ // if maximum available
jg.setColor("red");
jg.setStroke(2);
val=parseFloat(data[2]);
t=parseInt(((maxm - val)*scale)+16);
if(!isNaN(t))jg.drawLine(l,t,45,t);
mo[c]="<span class='red'>Maximum This Meteorological Day:</span>"+val+" "+tu;
c++;
if(tempscale=="C"){
val=Math.round((parseFloat(data[2])*1.8)+32)
mo[c]="<span class='red'>Maximum after conversion:</span>"+val+" "+"°" +"Farenheit";
c++;
}
}
if(data[3]){ // if trend available
jg.drawImage('gauges_images/'+data[4]+'.gif',41,8,9,29);// Modified (different rising/falling images and different position so trend visible at top!) data[4] is fixed text to determine filename
mo[c]="Trend:"+data[3];// data[3] uses text that can be set in 'samplestrings.ini'
}
jg.paint();
eid.title="header=["+'<img class="vam" src="'+gauges_images+'/information.png" alt=" graphic with little i representing information">'+tit+" ("+tu+")] body=["+getmo(mo)+"]";
}
/* -------------------------------------------------------------------------------------------
Note that the code works for all temperature and wind speed units permitted by Cumulus, 'variable_figure' is id for HTML where numbers to be written (perhaps on indexT.htm template page) and "feels_like" is id for HTML element where graphic to be drawn (normally on gaugesT.htm template page)
------------------------------------------------------ */
// --- tabular display ---
if(document.getElementById("variable_figure")){
eidh=document.getElementById("variable_figure");
// call subroutine that determines which figures are to be displayed
dovariablebarchart(eidh)
}
// --- multipurpose bar chart ---
if(document.getElementById("feels_like")){
eidh=document.getElementById("feels_like");
// call subroutine that determines which bar chart is to be plotted
dovariablebarchart(eidh)
}</nowiki>
</pre>
</pre>

==== HTML table rows to replace ====

<pre>
<tr class="td_temperature_data">
<td>Windchill</td>
<td><#wchill>&nbsp;<#tempunit></td>
<td>Humidity</td>
<td><#hum>%</td>
</tr>
<tr class="td_temperature_data">
<td>Humidex</td>
<td><#humidex></td>
<td>Apparent Temperature</td>
<td><#apptemp>&nbsp;<#tempunit></td>
</tr></pre>


==== Replacement HTML code required for inserting figure ====


<pre>
<tr class="td_temperature_data">
<td id="fl_label"></td>
<td id="variable_figure"></td>
<td>Humidity</td>
<td><#hum>%</td>
</tr></pre>







[[User:Sfws|Sfws]] 18:53, 27 December 2012 (UTC)
[[User:Sfws|Sfws]] 18:53, 27 December 2012 (UTC)
[[Category:WebTools]]
[[Category:User Contributions]]
[[Category:Terminology]]

Latest revision as of 10:03, 15 April 2021


Introduction

Feels Like is a concept often quoted in weather forecasts, as the name suggests it attempts to quantify what human skin detects as the temperature, taking into account any warming or cooling effect of exposure to different humidity levels, high wind, or shade/sunshine. The best way to quantify that has been discussed in many scientific papers following on from experimentation in various laboratories, and so different formulae have been used at different times as more is learnt about how the body reacts to different conditions.

All formulae involve the air temperature and at least one of the following variables as well as air temperature:

  • (relative) humidity
  • wind (speed)
  • sunshine (radiation)


The preferred expression varies as research into the effects of the 3 variables listed above on how temperature is perceived by bare skin on the human body continues. There has in the past been much divergence between different nations, but most now use that developed by scientists and medical experts on the Joint Action Group for Temperature Indices (JAG/TI).

The official feels like temperature index formula of JAG/TI-2000 (temperature is measured at 1.50 metres, and wind speed at 10 metres, above ground):

G = 13.12 + 0.6215 x Temperatureair in Celsius − (11.37 x (wind_speedm s-1 x 3.6)0.16 + 0.3965 x Temperatureair in Celsius x (wind_speedm s-1 x 3,6) x 2.30.16

Cumulus MX from version 3.6.0 fully supports (in terms of derived outputs just listed) another of the Joint Action Group for Temperature Indices (JAG/TI) formulae for feels like.

The various ways to express Feels Like

  1. Different organisations use different formulae.
  2. All those calculations have been very popular, at different dates. Often used by many people, they may have been expressed using a distinctive name or called Feels Like temperature.
  3. You will find, when some of these formulae are quoted, that a year is given as well as the name.
    • This reflects that scientific advance refines the understanding of how the weather affects the human body, and this leads to a change in the definition of many of them.
  4. Consequently, the date of the relevant scientific paper or committee meeting is relevant to understanding how the named parameter was calculated.


Davis stations also provide, two other ways of expressing Feels Like, to the legacy Cumulus THW index and THWS index (former not available to MX).

You can research this in your own time. Here we are only concerned with what legacy Cumulus and its MX replacement do.


How to express Feels Like if the air temperature is below 10 oCelsius (50 oFahrenheit)

  • Wind chill is usually used for feels like (this ignores effects of humidity and sunshine)
    • Some weather station calculate Wind Chill and supply it to Cumulus software, you can choose whether to use that or the derivative calculated by Cumulus
    • Prior to 2001, Wind Chill was expressed in Watts metres-2, a measure of the energy leaving your skin.
    • The most recent formula expresses wind Chill as an equivalent temperature, this is formula known to Steve Loft, was that developed by scientists and medical experts on the Joint Action Group for Temperature Indices (JAG/TI) issued in November 2001. Steve said the legacy software used the "North American" formula as described by Wikipedia. This is because Canada used a different formula, with a closer relationship to just the air temperature, based on the effect of winds varying between different terrains.
    • This Wind Chill Temperature is officially defined for temperatures at or below 10 °C (50 °F) and wind speeds above 4.828 kilometres per hour (3.0 mph) but below 177 kilometres per hour (110 mph)
    • The legacy Cumulus formula (by default) calculates only within those limits:
      • The various constants in that formula are based on assumptions about size of face, its height above ground, the speed a person moves at and body thermal conductance
    • From Cumulus release version 3.6.10 build 3086, the same formula is used for both Feels like and (if it is asked to calculate it) Wind Chill

at such air temperatures.

    • Wind Chill is greater if temperature gets lower, or wind speed gets higher

How to express Feels Like for highest temperatures

  • There is much more divergence on what formula to use at higher temperature, reflecting that the highest temperature seen vary across the world, and because other factors like humidity also vary it is harder for Scientists to agree on what is the best way to measure effects.
    • In the USA, a dimensionless Heat index measure is used, for temperatures above 27 °C (80 °F). The measure combines air temperature and relative humidity, and thus gives an indication of evaporation rate.
      • From a very early build Cumulus used the formula exactly as defined in Wikipedia for heat index. HI = c_1 + c_2 x T°F + c_3 x RH + c_4 x T°F x R + c_5 x T2 + c_6 * RH2 + c_7 x T°F2 x RH + c_8 x T°F x RH2 + c_9 x T°F2 x RH2
      • This was improved from version 1.9.0 (11 Sept 2010) in Cumulus 1 with a new formula covering a greater range of humidities accurately. Steve Loft did not document this change, however his MX beta source (as handed over to the community) uses Rothfusz adjustments to reduce the index reported if the relative humidity is below 13%, and he stated he created MX beta from a machine-level translation of Cumulus 1.9.4.
      • The current MX release has not changed that MX beta code, it uses a minimum of 80 oFahrenheit air temperature cut-off in MX, and on the assumption that this measure is only of interest in USA, the calculation is entirely done in Fahrenheit. Mark did remove any temperature conversion of output.
      • In the UK, with its cooler climate, some people use a modified formula for Heat Index with the cut-off revised to 20 oCelsius (68 oFahrenheit). (All Cumulus releases, for temperatures below 80 oFahrenheit, will show the air temperature wherever Heat Index would appear).
    • In Canada, Humidity Index also combines the effects of heat and humidity. The actual formula involves air temperature and dew point:

Humidity Index = Temperatureair_in_Celsius + 5÷9 x 6.11 x 2.718285417.7530 x 1÷273.16 - 1÷273.15 + T{dew_in_Celsius - 10

5417.7530 is a rounded constant based on the molecular weight of water, Enthalpy of vaporization|latent heat of evaporation, and the universal gas constant. The humidity adjustment approximately amounts to one Fahrenheit degree for every millibar by which the Vapour pressure of water(partial pressure of water) in the atmosphere exceeds 10 mb.
    • In Australia, Apparent temperature uses a mathematical model of the effects of temperature, humidity, wind speed, and (optionally) solar radiation.
      • From Version 1.9.1 (6 April 2011) the original Cumulus implemented the 1971 formula by Steadman (without solar radiation) when reporting Apparent Temperature.
      • All releases of MX use that same formula for any output labelled Apparent Temperature.
      • There are many alternative formulae for calculating the vapour pressure of water, so there is a certain lack of consistency in how any Feels Like Temperature based on Apparent Temperature is reported. Cumulus MX has tried various formulas for calculating vapour pressure.
      • For versions 3.5.4 (25 Apr 2020 build 3075) to version 3.6.7 (4 June 2020 build 3083) of MX used a different formula for water vapour to that used for version 3.6.8 build 3084. These differences affected the calculation these releases did for Feels Like Temperature at higher air temperatures. Because these have been superseded, I have deleted the formula that was quoted here.

How to express Feels Like when air temperature is above 20 oCelsius (68 oFahrenheit)

  • From Cumulus release version 3.6.10 build 3086, Cumulus reports exactly same for both Feels like and Apparent Temperature

at such air temperatures.


How to express Feels Like when air temperature is 10 oCelsius (50 oFahrenheit) to 20 oCelsius (68 oFahrenheit) inclusive

  • Traditionally, (as described in code provided at end of this page) Apparent temperature was considered the best indicator to use.
    • This was because it was the only "feels like" derivative that the legacy Cumulus calculated in this temperature range
  • The Feels Like temperature reported by MX within this range of air temperatures is calculated by applying a modification of the Wind Chill formula and adding in a modification of the Apparent Temperature (as used for higher temperatures)
    • The two are blended together, so the weighting of the Wind Chill element decreases as you move up from the lower temperature limit, and the weighting of the Apparent temperature element increases as you move closer to the upper temperature limit.
    • For versions 3.5.4 (25 Apr 2020 build 3075) to version 3.6.7 (4 June 2020 build 3083) of MX used a different formula for water vapour to that used for version 3.6.8 build 3084. These differences affected the calculation these releases did for Feels Like Temperature in this temperature range.
    • From Cumulus release version 3.6.10 build 3086, the apparent temperature element (before weighting) is based on the same formula as used to report 'Apparent Temperature'.

Support for these derivived parameters in daily extremes, monthly extremes, yearly extremes, all-time extremes, and monthly all-time extremes

  • The extent to which these different expressions for feels like are supported in Cumulus varies depending on which release you are running
  • Earlier releases have limited support:
    • Wind Chill (based on formula discussed above)
      • Prior to version 1.8.8, Wind Chill was reported even if the calculated number made no sense because there was a problem with either the temperature or the wind speed being used
      • Wind Chill is fully suported for lowest extreme (daily, monthly, monthly-all-time, yearly, and all-time) in releases from version 1.8.8 (1 Dec 2009), including all MX releases.
    • The Canadian Humidity Index (Humidex)
      • is only available for "current conditions" in the legacy Cumulus
      • is fully supported for highest extreme (daily, monthly, monthly-all-time, yearly, and all-time) in releases from 3.7.0
    • The USA Heat Index
      • is fully supported for both legacy Cumulus and MX
    • The Australian Apparent Temperature (as reported when labelled as such)
      • is fully supported for both lowest and highest extremes (daily, monthly, monthly-all-time, yearly, and all-time) from Version 1.9.1 (6 April 2011), including all MX releases.
    • Feels like (as a separate derivative)
      • Calculated correctly from Cumulus release version 3.6.10 build 3086, and is fully supported for both lowest and highest extremes (daily, monthly, monthly-all-time, yearly, and all-time)




Rest of this article

The rest of this article was written for versions of Cumulus that did not report JAG/TI feels like, and uses JavaScript for deciding whether to display Heat Index, Apparent Temperature, or Wind Chill, based on the current weather conditions. It was designed to work with standard Cumulus web templates that produce HTML and do not use PHP.


Web implementation

  1. Want to display a 'Feels Like' temperature (and you are using a version of Cumulus that does not give you it) with a figure that is useful at all possible temperatures)?
  2. Would you like to display Wind chill when it is cold and windy, Heat index or Humidex when it is hot and humid, and Apparent temperature at other times?
    • (Note that Humidex is available if you want to display a feel like current coditions, but for highest on daily or longer period only heat Index is available in legacy Cumulus)
  3. Do you understand how to call JavaScript code from HTML?
  4. Can you modify a Cascading Stylesheets (CSS) file to include new classes to define the appearance of various items?

If you can answer yes to all these questions, the following JavaScript code may be useful to you. Depending on the element id that it finds on your HTML page, it either inserts an appropriate 'Feels Like temperature' as a figure, or it draws up a temperature bar graph in the standard Cumulus style, but shows the current value for a parameter selected depending on the current conditions (although it also draws any maximum and/or minimum values of that parameter that are available).


Modifying the table on "indexT.htm" to display a feels like figure

set of values

The element id="variable_figure" in the replacement below would result in the numerical value being inserted as per screen image on left. Moving your mouse over the figure would display the information about the parameter being shown. This could be suitable for your 'now' page (the standard Cumulus indexT.htm displays wind chill, heat index and apparent temperature, but maybe you want to alter that?


HTML amendment to call new script

Supposing you stored the new script below in a file called "temperature.js" in the same directory as the calling html, then the HTML needs a call to the new script.

There are two options:

  1. Modify the "indexT.htm" template to include the extra value setting bit of script in it
  2. The insertion point is just before </head>.
  3. Create a template file "temperatureT.js"
    • It will need to be added to the extra web file list, use browse to find it in the local box, put the right path to "temperature.js" in the remote box, mark "Process", mark "realtime" and "FTP" as you would for any other extra files.
    • It will include the value setting bit of script shown, then when Cumulus processes the JavaScript template it will replace the web tags included with variables so ensuring the variable names in the script have the correct values for the formulae in calculation bit of script shown

Look for:

</body>

Replace that with:

<script src="temperature.js"></script>
</body>

Script for setting values

If you are inserting into "indexT.htm" template, you must insert new lines just before </head>. First type <script>; then type the code shown below, and finally type </script>.

If you are creating a "temperatureT.js" template, then it should contain what is shown below as well as what is listed for the formulae part of "temperature.js".

var tempscale= "<#tempunitnodeg>"; // This is temperature unit, it contains F or C (without the HTML code for degree because JavaScript cannot understand it)
var air_temp = "<#RCtemp>"; /* OUTSIDE TEMPERATURE */
var temp_wc = "<#RCwchill>"; // wind chill
var app_temp =  Math.round(<#RCtemp> + (0.33 * (<#RChum> / 100 * 6.105 * exp (17.27 * <#RCtemp> / (237.7 + <#temp>) ))) - (0.7 * $RCwspeed) - 4.0, 2); /* Not provided in remove commas option directly, but if you use decimal points, not decimal commas then the right hand side can be simplified to '''"<#apptemp>";''' */
var humidex =  Math.round(<#RCtemp> + 5/9 * (6.1094 * Math.exp(5417.753 * ((1/273.16) - 1/(273.16 + <#RCdew>)))) - 10); // based on temperature over 15 in Celsius, remove "5/9 *" term if you use Fahrenheit
var heat_index = "<#RCheatindex>";  // can choose to use this instead of previous
var wind_speed_unit = "<#windunit>";
var wind_gust_speed = "<#wgust>";  // for wind chill, here consider highest wind speed, could use average instead

Script for doing formulae and inserting text into HTML

The following script is loaded when the browser has finished creating the table structure (that is why the call to this script is placed just before

</body>

.

if you are writing a script template, then the code shown above will be needed at the start of the script, otherwise the browser will have set the Javascript values when it processed </head>.

The code shown below does two tasks:

  1. It uses formulae within conditions to determine by examing the current air temperature, what to show for feels like
  2. It uses instructions to modify what the browser is showing so the blank table cells on the page show the right title and the right value
var m, n, tu = " °" + tempscale;
/* are units Celsius or Fahrenheit? */
if(tempscale=="C"){ // Celsius
n= 10.5; // wind chill
m = 15; // humidex
u  = 27; // heat index
}else{ // Fahrenheit
n = 51; // wind chill
m = 60; // humidex
u = 80; // heat index
}
var label, value, display_unit;
if(air_temp < n)
{
    label = "Wind Chill";
    display_unit = tu;
    value = temp_wc;	
}else if(air_temp > m)  // replace m by u if want heat index
{
    label = "Humidex"; // if want replace "Humidex" by "Heat Index"
    display_unit = "";
    value = humidex; // if want replace humidex by heat_index
}else{
   label = "Apparent";
    display_unit = tu;
   value = app_temp;   
} 
if(document.getElementById("fl_label"))
{
   eidh=document.getElementById("fl_label");
   eidh.innerHTML += label;// variable title written
}

if(document.getElementById("variable_figure"))
{
   eidv=document.getElementById("variable_figure");
   eidv.innerHTML += value;// variable value written
}

HTML table rows to replace

<tr class="td_temperature_data">
    <td>Windchill</td>
    <td><#wchill> <#tempunit></td>
    <td>Humidity</td>
    <td><#hum>%</td>
</tr>
<tr class="td_temperature_data">
    <td>Humidex</td>
    <td><#humidex></td>
    <td>Apparent Temperature</td>
    <td><#apptemp> <#tempunit></td>
</tr>


Replacement HTML code required for inserting figure

<tr class="td_temperature_data">
      <td id="fl_label"></td>
      <td id="variable_figure"></td>
      <td>Humidity</td>
      <td><#hum>%</td>
 </tr>




Sfws 18:53, 27 December 2012 (UTC)