Webtags/Parameters (preserving history): Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
m
→‎Input modification Parameters: added beware taken from a forum post in July 2012
m (Text replacement - "[[Setting_up_Raspberry_Pi" to "[[MX_on_Linux")
m (→‎Input modification Parameters: added beware taken from a forum post in July 2012)
(5 intermediate revisions by the same user not shown)
Line 4: Line 4:


==What is a web tag? ==
==What is a web tag? ==
 
{{TOCright}}
Put simply, a [[Webtags|web tag]] is included in a [[Cumulus template file]] to indicate where Cumulus should insert values when it [[Customised_templates#What_is_meant_by_.27Cumulus_processes_templates.27|processes that template]] and produces an output file.  A '''Cumulus Template File''' is the name given by Steve Loft to any files that contain web tags, and need to be processed before they actually include values.  
Put simply, a [[Webtags|web tag]] is included in a [[Cumulus template file]] to indicate where Cumulus should insert values when it [[Customised_templates#What_is_meant_by_.27Cumulus_processes_templates.27|processes that template]] and produces an output file.  A '''Cumulus Template File''' is the name given by Steve Loft to any files that contain web tags, and need to be processed before they actually include values.  


Line 26: Line 26:
== What is a web tag parameter?==
== What is a web tag parameter?==


{{TOCright}}
 
Now we get to the terminology for what this Wiki page will document.
Now we get to the terminology for what this Wiki page will document.


Line 45: Line 45:
'''Most web tags do not require any input parameters'''.  
'''Most web tags do not require any input parameters'''.  


An input parameter is used where the same web tag can represent a value for a number of different past time instants. Each of those past time instants is represented by a different value for the input parameter. So a combination of web tag name and input parameter lets Cumulus to pick the value you want to see.  
* An input parameter is used where the same web tag can represent a value for a number of different past time instants.  
* Each of those past time instants is represented by a different value for the input parameter.  
* So a combination of web tag name and input modification parameter lets Cumulus select the value you want to see.
* The web tags that can use input modification parameters will depend on which Cumulus release you are using
* To supply both optional input modification, and optional output modification parameters, separate them with spaces, e.g. <#ByMonthTempHT mon=7 format=hh:nn>. In that example,  the time only is returned for the highest ever temperature in July, after processing by Cumulus of the time-stamp web tag.


There are currently only two groups of tags where an input parameter is mandatory:
{| class="wikitable" border="1"
#The [[Webtags#Recent_History|'''recent history tags''']] where a separate value exists for potentially every individual minute in last week.
|-
#* These tags need between one and three input parameters  as explained below.
!style="width:30px" | Web Tags
#The [[Webtags#Monthly_All_Time_Records|'''monthly all-time records''']] where a separate value exists for each particular month (of any year).
!style="width:100px" | Values Available
#*These tags need an input parameter specifying which month.
!style="width:300px" | Input Modification Parameters
#*To save you looking up the linked section, a single input parameter is needed (which is 1 for January to 12 for December, or 0 for current month).
!style="width:60px" | Introduced
 
!style="width:500px" | Examples
 
!style="width:600px" | Description
==Input Modification Parameters for Recent History tags ==
|-
 
| [[Webtags#Recent_History|'''recent history tags''']]
You specify which value you want from the array by using parameters on the web tags for number of days ago, hours ago, and minutes ago. The same d, h, and m, parameters are used by Cumulus 1 and MX.
| One value for each minute in last 7 days
 
|   '''d''' specifies number of days ago, '''h''' specifies number of hours ago, and '''m''' specifies number of minutes ago.  
All values supplied for parameters must be whole numbers.
* You can use any combination of the three parameters.
 
* The same d, h, and m, parameters are used by Cumulus 1 and MX.
If you don't supply any parameters, the result is undefined for Cumulus 1, and an illegal web tag for MX.  
| Cumulus 1.9.3 beta build 1033
 
| Examples for outside temperature:
<#RecentOutsideTemp m=1> will give the temperature one minute ago, <#RecentOutsideTemp h=1> will give the temperature one hour ago (as will <#RecentOutsideTemp m=60>).
* <#RecentOutsideTemp m=1> will give the temperature one minute ago, <#RecentOutsideTemp h=1> will give the temperature one hour ago (as will <#RecentOutsideTemp m=60>).
 
* <#RecentOutsideTemp d=1> will give the temperature one day ago. '''Please note:''' Some Cumulus users say that using <#RecentOutsideTemp  d=1 m=1> is more reliable at getting the temperature at a similar time the day before, the extra minute apparently gives better results when you might not be using Cumulus all the time, or your weather station might have some drift on when it supplies readings. See which works best for you.
<#RecentOutsideTemp d=1> will give the temperature one day ago. '''Please note:''' Some Cumulus users say that using <#RecentOutsideTemp  d=1 m=1> is more reliable at getting the temperature at a similar time the day before, the extra minute apparently gives better results when you might not be using Cumulus all the time, or your weather station might have some drift on when it supplies readings. See which works best for you.
* <#RecentOutsideTemp d=1 h=1 m=1> will give the temperature one day, one hour and one minute ago.
 
|All values supplied for parameters must be whole numbers.
<#RecentOutsideTemp d=1 h=1 m=1> will give the temperature one day, one hour and one minute ago.
* If you don't supply any parameters, the result is undefined for Cumulus 1, and an illegal web tag for MX.
 
* '''Please note that parameters specify time-stamped array element to retrieve based on counting back from current local time''' so the result for ''any period including when clocks change'' may not be quite what you anticipated.
'''Please note that parameters specify time-stamped array element to retrieve based on counting back from current local time''' so the result for ''any period including when clocks change'' may not be quite what you anticipated.
* When Cumulus is re-started the array it sets up will be based on reading any station log that exists, so the contents will initially have a resolution according to the logger interval you have set in Cumulus and/or your station.  You'll get the nearest value if you ask for a time for which there is currently no exact match, and the first tag [[Webtags#Recent_History|listed here]] tells you that nearest time.
 
* Before build 1098, the recent history array did not initialise correctly from the station logger for the period since Cumulus was last run.
 
* The input parameters are same for Cumulus 1 and Cumulus MX, they always use lower case d, h or m.
=== During catch-up ===
* The list of recent history web tags available has not changed between last Cumulus 1 release and any MX release.  
 
* Any new derivatives introduced by MX, will have current value web tags, and may have tags for extremes this month, extremes this year, all-time extremes, and monthly-all-time-extremes but do not have equivalent new recent history tags.
When Cumulus is re-started the array it sets up will be based on reading the logs, so the contents will initially have a resolution according to the logger interval you have set in Cumulus and/or your station.  You'll get the nearest value if you ask for a time for which there is currently no exact match, and the first tag listed tells you that nearest time.  
'''Beware: If you use <code><#RecentRainToday d=2></code> remember that rainfall can accumulate during a day, so "d=2" returns an estimate of the rain between rollover 2 days ago and the same time as now 48 hours ago, it does not return the total rainfall 2 days ago!'''
 
|-
=== Variations between Builds/Versions ===
| [[Webtags#Monthly_All_Time_Records|'''monthly all-time extreme records''']]
 
| These exist for all occurrences of the current month, and for all occurrences of each month
Before build 1098, the recent history array did not initialise correctly from the station logger for the period since Cumulus was last run.
|  '''mon=N''' where N is the index of the month of the year that you want the value for (1 =January, and so on, to 12 =December)  
 
| Cumulus 1.9.3 beta build 1033
The input parameters are same for Cumulus 1 and Cumulus MX, they always use lower case d, h or m.
| e.g. <#ByMonthDewPointH mon=3> is highest monthly dew point for any March and <#ByMonthDewPointHT mon=3> is the related time and date.
 
The list of tags available has not changed between last Cumulus 1 release and any MX release. Any new derivatives reported elsewhere have not resulted in equivalent new recent history tags.
 
==Input Modification Parameters for Monthly all-time tags==
 
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).  
 
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.
 
The corresponding date/time web tags are formatted just like the all time records. You can customise the date and time formats by adding the output  'format' modification parameters (shown later on this page) to the web tag.


To supply both optional input modification, and optional output modification parameters, separate them with spaces, e.g. <#ByMonthTempHT mon=7 format=hh:nn>. In that examplethe highest ever temperature in July is returned in the value after processing by Cumulus.
<#ByMonthTempH mon=3> gives highest temperature in any March, <#ByMonthTempHT mon=3> gives the date and time for that highest temperature
| Only one input parameter applies:
* The value of "N" supplied should be an integer between 1 and 12
* 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 process a script, to calculate the correct input parameter, before Cumulus processes the template.
|-
| Only <#SunshineHoursMonth> and <#SunshineHoursYear>
| Values available for current month/year, and for past month/year
| All web tags take '''r=-ww'''
* Monthly tags also take: '''m=N y=nnnn'''
* Yearly tags also take: '''y=nnnn'''
Omit input modification parameter to get value for current month/year
| MX release 3.12.0
| Monthly examples:
* <#SunshineHoursMonth> gives total sunshine hours since 1 minute past midnight at start of current month
* <#SunshineHoursMonth y=2021 m=1> for the January 2021 total
* <#SunshineHoursMonth r=-1> for last months total
* <#SunshineHoursMonth r=-12> for same month as current month, but one year ago
Yearly examples:
* <#SunshineHoursYear> gives total sunshine hours since 1 minute past midnight on New Year's Day
* <#SunshineHoursYear y=2019> for the total for 2019
* <#SunshineHoursYear r=-2> total for the year before last (if current year is 2021, that is same as previous example)
| Returns the sunshine hours total in selected period
|}


= Output modification parameters =
= Output modification parameters =
Line 137: Line 153:
|rc=n
|rc=n
|This is the default, so does not need to be specified. The output from the web tag will use either decimal comma or decimal point as specified by the locale in which MX is running
|This is the default, so does not need to be specified. The output from the web tag will use either decimal comma or decimal point as specified by the locale in which MX is running
| Both <#tempYH> and <#tempYH rc=n> will return yesterday's highest temperature using what is specified by locale to separate integer and decimal parts
|-
|-
|rc=y
|rc=y
|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.  
|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.  
| <#tempYH rc=y> will return yesterday's highest temperature as integer part then full stop then decimal part, regardless of local
|}
|}


5,838

edits

Navigation menu