Version 1.9.4 and AnnualDataSummary: Difference between pages
m (Build 1095) |
m (spelling) |
||
| Line 1: | Line 1: | ||
<big>Release Date: 27 October 2013 (build 1085)</big><br /> |
|||
Latest Patch Update: 1 May 2014 (build 1095) |
|||
<br /><br /> |
|||
<big>Release History</big> |
|||
Revision as of 22:41, 27 November 2012 |
|||
February 27, 2013 (b1061)<br /> |
|||
Name: Annual Data Summary |
|||
March 16, 2013 (b1062)<br /> |
|||
Type: HTML & Javascript |
|||
March 19, 2013 (b1063)<br /> |
|||
Author: David Jamieson |
|||
March 25, 2013 (b1064)<br /> |
|||
Contact: DAJ |
|||
March 28, 2013 (b1065)<br /> |
|||
Last update: 7 March 2011 |
|||
March 30, 2013 (b1066)<br /> |
|||
Version: 1.1 |
|||
April 07, 2013 (b1067)<br /> |
|||
April 09, 2013 (b1068)<br /> |
|||
April 17, 2013 (b1069)<br /> |
|||
April 23, 2013 (b1070)<br /> |
|||
April 28, 2013 (b1071)<br /> |
|||
May 04, 2013 (b1072)<br /> |
|||
May 10, 2013 (b1073)<br /> |
|||
May 11, 2013 (b1074)<br /> |
|||
May 12, 2013 (b1075)<br /> |
|||
May 12, 2013 (b1076)<br /> |
|||
May 23, 2013 (b1077)<br /> |
|||
May 24, 2013 (b1078)<br /> |
|||
May 27, 2013 (b1079)<br /> |
|||
June 03, 2013 (b1080)<br /> |
|||
July 09, 2013 (b1081)<br /> |
|||
July 09, 2013 (b1082)<br /> |
|||
September 12, 2013 (b1083)<br /> |
|||
September 16, 2013 (b1084)<br /> |
|||
October 27, 2013 (b1085) - Production release <br /> |
|||
December 16, 2013 (b1086) - Patch update<br /> |
|||
January 15, 2014 (b1087) - Patch update<br /> |
|||
January 28, 2014 (b1088) - Patch upgrade<br /> |
|||
March 05, 2014 (b1089) - Patch upgrade<br /> |
|||
April 07, 2014 (b1090) - Patch upgrade<br /> |
|||
April 11, 2014 (b1091) - Patch upgrade<br /> |
|||
April 20, 2014 (b1092) - Patch upgrade<br /> |
|||
April 27, 2014 (b1093) - Patch upgrade<br /> |
|||
April 28, 2014 (b1094) - Patch upgrade<br /> |
|||
Updated by BCJKiwi: |
|||
Changes from version 1.9.3: |
|||
{{AddOnBanner|name=Annual Data Summary|type=HTML & Javascript|author=David Jamieson|contact=[[User:Daj|DAJ]]<br>updated=7 March 2011<br>version=1.1|updated=17 December 2012|version=1.2 BCJKiwi}} |
|||
---- |
|||
1061 |
|||
*Initial support for Instromet weather stations. See http://instromet.co.uk/ This has had limited testing so far and is likely to require bug fixes and further enhancement. |
|||
*Change row highlight colour on dayfile.txt editor to make more obvious |
|||
*Show 'wet bulb' as mouseover on dew point figure on main screen |
|||
*Ensure 'today's rain' chart axis always starts at zero |
|||
*Don't try to process a standard template file if it's been deleted |
|||
*Allow 'EES' for 'ESE' in easyweather.dat to work around bug in someone else's software |
|||
*Added logging to debug.log of entries read from easyweather.dat |
|||
*Individual 'bad' sensor readings from Fine Offset no longer cause all data to be discarded. Watch out for possible bugs! |
|||
*Support for HTTP proxies - completely untested and will probably need further work. Feedback requested! |
|||
1062 |
|||
*Fix 'create missing' bug in dayfile.txt editor when 0900/1000 rollover in use |
|||
*Make sure PWS weather responses get logged |
|||
*Change Instromet logger interval if changed in Cumulus, not just at start up |
|||
*Web tag <#RecentTS>. Takes parameters like the 'recent data' web tags (e.g. <#RecentOutsideTemp>) and gives the timestamp of the data that will be returned for those web tags with the supplied parameters (it may not have the data for the exact time specified). Format can be specified in the usual way with the 'format' parameter. |
|||
Example: |
|||
Using the existing tag like this <#RecentOutsideTemp h=1 m=1> will give the nearest available temperature on or after one hour and one minute ago. |
|||
The new tag <#RecentTS h=1 m=1> will give the time and date of the nearest available data on or after one hour and one minute ago. |
|||
*'Replaced Comma' versions of the 'recent history' web tags (the others are integers): |
|||
<#RCRecentOutsideTemp> |
|||
<#RCRecentWindSpeed> |
|||
<#RCRecentWindGust> |
|||
<#RCRecentWindLatest> |
|||
<#RCRecentWindChill> |
|||
<#RCRecentDewPoint> |
|||
<#RCRecentHeatIndex> |
|||
<#RCRecentPressure> |
|||
<#RCRecentRainToday> |
|||
<#RCRecentUV> |
|||
*Select-A-Graph now has units in titles |
|||
*Calibration setting for wet bulb temp (when read directly from station) |
|||
'''An updated article, that supersedes this one is called [[Daily_Summary]]''' |
|||
1063 |
|||
*Fix thread crash after PWS Weather upload (bug introduced in build 1062) |
|||
'Annual Data Summary' is a small tool to read the [[dayfile.txt]] produced by Cumulus and summarise this in a table, arranged like a calendar, showing a full years worth of a selected criterion such as maximum daily temperature. |
|||
1064 |
|||
*Add 'rain since midnight' to monthly log files (this is for 0900/1000 'rollover' users; normally same as rain today for 'midnight rollover' users) |
|||
*The tool uses HTML, jQuery (a library script that produces Javascript) and a CSS file. |
|||
1065 |
|||
*The JavaScript version does not require a webserver with PHP services enabled. (Many of the free hosting services do not offer PHP so this was a solution to that problem). |
|||
*Fix 'rain last hour' and 'rain last 24 hours' being slightly too high after a restart, when a rain multiplier greater than 1 is in use |
|||
*The alternative is a PHP version (included so you have the option to use either). |
|||
*Fix saving of HTTP proxy settings |
|||
*Both provide identical looking output and functionality, however if you have PHP services on your web server use the PHP version as it is slightly faster. |
|||
1066 |
|||
*Fix crash caused by another bug in the PWS Weather code change in build 1062 |
|||
An working example used to be available at the subsequently abandoned web site [http://www.grantownweather.co.uk/historic/dataSummary.php here] |
|||
1067 |
|||
*Write today.ini again after processing Davis logger data, in case rain counter has changed |
|||
*Change 'high gust alarm' to use 10-minute max gust instead of 'latest' |
|||
*Change edit components used for YTD rain, trans factor, and pressure extremes on stations settings screen |
|||
*Change check for Davis firmware for auto VP2SleepInterval to just version 3.00 rather than >= 3.00 |
|||
*Discard out of sequence Davis logger entries |
|||
= Requirements = |
|||
1068 |
|||
*Trap exception in WMR200 altimeter pressure calculation caused by bad pressure reading |
|||
*webserver space |
|||
1069 |
|||
*Cumulus [[Dayfile.txt]] file uploaded to the webserver |
|||
*Calculate theoretical solar max when using logger data, even if station has no solar sensor |
|||
*Javascript enabled browser (all modern browsers use Javascript) |
|||
*Change X-Axis label formatting on Select-A-Graph so wind dir isn't just a date all the time |
|||
*optionally, a tool to automate the uploading of dayfile.txt to your webserver once per day. Example, [[CumulusToolbox]] |
|||
*Set Davis and Instromet clock (if configured) at 0400 as well as at start up |
|||
*optionally, PHP enabled web server if you wish to use the PHP version |
|||
== Configuration Variables == |
|||
1070 |
|||
*Make sure main window is re-enabled if Fine Offset station not responding at start up |
|||
*Option to turn off reporting of 'lost sensor contact' for Fine Offset stations. Add a line to the [Station] section of cumulus.ini: |
|||
ReportLostSensorContact=0 |
|||
*Optional parameter (dp) on <#latitude> and <#longitude> web tags. If supplied, instead of the usual web-encoded text format with degrees/minutes/seconds, the result is in decimal degrees to the specified number of decimal places. |
|||
by default, the script (the file 'readDayfile.js' or 'readDayfile.php' depending on your choice) will do the following: |
|||
1071 |
|||
* (both versions) Assume the dayfile.txt is read from a subfolder called 'data'. |
|||
*For 'easyweather.dat' input method: Read UV and Lux values from easyweather.dat file if 'extra sensors' selected. |
|||
* (JS version only) Insert the table it generates into a HTML element with attribute ''id='tableData' '' |
|||
*Ignore outdoor data if 'sensor contact lost' set in Fine Offset logger data |
|||
* (both versions) Assume the date format in the dayfile is ''dd/mm/yy'' (the month is always in the middle for all Cumulus log files) |
|||
* (both versions) Assume the data in the dayfile is separated with a ''comma'' |
|||
The last two assumptions are fine for UK based systems, however others should check their dayfile.txt and adjust as necessary |
|||
1072 |
|||
*Make sure 'last rain tip' time isn't updated when ignoring spurious large increase in Fine Offset rain counter |
|||
*Allow floating point UV values in easyweather.dat file |
|||
*Make sure 'solar' rather than 'extra' labels are used for easyweather.dat input |
|||
*Look for the line 'dayfile='/data/dayfile.txt';' around line 15 and change this to point to your dayfile.txt on your webserver. |
|||
1073 |
|||
:for ''PHP'' version the path should start from the / (root), |
|||
*Make sure Davis rain rates can never be negative |
|||
:for '''JavaScript''' version the path should start from where the HTML will be stored. |
|||
*Add "rc" parameter to <#latitude> and <#logitude> web tags. If the "dp" parameter has been supplied, then supplying "rc=y" in addition will cause any decimal comma to be converted to a decimal point. |
|||
* (JS Version only) '''tableDiv''' - the HTML element ''id attribute'' on your webpage to insert the table into |
|||
*For Davis stations, read the high gust value from the console once a minute, in case the high value was missed during normal reading. Note that this only works for midnight start of day configurations, the console can't supply the correct figure for 0900 start of day. |
|||
* (both versions) '''field_delimiter''' - the symbol separating each of your fields in the dayfile.txt. For most people this is a '''comma''' but (if you use comma to separate integer and decimal parts of real numbers) it could be a semi-colon (''';''') or other symbol. |
|||
*Fix bug in the change in build 1071 to check 'sensor contact lost' set in Fine Offset logger data |
|||
* (both versions) '''date_delimiter''' - the symbol separating your date format. See [[setup]]. |
|||
Change as needed, save and test |
|||
1074 |
|||
*Fix small chance of crash in Davis high gust code added in build 1073 |
|||
*Actually include the fix for the check 'sensor contact lost' set in Fine Offset logger data! |
|||
1075 |
|||
*Fix units on solar display panel for easyweather.dat input |
|||
*Make sure new Davis 'high gust' code doesn't use yesterday's figure just after midnight |
|||
== Revised PHP == |
|||
1076 |
|||
Here is a revised set of files (PHP only) ver 1.2. |
|||
*Another attempt at preventing yesterday's Davis high gust being used today - don't read it for the first five minutes after midnight |
|||
These are available here and update the Ver 1.1 fileset to eliminate errors in validation due to non-standard or deprecated code routines. |
|||
1077 |
|||
They also include a couple of updates from DAJ version as advised by posts in the Forum. |
|||
*Change CWOP header to use "TCPIP*" rather than the deprecated "TCPXX*" |
|||
The files include additional notes, and explanations on the changes, where relevant. |
|||
*Option to save NOAA-style reports with UTF-8 encoding |
|||
*A working example was [http://silveracorn.co.nz/weather/datasummary.php here] and also [http://www.fordingbridgeweather.co.uk/datasummary.php here] |
|||
1078 |
|||
*Download the following file...[https://cumuluswiki.org/files/AnnualDataSummary_12.zip AnnualDataSummary_12.zip], the zip contains 3 files: |
|||
*Change NOAA UTF-8 report saving for automatic case as well as manual |
|||
*#'''readDayfile.php''' - script for reading the dayfile.txt and for creating the table structure that displays selected statistics in a calendar style |
|||
*Fix 'isdaylight' when dusk is after midnight |
|||
*#'''datasummary.php''' - example 'carrier' web page, this one uses the Saratoga template system, so also requires 2 more scripts (not provided) ''Settings.php'' and ''common.php''. You can use your own page instead of this file. |
|||
*#'''datasummary.css''' - styling sheet for the table structure that displays selected statistics in a calendar style |
|||
*Follow the instructions below for the PHP version. |
|||
1079 |
|||
*Make sure forecast gets updated for Instromet stations when 'update hourly' isn't selected. |
|||
*Hide indoor panel for Instromet stations |
|||
*Put extra temp on solar/extra panel for Instromet stations |
|||
*Undo unintentional change in build 1078 which caused 'extra' web files to be saved using UTF-8 |
|||
*New web tag: <#MinutesSinceLastRainTip> - The number of minutes since the last rain gauge tip, in whole numbers, rounded down |
|||
1080 |
|||
*Change some edit controls which were causing problems on some systems |
|||
*Prevent crash when removing old recent data |
|||
*Do wind chill calculation for Instromet stations |
|||
*Fix UTF-8 option for manual saving of annual NOAA report |
|||
= Original 1.1 Fileset and instructions:- = |
|||
1081 |
|||
*Make sure files to be copied at realtime interval are done even if ftp connection fails |
|||
*Fix bug in third party edit control which causes problems on systems where user locale settings are not the same as system locale settings. |
|||
*Added new monthly and yearly rain parameters to Weatherbug uploads |
|||
*Sending of location data to Twitter is now optional |
|||
*Change buttons on dialogues back to plain standard buttons |
|||
*download the following file...[https://cumuluswiki.org/files/AnnualDataSummary.zip AnnualDataSummary.zip] |
|||
1082 |
|||
*Unzip the contents (five files will be extracted) |
|||
*Correct anchoring of buttons changed in build 1081 |
|||
*Edit the file 'readDayfile' file in a a good text editor (for example, [http://notepad-plus-plus.org/ notepad++]). Edit the .js version or the .php depending on your choice |
|||
*Look for the line 'dayfile='/data/dayfile.txt';' around line 15 and change this to point to your dayfile.txt on your webserver. This path should start from the / (root) |
|||
*Copy the necessary files to your web site into a subfolder, or the root -- your choice |
|||
: if using the PHP version copy datasummary.php and readDayfile.php |
|||
: for the Javascript version copy datasummary.html and readDafyfile.js |
|||
*Copy datasummary.css |
|||
* open datasummary.html or datasummary.php from your website in a browser |
|||
= Usage = |
|||
1083 |
|||
*Prevent crash when RG11 settings are opened |
|||
*Prevent crash when calculating dewpoint for LaCrosse when station gives zero humidity in logger data |
|||
*Update units on extra data screen without requiring a restart |
|||
*Change 'create missing' in dayfile.txt editor to put Heating and Cooling degree days the right way round in the file |
|||
Along the top will be a menu of the six data sets available and on the top left of the table is the year currently being shown. Change either the year, or click one of the top buttons to change the dataset. Depending on the speed of your internet connection, and your browser, the data may take a few seconds to be processed. |
|||
1084 |
|||
*Prevent crash when saving of annual NOAA report is cancelled |
|||
*Don't reset today's rain on Davis stations if rain counter can't be read at start up |
|||
If you select the pure Javascript solution available here, it means the page viewer's browser is doing all the work. The complete dayfile.txt is loaded each time you select a dataset, and your PC then filters and processes it. An [https://cumulus.hosiene.co.uk/viewtopic.php?f=18&t=8690 alternative Javascript/jQuery solution] that only reads the dayfile.txt once, however many times you choose a different data set or a different year is in the 3rd party tools forum. That alternative is thus considerably faster, especially with large dayfile.txt files. |
|||
1085 |
|||
*Diagnostic logging changes |
|||
This is in contrast to a PHP solution also available here, where the source server does all the work and only sends the results to the viewer's browser. |
|||
1086 |
|||
*Stop occasional crash when adding to "recent data" |
|||
*Update pressure trend string for Instromet stations |
|||
*Correct setting of recent UV values when loaded from data logs at start up (affects <#RecentUV> web tag) |
|||
*Correct average wind speed on NOAA monthly report and "This Period" for 0900/1000 rollover users |
|||
= Possible problems = |
|||
1087 |
|||
*Use wind calibration settings when calculating wind run from Davis logger data |
|||
*Dominant wind direction should be zero (and not 90) when there has been no wind at all today |
|||
*Cater for latest Twitter API change which broke the Twitter updates |
|||
*This has been tested and runs on IE 7, IE 8, IE9, FireFox 3 to 14, Chrome/Dragon/SRWare Iron, and Safari -- running on the non IE browsers for both Windows and the Mac. |
|||
1088 |
|||
*IE7 is notoriously slow for Javascript processing so there will be a longer delay as you change the data set (a few more seconds in some cases) |
|||
*Changes the <#RecentWindGust> web tag so that it always supplies 'recent max gust' rather than 'gust' |
|||
= Customisation = |
|||
1089 |
|||
*Change extraction of wind direction for Fine Offset to only use lower 4 bits. |
|||
*Make sure all-time wettest month record always has correct month applied |
|||
*Allow year selection back to 2000 for 'This month', 'This year', and NOAA reports |
|||
*Delay writing of end of day backup files until the first log entry is written |
|||
*Added comment at end of script in 'monthlyrecordsT.htm' explaining the code change needed to load page showing current month |
|||
== Understanding the Basics == |
|||
1090 |
|||
*Fix issue where Fine Offset pressure spike removal wasn't applied when outdoor sensor contact lost. |
|||
*Apply pressure calibration offset to Altimeter Pressure also, on Davis stations. |
|||
*Fix commented-out code in monthlyrecordT.htm to start at current month so it actually works when enabled |
|||
*Added 'storm rain' for Davis stations. Display is turned off by default; enable display in Cumulus via the display settings screen; it appears in the header of the 'rainfall' panel on the main screen, while the storm rain figure is non-zero. Two new web tags, <#StormRain> giving the current amount, and <#StormRainStart> (takes the usual optional 'format' parameter) giving the date of the start of the 'storm'. These work independently of the display setting. Refer to Davis documentation for an explanation of these figures, Cumulus just reports the values supplied by the console. |
|||
The 'tool' relies on two files for successful operation.... datasummary.css (the style sheet) and readDayfile.js (the Javascript) or readDayfile.php (the PHP version). The third file, datasummary.html/php, is simply a carrier page to show the data. |
|||
1091 |
|||
*I've noticed that the 'storm rain' text on the main screen rain panel gets too long when the number of digits of rain increases. I've changed it so it only displays the amount, with the full details on a 'mouseover' |
|||
If you wish to use your own page to show the data on, do the following: |
|||
1092 |
|||
*New option on the calibration setting screen: The Davis Altitude offset is used in the calculation of Altimeter Pressure on Davis stations. The offset is applied to the altitude read from the console before being used in the calculation of Altimeter Pressure (Note: this is the not the altitude configured in Cumulus, it is the altitude configured in the Davis console). The point of this is that the station itself uses the altitude setting to calculate MSLP (sea-level pressure) and you may find that the configured altitude is OK for the MSLP calculation, but you need an offset for the Altimeter Pressure calculation. You should supply the offset in whatever units you have set for altitude in Cumulus (ft or m). Note that if you have supplied a Pressure Offset, this will also be applied to the Altimeter Pressure when it has been calculated. |
|||
*for the JS version |
|||
1093 |
|||
: In the <HEAD> section..... |
|||
[http://sandaysoft.com/forum/viewtopic.php?f=2&t=10777 Full release Details] |
|||
<pre><link rel="stylesheet" type="text/css" media="screen" href="datasummary.css" /> |
|||
*option to encode web pages using UTF-8. |
|||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js" type="text/javascript"></script> |
|||
* the standard web pages are HTML 5 compliant, and specify a UTF-8 charset. There is a separate UTF-8 option for the standard files, and this is 'on' by default (as the standard files now require it). If you have your own modified versions of the standard files (and therefore choose the option not to install the web page templates when you install a new version of Cumulus), then you will need to turn this option off, unless you convert your pages to use UTF-8. |
|||
<script src="readDayfile.js" type="text/javascript"></script></pre> |
|||
*The dashboard.js file has changed (for a couple of CSS changes required for HTML5 compliance) so check you have downloaded this by downloading the standard templates. |
|||
: This loads the stylesheet; loads a jQuery library from Google servers (rather than having the file on your server); and loads the Javascript to build the table |
|||
: Once the page is loaded it runs readDayfile.js and will look for a DIV called 'tableData'; inserting the data table within it. You can change the DIV it inserts into (see later in this article). |
|||
*for the PHP version |
|||
:use the code <pre><?php include('readDayfile.php');?></pre> |
|||
Please note that the table needs a good amount of space to show a full year of data (at least 900 pixels unless you start reducing the font size!) |
|||
1094 |
|||
*Fix new UTF-8 code so that it reads UTF-8 input files correctly. |
|||
*Make sure timers for realtime.txt etc don't get started until data has been read (to avoid invalid data being written) |
|||
*Make sure 'data stopped' isn't triggered if PC clock changes. |
|||
<br> |
|||
1095 |
|||
== Configuration Variables == |
|||
If you are intending to upgrade to this release, please read all of the release notes since the build you are currently running. |
|||
*Fix confusion of leaf and soil readings when using Davis logger data |
|||
by default, the script will do the following: |
|||
*Option to send Davis soil temp, soil moisture, and leaf wetness to Wunderground. Configure by editing cumulus.ini (with Cumulus stopped) and adding any of the following to the [Wunderground] section: |
|||
**SendSoilTemp1=1 |
|||
*Insert it's contents into a DIV called 'tableData' (JS version only) |
|||
**SendSoilTemp2=1 |
|||
*Assumes the date format in the dayfile is dd/mm/yy |
|||
**SendSoilTemp3=1 |
|||
*Assumes the data in the dayfile is separated with a comma |
|||
**SendSoilTemp4=1 |
|||
**SendSoilMoisture1=1 |
|||
The last two assumptions are fine for UK based systems, however others should check the dayfile.txt and adjust as necessary |
|||
**SendSoilMoisture2=1 |
|||
**SendSoilMoisture3=1 |
|||
If you need to adjust any of these settings, edit the readDayfile.js file and consider the variables in the top section of the script: |
|||
**SendSoilMoisture4=1 |
|||
**SendLeafWetness1=1 |
|||
*'''tableDiv''' - the name of the DIV on your webpage to insert the table into (JS Version only) |
|||
**SendLeafWetness2=1 |
|||
*'''field_delimiter''' - the symbol separating each of your fields in the dayfile.txt. For most people this is a comma but may also be a period (.) |
|||
*'''date_delimiter''' - the symbol separating your date format. In the UK this is / however in other countires it may be - |
|||
Change as needed, save and test |
|||
== Localization / Language == |
|||
The script has been designed to be easily translated to your language of choice. |
|||
As above, edit the readDayfile.js / .php |
|||
*variable '''mn''' is a list of the 12 months of the year, in an abbreviated format. You may change these as necessary, but try to keep it to an abbreviation as there is limited space. |
|||
*''''label_items'''' is a list of all possible data sets to be displayed. Again you can change these to suit. However, the format is a little more involved and you should take some care. Example,.... |
|||
<pre>['maxtemp','Max Temp','Maximum Temperature',true]</pre> |
|||
*The first element, in this case 'maxtemp' -- must remain '''unchanged''', this is a system variable to identify the dataset and tested elsewhere in the code |
|||
*Second, '''Max Temp''' is the text to be displayed in the ''button'' at the top of the table. You may change this to your own language |
|||
*Third, '''Maximum Temperature''' is the text shown at the top of the table to ''describe the current data set''; again you may change this |
|||
*Finally, 'true' will display this button at the top; 'false' will hide it. Therefore, if you do not wish to allow users to jump to the 'Rainfall dataset' change the 'true' to 'false' in the 'rainfall' element of the variable. (true/false MUST be lowercase) |
|||
<br> |
|||
== Opening a specific data set when the page is first loaded == |
|||
By default (in the original version) the table created will show the available daily values of the ''maximum temperature'' for the current ''local calendar year'' (see possible problems below), however you can start with any data set and any year (assuming you have those values in the dayfile.txt) by ''adding a 'Query String' to the end of your URL'' in the browser. |
|||
*The parameter 'data' (in the original version) takes mintemp, maxtemp, avgtemp, minmaxt, rainfall, windgust. (You can add further data sets or change the language of these values - see Localization). '''Note''' the specified data will be displayed even if it is assigned 'false' and does not appear as a button. |
|||
*You can supply both data set and year parameters, one only, or none |
|||
examples...., |
|||
*JS version -- '''myserver.com/datasummary.html?year=2010''' |
|||
*PHP version -- ''myserver.com/datasummary.php?year=2010'' |
|||
:This will open the default (maximum temperature) data set but initially showing year 2010 |
|||
*JS version -- myserver.com/datasummary.html?data=rainfall&year=2009 |
|||
:This will open the rainfall data set for the year 2009. |
|||
== Styling == |
|||
The table styling is completely configurable using the included datasummary.css [[Stylesheet]]. By default it is using similar colours to the standard Cumulus website. Below are a few of the key entries to consider when adjusting settings (typically colouring)... |
|||
In the 'datasummary.css' file: |
|||
{| class="wikitable" border="1" |
|||
|- |
|||
! scope="col" width="300px" | CSS Element |
|||
! scope="col" | Description |
|||
|- |
|||
| #table_container .highlight |
|||
| Used to highlight the mouse position within the table, and also the row and column header of the data cell. |
|||
|- |
|||
| #table_container .smallfont |
|||
| Adjusting the font size to something smaller when showing both Max & Min temp on one data cell |
|||
|- |
|||
| #table_container .zerovalue |
|||
| In the Rainfall and Windgust datasets this style is applied to any values of 0. By default, the colour is set to a lighter grey but you could add 'dispaly:none;' to hide zero values completely |
|||
|- |
|||
| #table_container table th |
|||
| Colouring for the top header (Month names) and left header (day numbers) |
|||
|- |
|||
| #table_container table td,table th |
|||
| The width of each data cell in the table. Be careful adjusting this as making it too small will stop the data being displayed completely |
|||
|- |
|||
| #table_menu li |
|||
| The styling for the buttons at the top of the page (those for changing the data set) |
|||
|- |
|||
| #table_container |
|||
| Set the overall font size and style used in the table, as well as the text colour; table positioning and maximum width |
|||
|} |
|||
= Version Control = |
|||
1.2 New PHP version |
|||
1.1 PHP version included |
|||
1.0 Public launch |
|||
[[Category:WebTools]] |
|||
Latest revision as of 10:02, 9 January 2022
Revision as of 22:41, 27 November 2012 Name: Annual Data Summary Type: HTML & Javascript Author: David Jamieson Contact: DAJ Last update: 7 March 2011 Version: 1.1
Updated by BCJKiwi:
| Name: | Annual Data Summary |
| Type: | HTML & Javascript |
| Author: | David Jamieson |
| Contact: | DAJ updated=7 March 2011 version=1.1 |
| Last update: | 17 December 2012 |
| Version: | 1.2 BCJKiwi |
An updated article, that supersedes this one is called Daily_Summary
'Annual Data Summary' is a small tool to read the dayfile.txt produced by Cumulus and summarise this in a table, arranged like a calendar, showing a full years worth of a selected criterion such as maximum daily temperature.
- The tool uses HTML, jQuery (a library script that produces Javascript) and a CSS file.
- The JavaScript version does not require a webserver with PHP services enabled. (Many of the free hosting services do not offer PHP so this was a solution to that problem).
- The alternative is a PHP version (included so you have the option to use either).
- Both provide identical looking output and functionality, however if you have PHP services on your web server use the PHP version as it is slightly faster.
An working example used to be available at the subsequently abandoned web site here
Requirements
- webserver space
- Cumulus Dayfile.txt file uploaded to the webserver
- Javascript enabled browser (all modern browsers use Javascript)
- optionally, a tool to automate the uploading of dayfile.txt to your webserver once per day. Example, CumulusToolbox
- optionally, PHP enabled web server if you wish to use the PHP version
Configuration Variables
by default, the script (the file 'readDayfile.js' or 'readDayfile.php' depending on your choice) will do the following:
- (both versions) Assume the dayfile.txt is read from a subfolder called 'data'.
- (JS version only) Insert the table it generates into a HTML element with attribute id='tableData'
- (both versions) Assume the date format in the dayfile is dd/mm/yy (the month is always in the middle for all Cumulus log files)
- (both versions) Assume the data in the dayfile is separated with a comma
The last two assumptions are fine for UK based systems, however others should check their dayfile.txt and adjust as necessary
- Look for the line 'dayfile='/data/dayfile.txt';' around line 15 and change this to point to your dayfile.txt on your webserver.
- for PHP version the path should start from the / (root),
- for JavaScript version the path should start from where the HTML will be stored.
- (JS Version only) tableDiv - the HTML element id attribute on your webpage to insert the table into
- (both versions) field_delimiter - the symbol separating each of your fields in the dayfile.txt. For most people this is a comma but (if you use comma to separate integer and decimal parts of real numbers) it could be a semi-colon (;) or other symbol.
- (both versions) date_delimiter - the symbol separating your date format. See setup.
Change as needed, save and test
Revised PHP
Here is a revised set of files (PHP only) ver 1.2.
These are available here and update the Ver 1.1 fileset to eliminate errors in validation due to non-standard or deprecated code routines. They also include a couple of updates from DAJ version as advised by posts in the Forum. The files include additional notes, and explanations on the changes, where relevant.
- A working example was here and also here
- Download the following file...AnnualDataSummary_12.zip, the zip contains 3 files:
- readDayfile.php - script for reading the dayfile.txt and for creating the table structure that displays selected statistics in a calendar style
- datasummary.php - example 'carrier' web page, this one uses the Saratoga template system, so also requires 2 more scripts (not provided) Settings.php and common.php. You can use your own page instead of this file.
- datasummary.css - styling sheet for the table structure that displays selected statistics in a calendar style
- Follow the instructions below for the PHP version.
Original 1.1 Fileset and instructions:-
- download the following file...AnnualDataSummary.zip
- Unzip the contents (five files will be extracted)
- Edit the file 'readDayfile' file in a a good text editor (for example, notepad++). Edit the .js version or the .php depending on your choice
- Look for the line 'dayfile='/data/dayfile.txt';' around line 15 and change this to point to your dayfile.txt on your webserver. This path should start from the / (root)
- Copy the necessary files to your web site into a subfolder, or the root -- your choice
- if using the PHP version copy datasummary.php and readDayfile.php
- for the Javascript version copy datasummary.html and readDafyfile.js
- Copy datasummary.css
- open datasummary.html or datasummary.php from your website in a browser
Usage
Along the top will be a menu of the six data sets available and on the top left of the table is the year currently being shown. Change either the year, or click one of the top buttons to change the dataset. Depending on the speed of your internet connection, and your browser, the data may take a few seconds to be processed.
If you select the pure Javascript solution available here, it means the page viewer's browser is doing all the work. The complete dayfile.txt is loaded each time you select a dataset, and your PC then filters and processes it. An alternative Javascript/jQuery solution that only reads the dayfile.txt once, however many times you choose a different data set or a different year is in the 3rd party tools forum. That alternative is thus considerably faster, especially with large dayfile.txt files.
This is in contrast to a PHP solution also available here, where the source server does all the work and only sends the results to the viewer's browser.
Possible problems
- This has been tested and runs on IE 7, IE 8, IE9, FireFox 3 to 14, Chrome/Dragon/SRWare Iron, and Safari -- running on the non IE browsers for both Windows and the Mac.
- IE7 is notoriously slow for Javascript processing so there will be a longer delay as you change the data set (a few more seconds in some cases)
Customisation
Understanding the Basics
The 'tool' relies on two files for successful operation.... datasummary.css (the style sheet) and readDayfile.js (the Javascript) or readDayfile.php (the PHP version). The third file, datasummary.html/php, is simply a carrier page to show the data.
If you wish to use your own page to show the data on, do the following:
- for the JS version
- In the <HEAD> section.....
<link rel="stylesheet" type="text/css" media="screen" href="datasummary.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js" type="text/javascript"></script> <script src="readDayfile.js" type="text/javascript"></script>
- This loads the stylesheet; loads a jQuery library from Google servers (rather than having the file on your server); and loads the Javascript to build the table
- Once the page is loaded it runs readDayfile.js and will look for a DIV called 'tableData'; inserting the data table within it. You can change the DIV it inserts into (see later in this article).
- for the PHP version
- use the code
<?php include('readDayfile.php');?>
Please note that the table needs a good amount of space to show a full year of data (at least 900 pixels unless you start reducing the font size!)
Configuration Variables
by default, the script will do the following:
- Insert it's contents into a DIV called 'tableData' (JS version only)
- Assumes the date format in the dayfile is dd/mm/yy
- Assumes the data in the dayfile is separated with a comma
The last two assumptions are fine for UK based systems, however others should check the dayfile.txt and adjust as necessary
If you need to adjust any of these settings, edit the readDayfile.js file and consider the variables in the top section of the script:
- tableDiv - the name of the DIV on your webpage to insert the table into (JS Version only)
- field_delimiter - the symbol separating each of your fields in the dayfile.txt. For most people this is a comma but may also be a period (.)
- date_delimiter - the symbol separating your date format. In the UK this is / however in other countires it may be -
Change as needed, save and test
Localization / Language
The script has been designed to be easily translated to your language of choice.
As above, edit the readDayfile.js / .php
- variable mn is a list of the 12 months of the year, in an abbreviated format. You may change these as necessary, but try to keep it to an abbreviation as there is limited space.
- 'label_items' is a list of all possible data sets to be displayed. Again you can change these to suit. However, the format is a little more involved and you should take some care. Example,....
['maxtemp','Max Temp','Maximum Temperature',true]
- The first element, in this case 'maxtemp' -- must remain unchanged, this is a system variable to identify the dataset and tested elsewhere in the code
- Second, Max Temp is the text to be displayed in the button at the top of the table. You may change this to your own language
- Third, Maximum Temperature is the text shown at the top of the table to describe the current data set; again you may change this
- Finally, 'true' will display this button at the top; 'false' will hide it. Therefore, if you do not wish to allow users to jump to the 'Rainfall dataset' change the 'true' to 'false' in the 'rainfall' element of the variable. (true/false MUST be lowercase)
Opening a specific data set when the page is first loaded
By default (in the original version) the table created will show the available daily values of the maximum temperature for the current local calendar year (see possible problems below), however you can start with any data set and any year (assuming you have those values in the dayfile.txt) by adding a 'Query String' to the end of your URL in the browser.
- The parameter 'data' (in the original version) takes mintemp, maxtemp, avgtemp, minmaxt, rainfall, windgust. (You can add further data sets or change the language of these values - see Localization). Note the specified data will be displayed even if it is assigned 'false' and does not appear as a button.
- You can supply both data set and year parameters, one only, or none
examples....,
- JS version -- myserver.com/datasummary.html?year=2010
- PHP version -- myserver.com/datasummary.php?year=2010
- This will open the default (maximum temperature) data set but initially showing year 2010
- JS version -- myserver.com/datasummary.html?data=rainfall&year=2009
- This will open the rainfall data set for the year 2009.
Styling
The table styling is completely configurable using the included datasummary.css Stylesheet. By default it is using similar colours to the standard Cumulus website. Below are a few of the key entries to consider when adjusting settings (typically colouring)...
In the 'datasummary.css' file:
| CSS Element | Description |
|---|---|
| #table_container .highlight | Used to highlight the mouse position within the table, and also the row and column header of the data cell. |
| #table_container .smallfont | Adjusting the font size to something smaller when showing both Max & Min temp on one data cell |
| #table_container .zerovalue | In the Rainfall and Windgust datasets this style is applied to any values of 0. By default, the colour is set to a lighter grey but you could add 'dispaly:none;' to hide zero values completely |
| #table_container table th | Colouring for the top header (Month names) and left header (day numbers) |
| #table_container table td,table th | The width of each data cell in the table. Be careful adjusting this as making it too small will stop the data being displayed completely |
| #table_menu li | The styling for the buttons at the top of the page (those for changing the data set) |
| #table_container | Set the overall font size and style used in the table, as well as the text colour; table positioning and maximum width |
Version Control
1.2 New PHP version
1.1 PHP version included
1.0 Public launch