Webtags (preserving history): Difference between revisions

m
→‎Recent History: Update for release 3.10.5 onwards
m (→‎Recent History: Update for release 3.10.5 onwards)
Line 864: Line 864:
==Recent History==
==Recent History==


While Cumulus is left running, from version 1.9.3 (beta build 1033 release 10 April 2012), every minute a set of current spot values is stored.  This '''high resolution data''' is kept for seven days, with the oldest set being discarded each time a new set is added.
Please refer to the [[Recent history]] page for information about what the tags in the following table represent.  


There is one tag name listed in the table below for each weather derivative available at the release you are running.  You pick the time in minutes ago using an input modification parameter choosing from those listed at [[Webtags/Parameters#Input Modification Parameters for Recent History]]. You can specify 1 to 10 079 minutes ago, and (to save dealing with large numbers) you can specify this using a combination of input parameters representing integer days, integer hours, and integer minutes.
===Using input/output modification parameters with recent history tag names===


===What happens when I need to stop and restart Cumulus?===
All tag names listed below, require the mandatory input modification parameters specified in this table. All, except the first tag name listed, can take optional
 
{| class="wikitable" border="1"
This depends on the release you are running.
|-
 
!style="width:15px" | Tag names
The graph images that Cumulus 1 generates, the data for the detailed charts that MX can plot, and various internal calculations that MX makes, and indeed the recent history web tags themselves, all access data for the recent past.  That data is available at one minute intervals, since you started Cumulus, because of this recent history functionality. But if those charts, or calculations, need to include a period before Cumulus was started, then they might be using archive data obtained from your weather station.
!style="width:200px" | Mandatory Input Modification Parameters
 
!style="width:200px" | Optional Output Modification Parameters
====MX release 3.12.0 (beta build 3134) onwards====
|-
 
| <#RecentTS>
The recent history is stored in a SQLite3 database table [[cumulusmx.db#Release 3.12.0 onwards|RecentData]] and therefore if you stop MX, the recent history data up to the time MX stopped has become persistent, and is available when MX starts again. Thus the charts, and internal calculations, mentioned above can make use of recent history data from the previous Cumulus session.
| Please see table at [[Webtags/Parameters#Input_modification_Parameters]]
 
| Please see tables starting at [[Webtags/Parameters#Multiple_Output_Format_Modifier_parameters_for_times_and_dates]]
When you do restart MX, if your weather station can store historic data, then its logger is read during the restart as archive data for the period since MX was last running until the time of restart, and obviously only available at the resolution of that historic data (be it every 10 minutes, or every 30 minutes or whatever).
|-
 
| All other tag names in next table
If MX was stopped for a short period, then on restarting MX, the '''RecentData''' table will be updated by discarding any rows over 7 days old, and for the times during the '''short period''' adding that archive data at whatever station logging interval resolution is available.
| Please see table at [[Webtags/Parameters#Input_modification_Parameters]]
 
| Depends on release you are using:
If Cumulus MX is offline for a prolonged period, (and when you first run 3.12.0, as the '''RecentData''' table does not yet exist) then all the data for the previous just over 10 thousand minutes will be at this lower station logging interval resolution.
* From release 3.10.5: Please see table at [[Webtags/Parameters#Output_Modification_Parameter_for_changing_any_decimal_comma_into_a_decimal_point]] and [[Webtags/Parameters#Two_Output_.28format_modifier.29_parameters_for_decimal_places]]
 
* For legacy Cumulus, and earlier MX releases, no output format modification parameters are available, instead see [[#No_Commas]] section on this page.
====Legacy release 1.9.3 to MX 3.11.4====
|}
 
The 'recent historical data' is based on an array stored by the Cumulus code, it is actually held in a [https://cumulus.hosiene.co.uk/viewtopic.php?p=100098#p100098 SQLite database], but the database is held '''in-memory''', not as an external database, so it only exists while Cumulus is running.  Therefore, if Cumulus stops, all the high resolution data is lost.
 
When you do restart MX, if your weather station can store historic data, then its logger is read during the restart as archive data for the period from 7 days ago until the time of restart, and obviously only available at the station logging interval resolution of that historic data (be it every 10 minutes, or every 30 minutes or whatever).
 
===If the derivative you want is not available in your Cumulus release===
 
As Cumulus has developed, it has been able to calculate more [[Feels Like|weather derivatives]] and more recent history tag names have become available (sometimes recent history tag names have been added in a later release than the release that started calculated the derivative).
 
Following the table giving the tag names actually available, there is a section on how to derive a few more weather derivatives using a combination of the tag names shown.
 
===Warning when Daylight Saving Time starts or ends===
 
Note that Cumulus uses current time, read from the computer, for recent history records.
 
For version 1.9.3 to release 3.11.4, current time determines which array element is used for storing the set of values. Hence ''when clocks go back'' the value stored for winter time overwrites the value previously stored for same time during summer time for the relevant repeating hour.
 
Hence even if you use 10am for your rollover time in summer (so all your days, even when clock changes happen, are 24 hours long), you will not have access to a whole hour worth of data when the clocks change
* ''when the clocks go back'', one hour has been overwritten; or
* ''when the clocks go forward'', one hour in the array simply does not exist.
 
One assumes the same applies from release 3.12.0, but it depends how MX has been coded, as a SQLite3 database uses row numbers as its primary key, and could technically therefore retain the missing hour.
 
=== Table of Recent History web tags available ===


=== Table of Recent History tag names available ===


[[#No_Commas]] versions of the array are available for use in script. If you use MX, the tag names in this table can take a [[Webtags/Parameters#Output Modification Parameter for Removing Commas|rc=y]] parameter.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 1,009: Line 985:
| d=n (where n runs 0 to 6) days ago; h=n (where n is any number of hours ago); m=n (where n is any number of minutes ago)
| d=n (where n runs 0 to 6) days ago; h=n (where n is any number of hours ago); m=n (where n is any number of minutes ago)
|}
|}
=== Other weather derivatives ===
Although Humidex, 'Apparent Temperature', 'Feels Like temperature' and others listed in Current Conditions section, are not available at all versions, they can be calculated in a script from recent 'outside temperature', 'wind speed', and 'relative humidity' values (using the same time selection for all). There are other derivatives that can be calculated similarly from a set of simultaneous values. Note that Cumulus 1 and MX do not always use identical formula, and although MX added Feels Like it has changed the formula a few times.
The relevant formulae using JavaScript, adjust for other languages, for some of these are shown below:
==== Canadian Humidity Index ====
If you are in USA and use Fahrenheit instead of Celsius, you will need to omit the 5/9 term, but as the index is dimensionless no other conversion is needed. This example is for 3 hours ago, change the input parameters to suit your need.
Cumulus 1:
H = <#RecentOutsideTemp h=3> + 5/9 * (6.1094 * Math.exp(5417.753 *(1/273.16 - 1/ (273.16 + <#RecentDewPoint h=3> )))-10);
Cumulus MX:
svp = 6.112 * Math.exp((17.62 * <#RecentOutsideTemp h=3) / (243.12 + parseFloat(<#RecentOutsideTemp h=3)));
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.  The 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 was implemented as a recent history web tag at version 3.6.11 (see [[#Feels_Like|Feels Like section below Current condition web tags]]) for the gradual introduction of feels like elsewhere. For earlier MX versions, and if you are using Cumulus 1, you can calculate it:
The formulas below use 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.
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>:
<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>


== System ==
== System ==
5,838

edits