Feels Like: Difference between revisions

3,922 bytes removed ,  13 April 2021
m
no edit summary
mNo edit summary
 
 
=Introduction=
 
* sunshine (radiation)
 
== The various ways to express Feels Like ==
 
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).
Most versions of Cumulus output [[Wind chill]], [[Heat index]], [[Humidex|Humidity Index]], [[Apparent temperature]], and now MX also outputs "Feels Like". All of these are different formulae. All have been very popular and used as measures for Feels Like at different dates by people. You will find when some of these formulae are quoted that a year is given as well as the name, as the definition of many of them has varied as the years past, so the date of the relevant scientific paper or committee meeting is relevant to understanding how the named parameter was calculated.
 
The official feels like temperature index formula of JAG/TI-2000 (temperature is measured at 1.50 metres, and wind speeed at 10 metres, above ground):
The extent to which these different expressions for feels like are supported in Cumulus varies. Not all are fully supported (fully supports means derived maxima and minima outputs are available for each day, each month, each year, monthly all time, and all-time), and none of them allow you to set alarms for when it passes a particular threshold. For example Humidity Index (Humidex) is available only for current conditions. The greatest Wind Chill (highest wind speed, lowest temperature) is available for daily, monthly, yearly, monthly-all-time, and all-time.
 
<math>G_\mathrm{J} = 13.12 + 0.6215∗Temperature_\mathrm{air in Celsius} − (11.37∗(/text{wind_speed}_\mathrm{m s<sup>-1</sup>}∗3,6) ^0.16 + 0.3965∗Temperature_\mathrm{air in Celsius}∗(/text{wind_speed}_\mathrm{m s<sup>-1</sup>}∗3,6) * 2.3^0.16</math>
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 divergence between different nations, but most now use what Cumulus MX from version 3.6.0 fully supports (in terms of derived outputs just listed) for feels like. This is a variant on wind chill (good when temperature below 50 <sup>o</sup>F [10 <sup>o</sup>C]) and apparent temperature (good in range 20 to 28 <sup>o</sup>C), and was defined by the Joint Action Group for Temperature Indicators (JAG/TI) which is the formula used in the UK, Iceland, Australia, USA, and Canada, amongst others. As already mentioned MX uses same formula for what it reports as Wind Chill, and for what it reports as Feels like when temperature is below 10 °C (50 °F). Unfortunately, MX uses different formulae for Feels like when temperature is 10 °C (50 °F) or above; these formulae depend on version:
# versions 3.5.4 (25 Apr 2020 build 3075) to version 3.6.7 (4 June 2020 build 3083)
# version 3.6.8 build 3084
# version 3.6.10 build 3086
 
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'''.
Because of these changes, I have deleted the formula that was quoted here.
 
{{TOCright}}
 
= The various ways to express Feels Like =
The official formula of JAG/TI-2000 is:
G(J) = 13,12+0,6215∗T−11,37∗(W∗3,6)0,16+0,3965∗T∗(W∗3,6)0,16(2.3) where air temperature, T, is in °C, is measured at 1.50 metres, and wind speed, W, is in m/s as measured at 10 metres.
 
#Different organisations use different formulae.
== Rest of this article ==
#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.
 
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.
 
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).
Version 3.6.0 and all earlier versions of MX, and versions of Cumulus 1 since those shown, support earlier definitions for feels like:
*From Version 1.9.1 (6 April 2011) [[Apparent_temperature]], this index was introduced by Steadman in 1971 who later revised his formula and many implementations use his later 1998 formula. Cumulus adopted the Australian Bureau of Meteorology implementation of Steadman formula.
*Although [[Heat_index]] was available in earlier versions, it was improved from version 1.9.0 (11 Sept 2010) in Cumulus 1 with a new formula covering a greater range of humidities accurately.
*Although [[Humidex]] was available in earlier versions, it was first correctly implemented from version 1.8.9 (31 Mar 2010).
*Although [[Wind_chill]] was available in earlier versions, it was only from version 1.8.8 (1 Dec 2009) that Cumulus included it on graphs after introducing in same version (earlier build) a check that wind speed and temperature readings were available.
 
You can research this in your own time. Here we are only concerned with what legacy Cumulus and its MX replacement do.
Davis stations also provide [[Webtags#Davis | THW index and THWS index ]], other ways of expressing Feels Like.
 
==How to express '''Feels Like''' if the air temperature is below 10 <sup>o</sup>Celsius (50 <sup>o</sup>Fahrenheit)==
= Web implementation =
 
* [[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.<math>\mathrm{HI} = c_1 + c_2 T\text{°F} + c_3 R + c_4 T\text{°F} R + c_5 T^2 + c_6 * RH^2 + c_7 * T_\text{°F}^2 * RH + c_8 * T_\text{°F} * RH^2 + c_9 * T_\text{°F}^2 * RH^2</math>
***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:
<math>\text{Humidity Index} = Temperature_\mathrm{air_in_Celsius} + \frac{5}{9} \left[6.11\times 2.71828^{5417.7530 \left(\frac{1}{273.16} - \frac{1}{273.15+T_\text{dew_in_Celsius}}\right)} - 10\right]</math>
 
: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 {{convert|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 superceded, 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?
# 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).
 
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>
</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>
[category:Terminology]
 
====Script for setting values====
=== Option 2 - Modifying the Gauges page to display a different bar chart ===
Perhaps you use the standard Cumulus 1 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).
 
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>.
=== HTML code for Inside Temperature can be replaced ===
Take out
<pre><td width="33%" align="center" bgcolor="#EFEFEF"><div id="insidetemp">small</div></td></pre>
so you have space in the table to insert your new code, without having to redesign the whole table in '''indexT.htm'''.
 
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".
=== 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.
 
<pre>
== New JavaScript Code required ==
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
</pre>
 
====Script for doing formulae and inserting text into HTML====
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).",
 
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>.
"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 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 (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).",
 
The code shown below does two tasks:
"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).");
#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
function dovariablebarchart(eidh){
 
var m, n, mo=[], tu = "°" + tempscale;
<pre>
/*-- 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 */
/* are units Celsius or Fahrenheit? */
if(tempscale=="C"){ // Celsius
n= 10.5; // wind chill
m = 27; // heat index
}else{ // Fahrenheit
n = 51; // wind chill
m = 80; // heat index
}
var gust;
switch(winddata[5]wind_speed_unit){
case "mph" : gust=3.0; break;
case "km/h" : gust=4.8; break;
default : gust=0.0;
}
var m, n, tu = " °" + tempscale;
var motext = dtext[1];var modata = ddata[1];var selectid = divid[1];var selectColour = dColour[1];var tit=divti[1];// apparent is default plot
/* are units Celsius or Fahrenheit? */
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
} else if ((tempos[1] <n) && (gust < winddata[4])) { // check minimum temp and maximum wind gust
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
n= 10.5; // wind chill
scale=3.6/factor;
m = 15; // humidex
maxm=60;
u = 27; // heat index
}else{ // Fahrenheit
n = 51; // wind chill
scale=2/factor;
m = 60; // humidex
maxm=140;
u = 80; // heat index
}
var label, value, display_unit;
var valnow= parseFloat(data[0]);
if(air_temp < n)
t=parseInt(((maxm - valnow) * scale)+16);
{
h=(bottom-t)+1;// calculate length of column (origin is top left, so draw downwards)
label = "Wind Chill";
l=25; // left hand end of horizontal lines for maximum
display_unit = tu;
r=66; // right hand end of horizontal lines for minimum
value = temp_wc;
// Other end of horizontal lines for maximum and minimum set at 45 - Modified so lines do not overlap and always show
}else if(air_temp > m) // replace m by u if want heat index
var jg=new jsGraphics(id);
{
jg.setColor(nowColour || "#cc9"); // column fill colour taken from either calling code or default here
label = "Humidex"; // if want replace "Humidex" by "Heat Index"
var mo = new Array()
display_unit = "";
var c = 0;
value = humidex; // if want replace humidex by heat_index
mo[c]=text; // descriptive text re observation or calculation
}else{
c++; // increment array index
label = "Apparent";
if(!isNaN(t)){ // check if measurement is numerical
display_unit = tu;
jg.fillEllipse(36,(bottom-16),20,20); // bulb of thermonmeter added by SFWS
value = app_temp;
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
if(document.getElementById("fl_label"))
} else mo[c]="Current temperature: Not Available"; // colon separates cells of table
{
c++;
eidh=document.getElementById("fl_label");
if(data[1]){ // if minimum available
eidh.innerHTML += label;// variable title written
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
if(document.getElementById("variable_figure"))
jg.setColor("red");
{
jg.setStroke(2);
eidv=document.getElementById("variable_figure");
val=parseFloat(data[2]);
eidv.innerHTML += value;// variable value written
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>
 
==== 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)
[[Category:User Contributions]]
5,838

edits