AnnualDataSummary: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
420 bytes removed ,  20:33, 13 April 2018
no edit summary
No edit summary
No edit summary
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}}  
{{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, arranged like a calendar, showing a full years worth of a selected field such as maximum daily temperature.  
'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.
*The tool uses HTML and jQuery (a library script that produces Javascript) and includes 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 is [http://www.grantownweather.co.uk/historic/dataSummary.php here]


= Requirements  =
= Requirements  =


*webserver space (could be on your own local machine or on a commercial server)
*webserver space (unless you are using this tool on your own local machine)
*Cumulus [[Dayfile.txt]] file on the webserver (for the original version of this tool, the default location is a subfolder called 'data')
*Cumulus [[Dayfile.txt]] file uploaded to the webserver (for the original version of this tool, the default location is a subfolder called 'data')
*JavaScript enabled browser (all modern browsers use JavaScript)
*Javascript enabled browser (all modern browsers use Javascript)
*Use of '''Daily''' option on ''Files/Options'' screen to call command to upload 'dayfile.txt' to your web server
*optionally, a tool to automate the uploading of dayfile.txt to your webserver once per day after rollover.  Example, [[CumulusToolbox]]
*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 Source Code  =
= The Source Code  =
== 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 below 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 is [http://silveracorn.co.nz/weather/datasummary.php here]
*Download the following file...[http://wiki.sandaysoft.com/files/AnnualDataSummary_12.zip AnnualDataSummary_12.zip]
*Follow the instructions below for the PHP version.
== Alternative Web Tools ==
Available only from either the Website Development or the Third Party Tools sections of the support forum are alternative tools that will display daily or seasonal summaries of the contents of [[dayfile.txt]].  Although they work with daily extremes and other statistics produced by Cumulus in that file, they are also designed to cope with additional information imported into that file. Consequently although Cumulus itself cannot produce nor process 'Nulls', these tools do have some capacity to handle null fields representing missing observations.
The tools are written in code to more modern standards than the original here and are generally far more flexible in what they can output.
=== Alternative PHP ===
*An extensively coloured version is on the forum at [http://sandaysoft.com/forum/viewtopic.php?f=14&t=5319 'Post subject: Annual Data Summary - Coloured Values']; there is some useful discussion on the trade-off between testing values and efficient code here.
*Further ideas are explored by Mark Crossley and beteljuice in various places on the Cumulus forum e.g.  [http://sandaysoft.com/forum/viewtopic.php?f=14&t=11133 'Post subject: Annual data Summary (DAJ script) - show day-of-week'].
*Finally there is [http://sandaysoft.com/forum/viewtopic.php?f=14&t=11397 'Post subject: Yet Another Dayfile Reader (PHP)'] in the Website Development - Web general sub forum. Amongst other features, in this more recent experiment the highlighting makes day of week appear in row headers, you can swap between daily and seasonal views and there is a table summary including averages.
=== Alternative JavaScript ===
This section only is by [[User:Sfws|Sfws]] ([[User talk:Sfws|talk]]) 00:53, 18 May 2013 (PDT)
An [http://sandaysoft.com/forum/viewtopic.php?f=18&t=8690 alternative Javascript/jQuery solution] is in the 3rd party tools sub forum within the Cumulus forum and its advantages are fully described in a file within the package.  They include standards compliance, better integration with standard Cumulus pages, statistical additions to the bottom of each month's column,  and easier tailoring to your preferences on wording, language, and text colouring.
One site using in January 2013 a variant based on this alternative code, with its own look to the page, is [http://sassafras.id.au/projects/weather/dailyrecords.shtml found here].
Since this code was originally written in December 2011, my alternative JavaScript version has evolved and now none of the original code remains, and a number of additional features have been added, whilst attempting to preserve ease of customisation to suit any requirements you have e.g. on the language and level of diagnostics output. The updates on the forum are infrequent because the shared version always lags behind my latest experiments.


== Original Fileset ==
== Original Fileset ==


*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 is [http://www.ibtest.dk/vejr/datasummary.html here]
*Download the following file...[http://wiki.sandaysoft.com/files/AnnualDataSummary.zip AnnualDataSummary.zip]  
*Download the following file...[http://wiki.sandaysoft.com/files/AnnualDataSummary.zip AnnualDataSummary.zip]  
*Unzip the contents (five files will be extracted)  
*Unzip the contents (five files will be extracted)  
Line 54: Line 83:


Change as needed, save and test
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 above to eliminate errors in validation due to non-standard or deprecated code routines.
= Usage  =
They also include a couple of updates from DAJ version as advised by posts in the Forum.
Along the top will be a menu of the (in original version) 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 data set. Depending on the speed of your internet connection, and your browser, the new web page may take a few seconds to be processed as it involves: re-reading the dayfile.txt file, redrawing the table, and inserting the values.  
The files include additional notes, and explanations on the changes, where relevant.
*A working example is [http://www.fordingbridgeweather.co.uk/datasummary.php here]
*Download the following file...[http://wiki.sandaysoft.com/files/AnnualDataSummary_12.zip AnnualDataSummary_12.zip]
*Follow the instructions below for the PHP version.
 
 
== Alternative Web Tools ==
Available only from either the Website Development or the Third Party Tools sections of the support forum are alternative tools that will display daily or seasonal summaries of the contents of [[dayfile.txt]].  Although they work with daily extremes and other statistics produced by Cumulus in that file, they are also designed to cope with additional information imported into that file. Consequently although Cumulus itself cannot produce nor process 'Nulls', these tools do have some capacity to handle null fields representing missing observations.
 
The tools are written in code to more modern standards than the original here and are generally far more flexible in what they can output.
 
=== Alternative PHP ===
*An extensively coloured version is on the forum at [http://sandaysoft.com/forum/viewtopic.php?f=14&t=5319 'Post subject: Annual Data Summary - Coloured Values']; there is some useful discussion on the trade-off between testing values and efficient code here.
*Further ideas are explored by Mark Crossley and beteljuice in various places on the Cumulus forum e.g.  [http://sandaysoft.com/forum/viewtopic.php?f=14&t=11133 'Post subject: Annual data Summary (DAJ script) - show day-of-week'].
*Finally there is [http://sandaysoft.com/forum/viewtopic.php?f=14&t=11397 'Post subject: Yet Another Dayfile Reader (PHP)'] in the Website Development - Web general sub forum. Amongst other features, in this more recent experiment the highlighting makes day of week appear in row headers, you can swap between daily and seasonal views and there is a table summary including averages.  See that forum url for links to sites that use this version.
 
=== Alternative JavaScript ===
This section only is by [[User:Sfws|Sfws]]  00:53, 18 May 2013 (PDT)
 
An [http://sandaysoft.com/forum/viewtopic.php?f=18&t=8690 alternative Javascript/jQuery solution] is in the 3rd party tools sub forum within the Cumulus forum and its advantages are fully described in a file within the package.  They include standards compliance, better integration with standard Cumulus pages, statistical additions to the bottom of each month's column,  and easier tailoring to your preferences on wording, language, and text colouring.


Since this code was originally written in December 2011, my alternative JavaScript version has evolved and now none of the original code remains, and a number of additional features have been added, whilst attempting to preserve ease of customisation to suit any requirements you have e.g. on the language and level of diagnostics output.  
If you mouse over a particular value, it will be highlighted together with the corresponding day (row heading) and month (column heading).


One site using in January 2013 a variant based on this alternative code, with its own look to the page, is [http://sassafras.id.au/projects/weather/dailyrecords.shtml found here]. Whilst a number of other people have tried later versions of this alternative code, it has not been adopted as widely as the PHP alternatives above, partly because this is designed for tailoring, and those are off the shelf packages.
Some data sets show minimum and maximum values in the cells at the intersection of the day and month headings, most just show a single value at the intersection.
 
= Usage  =
Along the top will be a menu of the (in original version) 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 data set. Depending on the speed of your internet connection, and your browser, the new web page may take a few seconds to be processed as it involves: re-reading the dayfile.txt file, redrawing the table, and inserting the values.  


If you mouse over a particular value, it will be highlighted together with the corresponding day (row heading) and month (column heading). The highlighting functionality varies a bit between versions (see possible problems below).


What is shown, and how, in the cells at the intersection of the day and month headings, depends on the version you choose to install.


== Opening a specific data set when the page is first loaded ==
== Opening a specific data set when the page is first loaded ==
Line 108: Line 110:


== Processing ==
== Processing ==
If you select the pure Javascript original solution downloaded from this section, it means the page viewer's browser is doing all the work. The complete dayfile.txt is reloaded each time you select a dataset, and your browser then filters and processes the required subset of values from it.  A table is then constructed by the script at the point indicated by the HTML DIV called 'tableData', and the values are then inserted.
If you select the pure Javascript solution downloaded from this section, it means the page viewer's browser is doing all the work. The complete dayfile.txt is reloaded each time you select a dataset, and your browser then filters and processes the required subset of values from it.  A table is then constructed by the script at the point indicated by the HTML DIV called 'tableData', and the values are then inserted.


If you select one of the various PHP versions available from this page or the forum links above, the source server does all the work of constructing the HTML page and sends the result to the viewer's browser.
If you select one of the two PHP versions available from this page, the source server does all the work of constructing the HTML page and sends the result to the viewer's browser.


= Customisation  =
= Customisation  =
Line 116: Line 118:
== Understanding the Basics  ==
== Understanding the Basics  ==


The original 'tool' relies on three files for successful operation:
The 'tool' relies on three files for successful operation:
# the jQuery library routines that allow it to work in any user agent (browser)
# the jQuery library routines that allow it to work in any user agent (browser)
# datasummary.css (the style sheet) and
# datasummary.css (the style sheet) and
Line 152: Line 154:


*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.  
*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 if you are prepared to wade through all the script and make changes elsewhere too. However, the format is a little more involved and you should take some care. Each row represents one data set, with 4 columns of settings for that data set; so the default list is an array of four by six.
*''''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. Each row represents one data set, with 4 columns of settings for that data set; so the default list is an array of four by six.


Example of a row,....
Example of a row,....
Line 169: Line 171:
<br>
<br>


== Styling (applies only to original version of code) ==
== 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)...  Also see [http://sandaysoft.com/forum/viewtopic.php?f=14&t=5319 support forum thread about colouring with php]
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)...  Also see [http://sandaysoft.com/forum/viewtopic.php?f=14&t=5319 support forum thread about colouring with php]
5,838

edits

Navigation menu