AnnualDataSummary: Difference between revisions

3,085 bytes added ,  10:02, 9 January 2022
m
spelling
(Undo revision 2207 by Sfws (talk))
m (spelling)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{AddOnBanner|name=Annual Data Summary|type=HTML & Javascript|author=David Jamieson|contact=[[User:Daj|DAJ]]|updated=7 March 2011|version=1.1|updated=17 December 2012|version=1.2 BCJKiwi}}


'Annual Data Summary' is a small tool to read the [[dayfile.txt]] produced by Cumulus and summarise this in a table showing a full years worth of data. This tool uses standard HTML and Javascript so 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).  However, a PHP version is included so you have the option to use either.  Both provide identical data and functionality, however if you have PHP services on your web server use the PHP version as it is slightly faster.
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


An working example is [http://www.grantownweather.co.uk/historic/dataSummary.php here]
Updated by BCJKiwi:
{{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}}
 
 
'''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 [http://www.grantownweather.co.uk/historic/dataSummary.php here]


= Requirements  =
= Requirements  =
Line 13: Line 32:
*optionally, PHP enabled web server if you wish to use the PHP version
*optionally, PHP enabled web server if you wish to use the PHP version


= The Basics =
== Configuration Variables  ==
Here is a revised set of files (PHP only) ver 1.2
 
These are available here and update the Ver 1.1 fileset below to eliminate errors in validation due to deprecated code routines.
by default, the script (the file 'readDayfile.js' or 'readDayfile.php' depending on your choice) will do the following:
They also include a couple of updates from DAJ advised by posts in the Forum.
*  (both versions) Assume the dayfile.txt is read from a subfolder called 'data'.
The files include additional notes and explanations on the changes where relevant.
*  (JS version only)    Insert the table it generates into a HTML element with attribute ''id='tableData' ''
A working example is [http://silveracorn.co.nz/weather/datasummary.php here]
* (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)
*download the follwing file...[http://wiki.sandaysoft.com/files/AnnualDataSummary_12.zip AnnualDataSummary_12.zip]
*  (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  [http://silveracorn.co.nz/weather/datasummary.php here] and also [http://www.fordingbridgeweather.co.uk/datasummary.php here]
*Download the following file...[https://cumuluswiki.org/files/AnnualDataSummary_12.zip 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.  
*Follow the instructions below for the PHP version.  
Original Fileset and instructions:-


*download the following file...[http://wiki.sandaysoft.com/files/AnnualDataSummary.zip AnnualDataSummary.zip]  
 
= Original 1.1 Fileset and instructions:- =
 
*download the following file...[https://cumuluswiki.org/files/AnnualDataSummary.zip AnnualDataSummary.zip]  
*Unzip the contents (five files will be extracted)  
*Unzip the contents (five files will be extracted)  
*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
*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
Line 37: Line 84:
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.  
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 [http://sandaysoft.com/forum/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.  
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.  


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.
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.
Line 103: Line 150:
<br>
<br>


== Opening a specific data set ==
== 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.


By default the table will summaries the maximum temperature for the current year, however you can start with any dataset or year (assuming you have the data in the dayfile.txt) but adding a string to the end of your URL in the browser. examples....,  
*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


*JS version --myserver.com/datasummary.html?year=2010
examples....,
*PHP version -- myserver.com/datasummary.php?year=2010
:This will open the data set initially showing year 2010


*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


*myserver.com/datasummary.html?data=rainfall&amp;year=2009
:This will open the rainfall dataset for the year 2009.


The parameter 'data' takes mintemp, maxtemp, avgtemp, minmaxt, rainfall, windgust. You can supply both parameters, one only, or none
*JS version -- myserver.com/datasummary.html?data=rainfall&amp;year=2009
:This will open the rainfall data set for the year 2009.


== Styling  ==
== Styling  ==
Line 152: Line 201:


= Version Control  =
= Version Control  =
1.2  New PHP version
1.1 PHP version included
1.1 PHP version included


1.0 Public launch  
1.0 Public launch  
<br>
{{WatchReminderBanner}}


[[Category:WebTools]]
[[Category:WebTools]]
5,838

edits