Webtags (preserving history): Difference between revisions

m
(34 intermediate revisions by the same user not shown)
** but alternatively you can escape each verbatim character with a backslash as prefix (Cumulus MX).
* You may need to use both single quotes and back slashes in some format specifiers, depending whether the characters you want to include can be interpreted as control characters (yes, backslash is also used to escape control characters, so backslash will NOT work for some characters such as those in "on" and "at" [\n will produce new line not the letter n, \t will produce a tab not the letter t]), consequently for some characters you must use the literal approach to include them in your format.
 
==== Using HTML tags within format parameters (available in MX only) ====
 
'''Example using a class to change the look of part of the output'''
 
<pre><#TapptempH format="dd'&nbsp;'MMM'&nbsp;'yyyy'<span class=\'xx\'> at 'HH:mm'</span>'"></pre>
the output from this will look like ''04&nbsp;Dec&nbsp;2018<span class='xx'> at 10:12</span>''
 
'''Note where the quotes are, and where you need to use '\' escape characters'''.
 
'''Example using HTML tags'''
 
<pre><#RecentTS d=2 format="h:mm'&nbsp;'tt'<small>on' d/M/yyyy'</small>'"></pre>
This puts the date in a smaller font than the time
 
=== Output (format modifier) parameters for decimal places ===
 
 
Cumulus 1 allows use of <tt>dp=n</tt> modifier (where n represents desired number of decimal places for latitude and longitude e.g. <#latitude dp=5> gives "59.24250". This is also available in MX.
MX makes much more usage of these '''dp''' parameters. For example in the moon tags <#MoonAge> gives "11" but <#MoonAge dp=3> gives "11.234"
 
*<tt>dp=i</tt> is used for both Cumulus 1 and MX. The value '''i''' following the attribute '''dp''' is an integer, how many decimal places you want for the output you see. Only available for a limited range of web tags (latitude and longitude, plus in MX <#MoonPercent> and <#MoonPercentAbs>).
*<tt>tc=y</tt> is a new parameter only in MX, the attribute '''tc''' takes the value 'y' to remove decimal places by truncation instead of using <tt>dp=0</tt> which would round to nearest integer. e.g. <#MoonAge tc=y>. At present not available in any other web tags.
 
=== Output (format modifier) indicating remove commas ===
 
"rc=y" is a '''new parameter for MX''', the attribute '''rc''' takes the value 'y' to replace any commas defined by the locale with full stops to separate integer and decimal parts of the output value. It was initially only implemented on a few new web tags (#MoonPercent, #MoonPercentAbs, #MoonAge) for MX versions up to and including 3.5.3. From version 3.6.6 only can all web tags that can output real numbers can now use alternative syntax of <tt><#tag_name rc=y></tt> to replace all commas in the output by a full stop (don't worry, MX does not use a comma for separating off thousands, so it is the decimal comma that becomes a decimal full stop like character when this remove comma specifier is used.
 
 
Why would you want to remove decimal commas? Well because the JavaScript language cannot understand decimal commas, and MX has several scripts written in this language, equally some third party alternative web pages rely on ajax to update them (and Ajax uses JavaScript).
 
=== Additional text in output format partameters ===
 
You should put anything that is additional, to the defined format modifier specification below, into single quotation marks to prevent it being interpreted as a date or time format modifier:
 
#For example, the word "on" contains the character "n", which for Cumulus versions 1.9.1 to 1.9.4 will be interpreted as a time format modifier unless you put it into single quotation marks. Example of valid Cumulus 1 syntax: <#TtempH format="'at' hh: mm 'on' dd / mm / yyyy">.
#You can include HTML tags (but they cannot have any attributes because both single and double quote characters have defined meanings) and special characters as quoted text within the 'format' parameter.<br> Example of valid syntax: <#TapptempH format="'at 'h:nn'&nbsp;'am/pm '&lt;small&gt;on' d/m/yyyy'&lt;/small&gt;'">.
 
{{Version badge 1}}'''Note for Cumulus 1 - if your format has any spaces in it''', you must enclose the whole format parameter value in double quotes, for example (Cumulus 1.9.x): <#YearTempHT format="hh nn">. Consequently, you cannot include double quote characters in any other position (see [[Php_webtags#Web_tag_Complications| here for work-around]]).
 
[[File:Badge vMx.png]]Note for MX - you can use single quotation marks round spaces and text (e.g. ' on '), but you can also use '\' as escape character (e.g. for 'on' use '''\o\n'''). However for 'at' the only alternative is '''\a't'''' because the character t has another meaning and escape followed by a t becomes a tab!
 
=== List of allowed modifiers for output format parameters ===
|'xy' or ''\x\y''
|Characters enclosed in single quotation marks are displayed as such, and do not affect formatting. In MX each character to be displayed as it was typed can be prefixed by a backslash.
|HypensHyphens are added in this PHP language example '<#LastDataReadT format=yyyy>'.'-'.'<#LastDataReadT format=MM>'.'-'.'<#LastDataReadT format="dd">'
|}
 
==== Using HTML tags within format parameters (available in MX only) ====
 
'''Example using a class to change the look of part of the output'''
 
<pre><#TapptempH format="dd'&nbsp;'MMM'&nbsp;'yyyy'<span class=\'xx\'> at 'HH:mm'</span>'"></pre>
the output from this will look like ''04&nbsp;Dec&nbsp;2018<span class='xx'> at 10:12</span>''
 
'''Note where the quotes are, and where you need to use '\' escape characters'''.
 
'''Example using HTML tags'''
 
<pre><#RecentTS d=2 format="h:mm'&nbsp;'tt'<small>on' d/M/yyyy'</small>'"></pre>
This puts the date in a smaller font than the time
 
=== Output (format modifier) parameters for decimal places ===
 
 
Cumulus 1 allows use of <tt>dp=n</tt> modifier (where n represents desired number of decimal places for latitude and longitude e.g. <#latitude dp=5> gives "59.24250". This is also available in MX.
MX makes much more usage of these '''dp''' parameters. For example in the moon tags <#MoonAge> gives "11" but <#MoonAge dp=3> gives "11.234"
 
*<tt>dp=i</tt> is used for both Cumulus 1 and MX. The value '''i''' following the attribute '''dp''' is an integer, how many decimal places you want for the output you see. Only available for a limited range of web tags (latitude and longitude, plus in MX <#MoonPercent> and <#MoonPercentAbs>).
*<tt>tc=y</tt> is a new parameter only in MX, the attribute '''tc''' takes the value 'y' to remove decimal places by truncation instead of using <tt>dp=0</tt> which would round to nearest integer. e.g. <#MoonAge tc=y>. At present not available in any other web tags.
 
=== Output (format modifier) indicating remove commas ===
 
"rc=y" is a '''new parameter for MX''', the attribute '''rc''' takes the value 'y' to replace any commas defined by the locale with full stops to separate integer and decimal parts of the output value. It was initially only implemented on a few new web tags (#MoonPercent, #MoonPercentAbs, #MoonAge) for MX versions up to and including 3.5.3. From version 3.6.6 only can all web tags that can output real numbers can now use alternative syntax of <tt><#tag_name rc=y></tt> to replace all commas in the output by a full stop (don't worry, MX does not use a comma for separating off thousands, so it is the decimal comma that becomes a decimal full stop like character when this remove comma specifier is used.
 
 
Why would you want to remove decimal commas? Well because the JavaScript language cannot understand decimal commas, and MX has several scripts written in this language, equally some third party alternative web pages rely on ajax to update them (and Ajax uses JavaScript).
 
== Additional text in output format parameters ==
 
You should put anything that is additional, to the defined format modifier specification below, into single quotation marks to prevent it being interpreted as a date or time format modifier:
 
#For example, the word "on" contains the character "n", which for Cumulus versions 1.9.1 to 1.9.4 will be interpreted as a time format modifier unless you put it into single quotation marks. Example of valid Cumulus 1 syntax: <#TtempH format="'at' hh: mm 'on' dd / mm / yyyy">.
#You can include HTML tags (but they cannot have any attributes because both single and double quote characters have defined meanings) and special characters as quoted text within the 'format' parameter.<br> Example of valid syntax: <#TapptempH format="'at 'h:nn'&nbsp;'am/pm '&lt;small&gt;on' d/m/yyyy'&lt;/small&gt;'">.
 
{{Version badge 1}}'''Note for Cumulus 1 - if your format has any spaces in it''', you must enclose the whole format parameter value in double quotes, for example (Cumulus 1.9.x): <#YearTempHT format="hh nn">. Consequently, you cannot include double quote characters in any other position (see [[Php_webtags#Web_tag_Complications| here for work-around]]).
 
[[File:Badge vMx.png]]Note for MX - you can use single quotation marks round spaces and text (e.g. ' on '), but you can also use '\' as escape character (e.g. for 'on' use '''\o\n'''). However for 'at' the only alternative is '''\a't'''' because the character t has another meaning and escape followed by a "t" i.e. "\t" becomes a tab!
 
 
 
=The Web Tags for Cumulus =
These are available in both Cumulus 1 and MX unless indicated by a version 1 or MX badge.
 
Here follow tables indicating what web tags/tokens can be used, tables group the web tags/tokens available by the basic purpose of the tags listed.
 
 
=== System= ==
 
Special tags returning information about the Windows device hosting Cumulus 1. ''If you are running MX, then most tags do not work.
|}
 
== Miscellaneous ==
 
All tags are available in all flavours, as far as I know, although their output might vary, and which input/output parameters they permit might vary between Cumulus 1 and MX.
|-
|<#feelslike>
|Not available in Cumulus 1. Not available in all MX versions. Please see sub-section below this table regarding availability by MX versions if you are using a MX version earlier than 3.6.10.
|The current [[Feels_Like|Feels Like]] temperature. The referenced page in weather terminology section of this Wiki explains it. Although output from version 3.5.4 build 3075, the correct value is only available from version 3.6.10 (build 3086) onwards as incorrect formula used in builds 3084 and 3085, and a different formula used in builds from 3075 to 3083.
 
The current [[Feels_Like|Feels Like]] temperature. The referenced page in weather terminology section of this Wiki explains it.
|-
|<#IsFreezing>
|The same as <#currcond> but also has all characters above (decimal base) code 159 encoded as HTML entities for example this would encode any use of symbol for degree.
|}
==== Feels Like ====
 
The figures quoted for this derivative vary between versions:
* The first formula was used from MX version 3.5.4 (25 Apr 2020) build 3075 until version 3.6.7 (4 June 2020) build 3083
* The second formula, which was coded incorrectly, and so gave strange results, applied in versions 3.6.8 to 3.6.9 (build 3084, 3085)
* The third, and hopefully final, formula applies from version 3.6.10 (build 3086).
 
A php script for adding feels like as calculated in version 3.6.10 to any standard log line created either without feels like, or with an older calculation, can be downloaded from [https://cumulus.hosiene.co.uk/viewtopic.php?f=18&t=18096 Create Missing topic on support forum]
 
==Extra Sensors Davis (and a few others)==
|-
|<#RecentWindChill>
|Wind Chill (if temperature is below 10°C or 50 °F, then the new Feels Like now available in MX will report this same value).
|Wind Chill
| <#RecentWindChill d=48 m=1> reports the wind chill temperature 2 days ago
|-
| d=n (where n runs 0 to 6) days ago; h=n (where n is any number of hours ago); m=n (where n is any number of minutes ago)
|}
 
 
=== Other weather derivatives ===
H = (5/9 * (<#RecentHumidity h=3> /100 * svp - 10)) + <#RecentOutsideTemp h=3;
 
==== Apparent Temperature and Feels Like ====
 
Note this apparent temperature formula uses Celsius for temperature and '''metres per second''' for wind speed. You will need to do the appropriate conversions from the quoted recent history tags if you use different units. FormulaThe Australian Apparent temperature formula is same for Cumulus 1 and MX.:
 
var actualVaporPress = <#RecentHumidity h=3>/100) * 6.105 * Math.exp(17.27 * <#RecentOutsideTemp h=3>) / (237.7 + parseFloat(<#RecentOutsideTemp h=3>))));
var appTempDegC = parseFloat(<#RecentOutsideTemp h=3) + (0.33 * actualVaporPress) - (0.7 * <#RecentWindSpeed h=3>) - 4;
 
Feels Like as implemented at version 3.6.10 (see [[#Feels_Like|Feels Like section below Current condition web tags]]) uses Celsius for temperature and '''km per hour''' for wind speed. Again, you will need to do the appropriate conversions from the quoted recent history tags if you use different units.
==== Feels Like ====
 
Calculation from recent history tags is much more complicated because there are 3 different calculations: Feels Like reports exactly same as wind chill for temperatures '''below''' 10°C or 50°F so the WC here should equal <#RecentWindChill h=3>:
Formula deleted, as only used from MX version 3.5.4 (25 Apr 2020) build 3075 until version 3.6.7 (4 June 2020) build 3083
<pre>if(<#RecentWindSpeed h=3> < 4.828) WC = <#RecentOutsideTemp h=3>;
else{
wind_pow = Math.pow(<#RecentWindSpeed h=3>, 0.16);
WC = (13.12 + 0.1625 * <#RecentOutsideTemp h=3>) - (11.37 * wind_pow) + (0.3965 * <#RecentOutsideTemp h=3> * wind_pow);// Brackets used to ensure "+" is interpreted as addition not concatenation
} </pre>
 
For temperatures '''above''' 20°C or 68°F Feels Like uses a different way to calculate apparent temperature that it uses at these higher temperatures (this formula only used for 3.6.10 onwards):
<pre>var actualVaporPress = <#RecentHumidity h=3>/100) * 6.112* Math.exp((17.62 * <#RecentOutsideTemp h=3>)/(243.12 + <#RecentOutsideTemp h=3>)) / 10.0; // Not same as at build 3084
/* uses kilometres per hour for wind speed */
/* What Cumulus MX will use to calculate apparent temperature for feels like is changed very slightly */
if(<#RecentWindSpeed h=3> > 72) <#RecentWindSpeed h=3> =72;
AT= (1.04 * <#RecentOutsideTemp h=3>) + (2 * actualVaporPress) - (0.1805553 * <#RecentWindSpeed h=3>) - 2.7;</pre>
 
For in-between temperatures it uses a more complicated merge of the two formulas for AT and WC as defined above:
<pre>app_temp_mult = (<#RecentOutsideTemp h=3> - 10) / 10;
wind_chill_mult = 1 - app_temp_mult;
 
FL= AT * app_temp_mult + WC * wind_chill_mult;</pre>
 
==Today==
 
Many of these web tags are used on the supplied '''todayT.htm''' template, and the supplied '''todayyest.html''' page within the MX admin interface.
 
For web tags that report values that refer to a particular time of day, there is a corresponding web tag that can give the time of day, shown in same row of table below.
 
|-
!style="width:150px" | Web tag_name
!style="width:450px650px" | Function
!style="width:150px" | Time tag_name
|-
|-
|<#feelslikeTH>
|[[File:Badge vMx.png]] Available from version 3.6.010 Today's high feels like temperature
|<#TfeelslikeHTfeelslikeTH>
|-
|<#feelslikeLfeelslikeTL>
|[[File:Badge vMx.png]] Available from version 3.6.010 Today's low feels like temperature
|<#TfeelslikeLTfeelslikeTL>
|-
|<#heatindexTH>
 
==Yesterday==
 
Note that the Y indicating yesterday is sometimes a prefix, sometimes a suffix (with H for High, L for Low), web tags are not named consistently!
 
Many of these web tags are used on the supplied '''yesterdayT.htm''' template, and the supplied '''todayyest.html''' page within the MX useradmin interface.
 
For web tags that refer to a particular time of day, there is a corresponding web tag that can give the time of day. Please note none of the time web tags can be modified by output parameters to give a date, but they can be changed from the default time format that is 'h:mm'.
|-
!style="width:150px" | Web tag_name
!style="width:450px550px" | Function
!style="width:150px" | Time
|-
 
==Monthly==
This table shows the web tags used on the "thismonthT.htm" web page, the rainfall this month does not appear on that page, does not appear on that page, it is shown in [[#Current_Conditions|indexT.htm]] table earlier on this page.
 
This table shows the web tags used on the '''thismonthT.htm''' web page,and the '''records.html''' page (accessed by penultimate tab) in the admin interface.
The web tags in the date column output dates in the format "dd MMMM" (same for Cumulus 1 and Cumulus MX), this can be changed using the [[#Time.2FDate_.27format.27_Parameter|format parameters]] described above. For web tags that represent daily values, there are (obviously) no corresponding time web tags, but for high and low spot values the default 'h:mm' format of the time output can be changed using output parameters.
 
Because the rainfall this month does not appear on '''thismonthT.htm''' web page, it is shown in [[#Current_Conditions|indexT.htm]] table earlier in this article which is for the web page where it does appear.
 
The web tags in the date column output dates in the format "dd MMMM" (for once this is same for Cumulus 1 and Cumulus MX). Should you require a different output format, this can be changed using the [[#Time.2FDate_.27format.27_Parameter|format parameters]] described above. For web tags that represent daily values, there are (obviously) no corresponding time web tags, but for high and low spot values the default 'h:mm' format of the time output can be changed using output parameters. Do make sure that you get the web tag names right and the output form at parameters right.
 
As another example of inconsistency in how web tags added in different versions are coded, there are two web tags (highest minimum/lowest maximum temperatures) where a standard web tag is not provided by Cumulus (1 or MX) for the associated time-stamp. Consequently, for these 2 (and their corresponding tags in the this year group), there are mandatory output parameters required as shown in the table. Obviously Cumulus 1 lets you use "NN", "nn", "MM", or "mm" for the minutes, but minutes can only be represented in one way in Cumulus MX.
 
NB This table shows time of extremes for two daily figures (highest minimum/lowest maximum temperatures as of course these are actually associated with a particular time although a standard web tag was not provided for that), by including Cumulus time modifiers, and how minutes in time modifiers can be specified in two ways in Cumulus 1 but only in one way in Cumulus MX.
{| class="wikitable" border="1"
|-
 
==Yearly==
This table shows the web tags used on the "thisyearT.htm" web page, and the rainfall'''records.html''' this seasonpage (itaccessed needby notfinal start on 1 Januarytab) doesin notthe appearadmin on that page, it is shown on [[#Current_Conditions|indexT.htm]]interface.
 
Because the rainfall this year does not appear on '''thisyearT.htm''' web page, it is shown in [[#Current_Conditions|indexT.htm]] table earlier in this article which is for the web page where it does appear.
The default format for web tags in the date column is (like the monthly web tags) "dd MMMM" (same for Cumulus 1 and Cumulus MX), this can be changed using the [[#Time.2FDate_.27format.27_Parameter|format parameters]] described above. For web tags that represent daily values, there are (obviously) no corresponding time web tags, but for high and low spot values the default 'h:mm' format of the time output can be changed using output parameters.
 
The web tags in the date column output dates in the format "dd MMMM" (for once this is same for Cumulus 1 and Cumulus MX). Should you require a different output format, this can be changed using the [[#Time.2FDate_.27format.27_Parameter|format parameters]] described above. For web tags that represent daily values, there are (obviously) no corresponding time web tags, but for high and low spot values the default 'h:mm' format of the time output can be changed using output parameters. Do make sure that you get the web tag names right and the output form at parameters right.
NB Year runs from roll-over time on 1 January for all web tags listed here
 
As another example of inconsistency in how web tags added in different versions are coded, there are two web tags (highest minimum/lowest maximum temperatures) where a standard web tag is not provided by Cumulus (1 or MX) for the associated time-stamp. Consequently, for these 2 (and their corresponding tags in the this month group), there are mandatory output parameters required as shown in the table. Obviously Cumulus 1 lets you use "NN", "nn", "MM", or "mm" for the minutes, but minutes can only be represented in one way in Cumulus MX.
 
Remember that the Year-to-date runs from roll-over time on 1 January for all web tags listed here. Although, some web tags represent seasonal derivatives, i.e. where you define the month from which they start counting, this does not apply to any listed in this group.
 
 
!style="width:150px"|Web tag_name
!style="width:300px"|Function
!style="width:150px350px"|Time
!style="width:150px"|Date
|-
|<#YearMinTempH>
|This years highest daily minimum temperature
|Flavour specific mandatory output parameters:
|<#YearMinTempHD format=HH:nn> for Cumulus 1, <#YearMinTempHD format=HH:mm> for Cumulus MX
* <#YearMinTempHD format=HH:nn> ''for Cumulus 1'',
* <#YearMinTempHD format=HH:mm> ''for Cumulus MX''
|<#YearMinTempHD>
|-
|<#YearMaxTempL>
|This years lowest daily maximum temperature
|Flavour specific mandatory output parameters:
|<#YearMaxTempHD format=HH:nn> for Cumulus 1, <#YearMaxTempHD format=HH:mm> for Cumulus MX
* <#YearMaxTempHD format=HH:nn> ''for Cumulus 1'',
* <#YearMaxTempHD format=HH:mm> ''for Cumulus MX''
 
|<#YearMaxTempLD>
|-
 
==All Time==
The web tags in the date/time column have the default format seen on "records.htm". So for an extreme month it just shows the month name in full i.e. format 'MMMM'. For an extreme day it shows the day of the month and the month name in full i.e. format "dd MMMM" (same for Cumulus 1 and Cumulus MX), prefixed with the word 'on'. For the highest/lowest within a day in the year it shows both time and date adding the word "at" before the time, and the word 'on' before the date.
 
The web tags in the date/time column have the default format as seen on "records.htm" in the standard web pages.
You can change the default output using the [[#Time.2FDate_.27format.27_Parameter|formats features described above, but this can involve complicated use of single and double quotes and there are differences between Cumulus 1 and Cumulus MX.
 
These are also available in the admin interface on "records.html" where they appear in the first tab, although the format used there is different and not able to be edited (any time is shown after the date).
 
*The default format for an extreme month is to show the month name in full i.e. format 'MMMM' followed by the year in full.
*For an extreme day it shows the day of the month and the month name in full i.e. format "dd MMMM" (same for Cumulus 1 and Cumulus MX), prefixed with the word 'on' again ending with the year.
*For the highest/lowest within a day in the year it shows both time and date adding the word "at" before the time, and the word 'on' before the date (i.e. on the standard web page the time comes first, not as seen in admin interface).
 
You can change the default output on either the standard web template, or in your own file, by using the [[#Time.2FDate_.27format.27_Parameter|formats features described above, but this can involve complicated use of single and double quotes and there are differences between Cumulus 1 and Cumulus MX. Please see examples section above for advice.
 
Note that unlike the this month and this year web tags, the time and the date are both included in the default format of the standard time-stamp web tags for the 'highest minimum' and 'lowest maximum' temperatures, yet another inconsistency!
 
Note that unlike the monthly web tags, the time is included in the default format of the standard web tags for the 'highest minimum' and 'lowest maximum'.
{| class="wikitable" border="1"
|-
!style="width:150px" | Web tag_name
!style="width:300px400px" | Function
!style="width:150px" | Date/Time
|-
|-
|<#wchillH>
|All time greatest wind chill (i.e. lowest temperature, but highest wind speed)
|<#TwchillH>
|-
==Monthly All Time Records==
 
There are a set of tags for monthly all-time highs and lows, in other words the highest and lowest values for a particular month of the year. For example,To thesupply highest ever temperature in July. Each Value tag has anboth optional input, parameterand "mon=N"optional whereoutput Nparameters, isseparate thethem indexwith ofspaces, the month of the year that you want the value for (January=1 and so on)e.g. For example, <#ByMonthTempHByMonthTempHT mon=7 format=hh:nn>. willIn givethat example, you the highest ever temperature in July. is Thereturned corresponding date/time web tags are formatted likein the all time recordsvalue directlyafter aboveprocessing thisby sectionCumulus.
 
Each Monthly All Time Records web tag has an optional input parameter "mon=N" where N is the index of the month of the year that you want the value for (January=1 and so on). The corresponding date/time web tags are formatted like the all time records directly above this section. You can customise the date and time formats using the output 'format' parameter on the web tag.
If you don't supply a parameter (or supply an invalid value) the current month will be used. You can customise the date and time formats using the 'format' parameter on the web tag. To supply both input and output parameters, separate them with spaces, e.g. <#ByMonthTempHT mon=7 format=hh:nn>
 
If you don't supply an input parameter (or supply an invalid value like zero) the current month will be used. This is useful if you want to write a template that will always supply values for the current month and don't want to use a script to enter the correct input parameter by processing with that script before Cumulus processes the template.
 
 
|-
!style="width:150px"|Web tag_name
!style="width:300px400px"|Function
!style="width:150px"|Date/Time
|-
|-
|<#ByMonthWChillL>
|Greatest wind chill (i.e. lowest temperature and highest wind speed)
|<#ByMonthWChillLT>
|-
|-
!style="width:150px" | Web tag_name
!style="width:600px900px" | Function
|-
|<#sunrise>
5,838

edits