Weather Diary: Difference between revisions

945 bytes removed ,  15:34, 16 June 2022
m
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Introduction=
=Introduction=
Cumulus 1 introduced the [[Log.xml|"Log"]] where you could log any manual observations to complement what Cumulus could read from your weather station.  That naming apparently caused a lot of confusion, Steve Loft wrote 26 November 2008, "the 'Log', which is an over-used term in Cumulus, I know",  so (at a version that has not been recorded) he decided to replace his "Station Log" screen, by a "Weather Diary" screen.  MX at all releases since build 3046 (beta release 3.0.0) has used the latter term, the functionally was missing in earlier builds.


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.  
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.
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.
[[Category:Cumulus 1]] [[Category:Cumulus Files]] [[Category:Cumulus MX]]


=Snow=
=Snow=


The weather station models that Cumulus is programmed for do not include any automated snow measurement.  However, many people asked Steve Loft, the developer of Cumulus, to provide functionality for manual snow recording.  The functionality is provided by a weather diary, that allows you to record any data against a date, for example some people record events like thunderstorms, or hailstorms.
The weather station models that Cumulus is programmed for do not include any automated snow measurement.  However, many people asked Steve Loft, the developer of Cumulus, to provide functionality for manual snow recording.   
 
The functionality was provided by a new "Station Log" (now called "weather diary"), that allows you to record any data against a date, for example some people record events like thunderstorms, or hailstorms.


Obviously when snow melts, any snow sitting on top of (or inside) a rain gauge is counted as rain).
Obviously when snow melts, any snow sitting on top of (or inside) a rain gauge is counted as rain).
Line 16: Line 21:
You can go outside with a ruler and measure the depth of any lying snow.  
You can go outside with a ruler and measure the depth of any lying snow.  


Meteorologists use centimetres, and MX is pre-programmed to expect that allowing 2 decimal places.  In the original Cumulus software,  any depth entered has to be a whole number, and in later versions, Cumulus 1 allows you to select the units (e.g. millimetres would allow you to report depth to nearest tenth of a cm; alternatively you could specify tenths of an inch). Some people record snow depth by counting marks on a stick or how many parts of a finger/hand are buried.
Meteorologists use centimetres, and '''MX''' is pre-programmed to expect that unit, but allowing 2 decimal places (selected because people in USA prefer inches with this level of precision).  In the '''original Cumulus''' software,  any depth entered has to be a whole number, and in later versions, Cumulus 1 allows you to select the units (e.g. millimetres would allow you to report depth to nearest tenth of a cm; alternatively you could specify tenths of an inch). Some people record snow depth by counting marks on a stick or how many parts of a finger/hand are buried.


For Cumulus 1, you can record multiple entries in a single day, this feature makes the coding in the diary impossible to understand, even Steve Loft was unable to understand how the routine he borrowed worked!
For Cumulus 1, you can record multiple entries in a single day, this feature makes the coding in the diary impossible to understand (and means it could not be edited in a standard XML editor), even Steve Loft was unable to understand how the routine he borrowed worked!




Line 30: Line 35:
*In original Cumulus, click '''Update''' button, or all your entries will be lost.
*In original Cumulus, click '''Update''' button, or all your entries will be lost.
*In MX admin interface, click '''Apply''' button, and wait until you see confirmation that an entry or update has been processed.
*In MX admin interface, click '''Apply''' button, and wait until you see confirmation that an entry or update has been processed.
= Cumulus 1 and MX diary differences =
= Cumulus 1 and MX diary differences =


Line 41: Line 47:
For Cumulus 1, see [[Log.xml|Log.xml page]] for details about file, and how to read it using PHP Hypertext Preprocessor or a XML reader.
For Cumulus 1, see [[Log.xml|Log.xml page]] for details about file, and how to read it using PHP Hypertext Preprocessor or a XML reader.


The Cumulus 1 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 [https://cumulus.hosiene.co.uk/viewtopic.php?p=83883#p83883 Cumulus Weather Diary].
The Cumulus 1 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 web server and write coding to display the contents, see [https://cumulus.hosiene.co.uk/viewtopic.php?p=83883#p83883 Cumulus Weather Diary].
 
The MX weather diary is stored in a table called '''DiaryData''' in a SQLite3 database in a file called [[diary.db]].  Any application that can read ODBC files (e.g. Libre Office's Base functionality) can read the MX database and edit it.  It is possible to upload this file into your webspace, where coding can display the contents, please see below.
 
If you have ability to run '''PHPLIteAdmin''' (i.e. web server running PHP Hypertext Preprocessor), that can read and edit the [[Setting_up_Raspberry_Pi#Editing_the_Weather_Diary|MX weather diary]].  


The MX weather diary is stored in a table called '''DiaryData''' in a SQLite3 database in a file called [[diary.db]].  There are many software tools available that can read/edit SQLite3, this is not the place to get too technical, but take a look at '''sqlitebrowser''' in a Linux environment, and '''phpLiteAdmin''' in Microsoft Windows.  Also, you could use any application that can read ODBC files (e.g. Libre Office's Base functionality) can read the MX databases.


=How to edit the contents=
=How to edit the contents=
Line 63: Line 66:
#Click on required date, enter any Comment (stored as "Entry" in the database), tick the boxes for falling, and lying.
#Click on required date, enter any Comment (stored as "Entry" in the database), tick the boxes for falling, and lying.
#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!).
#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!).
# Update (if an entry already exists, that will be replaced)
#wait for confirmation of update


==How do I change the time a diary day begins/ends?==
==How do I change the time a diary day begins/ends?==
Line 142: Line 147:
goto snowDone;
goto snowDone;
}// end snow diary file processing</pre>
}// end snow diary file processing</pre>
== Accessing MX diary outside MX ==
The weather diary is stored in [[diary.db|a sqLite database]] and that can be easily accessed by any ODBC software e.g. Libre Office Base. It can also be accessed using PDO instructions in PHP Hypertext Preprocessor.
Here is an example in a PHP 7.3 (please note, this script will not work without changes for PHP 7.4, and PHP 8.x) script (modification of script available in [[File:Snow diary.zip]]) of accessing any one day ($rowMetDayStamp in yyyy-mm-dd format):
<pre>$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;
}
}
}
}
</pre>
[[Category: Terminology]]
[[Category:Log Files]]
[[Category:Cumulus 1]]
[[Category:Cumulus MX]]
5,838

edits