5,838
edits
mNo edit summary |
No edit summary |
||
{{AddOnBanner|name=Annual Data Summary|type=HTML & Javascript|author=David Jamieson|contact=[[User:Daj|DAJ]]|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.
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.
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://www.fordingbridgeweather.co.uk/datasummary.php here]
*Download the following file...[http://wiki.sandaysoft.com/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 - see [[#Understanding_the_Basics|carrier page customisation]] below.
*#'''datasummary.css''' - styling sheet for the table structure that displays selected statistics in a calendar style
*Follow the instructions above 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 ===
Look in the Website Development section of the Cumulus support forum - '''Web general''' sub forum:
*[http://sandaysoft.com/forum/viewtopic.php?f=14&t=5319 'Annual Data Summary - Coloured Values'] - An extensively coloured version with some useful discussion on the trade-off between testing values and efficient code here.
*[http://sandaysoft.com/forum/viewtopic.php?f=14&t=11133 'Annual data Summary (DAJ script) - show day-of-week'] - This is just one of several places where further ideas are explored by Mark Crossley and beteljuice.
*[http://sandaysoft.com/forum/viewtopic.php?f=14&t=11397 'Yet Another Dayfile Reader (PHP)'] - This is the ultimate/latest PHP version, it incoporates all the ideas discussed before, amongst many features 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) (later slightly updated re my final 2014 version)
I originally created the alternative Javascript version in December 2011 by editing the DAJ original (with similar aims to BCJKiwi with his PHP version 1.2) to offer easier customisation plus standards compliance, i.e. addressing all the issues [[#Possible_problems|listed below]]. The advantages of my script 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. During 2012-2013, my alternative JavaScript version was rewritten from scratch (losing the original DAJ code), a number of additional features were added, whilst attempting to preserve ease of customisation to suit any requirements you have e.g. on the language and level of diagnostics output.
Find my package in [http://sandaysoft.com/forum/viewtopic.php?f=18&t=8690 alternative Javascript/jQuery solution] within the '''3rd party tools''' sub forum of the Cumulus forum.
One site using in January 2013 a variant based on an early version of my Javascript/jQuery 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 was designed for easy tailoring, so is not an off the shelf package like all the PHP versions above.
Please note that it is difficult for me to provide any support on the final 15 Jan 2014 7:08 am Javascript package I offer in the forum as I actually swapped to a PHP version of this alternative script, and due to the general lack of interest in the javascript version I had devoted so much time and thought to, I never considered sharing my PHP version.
= Usage =
<span style="color: red">so to add a new one, copy that line and paste it in again but in this new line replace 'mintemp' with whatever you have added as the first element in your new array row, replace '[1]' with square brackets round the number of your new array row (the first row is number zero) and finally replace '4' with the [[Dayfile.txt#List_of_fields_in_the_file|field number]] where the parameter you have added is found in dayfile.txt.</span>
<span style="color: red">It really is much easier to add new data sets if you use the alternative JavaScript version in the forum. That includes more explanation about the original coding, and an alternative simpler way to specify and adjust the columns in a revised version of the above array.</span>
== Styling (applies only to original version of code) ==
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]
*In version 1.1 of this tool, jQuery version 1.5 is called, this permitted use of '.attr' object to add/remove the highlight; from jQuery version 1.6 that was deprecated and the '.prop' object is now specified for the same purpose.
*Version 1.0 and 1.1 default to showing a table for viewer's local current calendar year. Remember the dayfile.txt (even if updated each day) only contains records up to the day ending at the last rollover time using the timezone local to the weather station. Timezone differences when combined with rollover time variations can lead to a period of 2 days discrepancy. At New Year a blank table will be displayed during this period by default. For example, 30 or 31 (depending on whether rollover has occured) in December of the last year could be the latest available for a site in USA whilst the original version of the code is showing a blank table of the next year during early morning on 2 January in Austrailia. Even when station and viewer are in same timezone, there will be a blank table until the first rollover on 2 January.
*Version 1.2 defaults to showing the year found in the last row of dayfile.txt.
*The final field on each row is not read correctly, because the row break has been specified wrongly for a Microsoft Windows environment, it should quote '''fdata.split("\r\n");''' i.e. ''defines that carriage return then line feed (newline) used to split daily observations in dayfile''. Because the script presented here only processes a small number of fields from earlier in the row, this error does not affect the output for the published code.
= Version Control =
(Alternative JavaScript and PHP versions not listed here - see forum references above)
1.2 This revised PHP only version can also be downloaded above
1.1 PHP version included with JavaScript version in new download package
|
edits