Dayfile.txt: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
2,329 bytes added ,  13:55, 18 March 2020
m
→‎Introduction: add sentence about Cumulus 1 and mX
(revised '''Important Rules''': to make them cope with MX and non-windows devices)
m (→‎Introduction: add sentence about Cumulus 1 and mX)
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Introduction =
= Introduction =
Cumulus maintains a daily log file that holds the highs and lows of each day, as well as a few other nuggets of information.  The figures contained in the file are used for the 'This period' display accessed from the '''View''' menu and to build any graphs based on daily values.
Cumulus maintains a daily log file that holds the highs and lows of each day, as well as a few other nuggets of information.  The figures contained in the file are used for the 'This period' display accessed from the '''View''' menu and to build any graphs based on daily values.
The format of this file is the same for both Cumulus 1 and Cumulus MX. It can be ported between them only if both run with exactly the same locale settings, as using a different locale may change the field separator or the symbol used for decimal points.


== When Cumulus is left running ==
== When Cumulus is left running ==
Line 19: Line 21:
* Back ups of all the log files mentioned here (not all the log files) including dayfile.txt are copied to the 'cumulus\backup' folder, the last 8 only are retained.
* Back ups of all the log files mentioned here (not all the log files) including dayfile.txt are copied to the 'cumulus\backup' folder, the last 8 only are retained.
== How you can use the daily log ==
== How you can use the daily log ==
*If you want to run scripts that use the daily log, it is best if you take a copy first, I take a copy that is put onto my web server by using the '''Daily''' box in the bottom left of the ''Sites/Options'' frame within the ''Internet'' options screen from the '''Configuration''' menu to safely take a copy of 'dayfile.txt' after it is updated.  See Cumulus '''Help''' for information on using this feature, I add a redirection ">daily_batch.log" in the parameter box alongside so that any output from my "T:\Cumulus\daily_batch_all.cmd" in the main box is sent to a log file overwritten in each run; this enables me to see the reason for any failure.  My Cumulus 1 batch command also runs PHP to create SQL to update a database table version of the log, but my database table version also contains some additional information from the daily backup '[[today.ini]]' log.  
* If you want to run scripts that use the daily log, it is best if you take a copy first, you can ask Cumulus 1 to take a copy after each update by using the '''Daily''' box in the bottom left of the ''Sites/Options'' frame within the ''Internet'' options screen from the '''Configuration''' menu; that will safely take a copy of 'dayfile.txt' after it is updated. This has the advantage it happens even if Cumulus has been stopped and restarted and rollover is happening during catch-up and so not at usual rollover time according to the computer clock.  See Cumulus 1 '''Help''' for information on using this feature, I add a redirection ">daily_batch.log" in the parameter box alongside so that any output from running the command file I specify in the main box is sent to a log file overwritten in each run; this enables me to see the reason for any failure.   
*The system routines that Cumulus uses to access dayfile.txt require exclusive use of that file, so if you have any other process trying to access that file at end of the (meteorological) day, or when a relevant option is selected from View or Edit menus, one or other may fail.  
* Cumulus MX has option to list files to be transferred once a day as part of rollover, so you can use that to generate your extra copy. This has the advantage it happens even if Cumulus has been stopped and restarted and rollover is happening during catch-up.
*You can find examples of code that uses the daily log elsewhere in this Wiki and on the support forum.
* A third party toll "Cumulus Toolbox" can also be used to copy/transfer files at a particular time. Note this cannot tell whether Cumulus has done its rollover at the normal time, or during catch-up.
*Cumulus MX includes the ability to generate SQL to update a database table version of the log. Using that database table avoids any clash with the Cumulus MX update of the daily summary log.
* There are other ways to specify that when a file changes it is copied somewhere.
*The system routines that Cumulus uses to access dayfile.txt require exclusive use of that file, so if you have any other process trying to access that file when Cumulus restarts, when Cumulus processes end of the (meteorological) day, or when a relevant option is selected from View or Edit menus, either your external process or the Cumulus process may fail.
 
== Populating a database table ==
* The [[ImportCumulusFile|article here]] describes a method that can be used with Cumulus 1 to mimic the contents of dayfile.txt in a database table.
* Cumulus MX includes the ability to generate SQL to update a database table version of the log.  
 
In both cases, your web site can use that database table avoiding any clash of timing with the Cumulus 1 or MX use of the daily summary log. For examples of some of the third party tools using the database daily summary table see [[Daily Summary#Some_example_Scripts|here]].
 
Of course you do not need to exactly mimic the log file with the schema in your database table, your weather station may not produce solar values so those fields in dayfile.txt need not be columns in your database table, or you may wish to add other values from external sensors or other log files. MX allows you to specify a different schema in the SQL it generates. In my own case, my daily summary table has no solar columns but it does have several additional columns (including the daily increment of chill hours, the cumulative chill hours, the time of the last rain tip, wind bearings as compass characters (e.g. NNW) as well as numerical bearings). I use Cumulus 1 so I have written the PHP script to find all these additional values, for example it reads the [[today.ini]] stored in the end of day backup, but other sources are also used. In my case I also store the equivalent of what appears on my version of "thismonth.htm" each month in another database table. This monthly summary table allows me to have web pages that compare consecutive months or compare months between years. Again MX has the ability to store end of month figures, a feature that Cumulus 1 and 2 lacked.


== Viewing or Editing the daily summary log ==
== Viewing or Editing the daily summary log ==
5,838

edits

Navigation menu