Weather Diary

From Cumulus Wiki

Introduction

The Weather Diary feature allows the user to enter some short notes (up to 1024 characters) for each day, and to record whether snow was falling and/or lying on that day, along with the depth of snow.

If you have manual weather observations, or want a permanent record of general conditions each day, this diary is the place to hold such notes.

Invitation

Anybody with experience of using this feature is encouraged to contribute to this article.

Cumulus 1 functionality

Where is the diary held?

Please see Log.xml page for details about file, and how to read it using PHP Hypertext Preprocessor or a XML reader.

This file can be opened as a text file, but there are database file readers that can open this sort of file and display them in a spreadsheet like format (or even convert them to formats like CSV). It is possible to upload this file, or a transformed version of it, onto your webspace and write coding to display the contents, see Cumulus Weather Diary.

How to edit the contents

On the main Cumulus screen select Weather Diary from the View menu.

How do I change the time a diary day begins/ends?

The diary loads displaying the current calendar day.

This may not be the right day to enter current information as the rollover time for Weather Diary information is configurable using Cumulus.ini e.g. SnowDepthHour=9 means everything (not just snow depth) in yesterday's diary entry applies until 9am. The SnowDepthHour label applies because the only part of the diary that is converted to a Webtag is Snow Depth, and the time set is when <#snowdepth> is updated with the current day's value, until then it shows the value on yesterday's diary page.

NOTE: This rollover time is totally independent of any overall 'log rollover' time set in station screen as accessed from Configuration menu. You may use midnight rollover, but want to go out and record manual observations (including measuring any snow) each morning at 9am (or any other time).

Web tags available for your web site

For Cumulus 1, the only web tag is <#snowdepth>. Obviously a non-zero value means snow is lying, so it can be treated as a boolean for that.

For any more information you need to read the Log.xml file and process that as indicated on referenced page.

Cumulus MX implementation

There are a number of differences between the Cumulus 1 and MX implemenations. Please read more at Weather Diary (C1 and MX Differences)

How to edit the MX Weather Diary

Using the admin interface

  1. Under the Edit tab, select Weather Diary and a calendar based selector appears.
  2. Click on required date, enter any Comment (stored as "Entry" in the database), tick the boxes for falling, and lying.
  3. Use the spin selector or type in a snow depth. This field takes decimals (it is labelled as "cm", although you could select a different unit and ignore units shown!).

Accessing outside MX

The weather diary is stored in a sqLite database and that can be easily accessed by any ODBC software e.g. Libre Office. It can also be accessed using PDO instructions in PHP Hypertext Preprocessor.

Here is an example in a PHP 7.3 (there are changes for PHP 7.4) script of accessing any one day ($rowMetDayStamp in yyyy-mm-dd format):

$diary 		= 'sqlite:' . $snowDiary; // Parameter to identify a SQLite database puts a prefix in front of file path
$dbhandle 	= new PDO($diary);  // connect to db
if($dbhandle === false)
{
	$liteError = sqlite_last_error ($dbhandle );
	echo ' Error: ' . sqlite_error_string ($liteError);
}else{
	if($debug)	echo $lf . '============================' . $lf . 'Success, database ' . $diary . ' is open' . $lf;
	$queryRead =  "SELECT ALL *  FROM " . "'DiaryData'";
	$statement = $dbhandle -> query($queryRead);
	if($statement === false)
	{
		$liteError = sqlite_last_error ($dbhandle );
		echo ' Error: ' . sqlite_error_string ($liteError);
	}else{
		$jump = false;
		foreach ($statement as $row)
		{
			foreach($row as $key => $value )
			{
				if($key == 'Timestamp')
				{
					$keyDate = substr($value, 0, 10);
				}
				if($keyDate != $rowMetDayStamp) break;
				 if($key == 'snowFalling') 	$falling 	= $value;
				if($key == 'snowLying') 		$lying 	= $value;
				if($key == 'snowDepth')		$depth 	= $value;
				if($key == 'entry')			$Entry 	= $value;
				$jump = true;
  		       }
         		if($jump)
			{
				$snowKnown = true;
				goto snowDone;
			}
		}
	}
}

Web tags available for your web site

Cumulus MX provides web tags for everything in the weather diary for current day (except the comment). There are no web tags for past days.

How do I change the time a diary day begins/ends?

The diary loads displaying the current calendar day.

This may not be the right day to enter current information as the rollover time for Weather Diary information is configurable using Cumulus.ini e.g. SnowDepthHour=9 means everything (not just snow depth) in yesterday's diary entry applies until 9am. The SnowDepthHour label applies because the only part of the diary that is converted to a Webtag is Snow Depth, and the time set is when <#snowdepth> is updated with the current day's value, until then it shows the value on yesterday's diary page.

NOTE: This rollover time is totally independent of any overall 'log rollover' time set in station screen as accessed from Configuration menu. You may use midnight rollover, but want to go out and record manual observations (including measuring any snow) each morning at 9am (or any other time).

Snow

The weather station models that Cumulus is programmed for do not include any automated snow measurement. So Cumulus does not treat Snow the same way as automated measurements (until it melts and any left on top of, or inside, a rain gauge is counted as rain). Instead Cumulus assumes you will manually insert information.

Entering Snow Information

You can go outside with a ruler and measure the depth of any lying snow. The option Weather Diary within the View menu allows you to navigate to the appropriate day (see above) and:

  • make a text note (this might cover include the time snow started falling, and/or stopped falling or something about the intensity of the snow storm),
  • tick snow lying (this is a snapshot, you can only tick/untick for the whole day),
  • enter an integer representing the snow depth at your chosen updating time (this can be in any units, mm, cm, inches, thumbnails or marked stick - just remember to always use the same units as the units are not recorded)
  • tick snow falling (this is a snapshot, you can only tick/untick for the whole day).

Click update button, or all your entries will be lost.

Displaying on a customised web page

If you understand HTML table syntax, the Webtag <#snowdepth> can be inserted on a ( for example the todayT.htm) web template (see Customised templates) to display the snow depth (updating at time set in Cumulus.ini as explained above. If you understand JavaScript and HTML, you can arrange to upload a background with a scale on which the script can use <#snowdepth> to overlay the correct depth as a white blanket for example. The script would have similarities to the current part of the script provided with Cumulus that plots rainfall as a bar chart. If you are using MX some other web tags can be used too.

Some sites use the current conditions feature in Cumulus 1 (optional box on main screen, plus ability to create a file that is deleted on use - see Cumulus help) to display further snow information.

Some sites using Cumulus and updating databases as input for creating pages using PHP do manage to display other information from the diary on their web sites (search the support forum for mentions of snow).