Weather Diary: Difference between revisions
(20 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= |
|||
==Invitation== |
|||
Anybody with experience of using this feature is encouraged to contribute to this article. |
|||
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. |
|||
= Cumulus 1 functionality = |
|||
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. |
|||
== Where is the diary held? == |
|||
Obviously when snow melts, any snow sitting on top of (or inside) a rain gauge is counted as rain). |
|||
Please see [[Log.xml|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 [https://cumulus.hosiene.co.uk/viewtopic.php?p=83883#p83883 Cumulus Weather Diary]. |
|||
==Entering Snow Information== |
|||
==How to edit the contents== |
|||
You can go outside with a ruler and measure the depth of any lying snow. |
|||
On the main Cumulus screen select Weather Diary from the View menu. |
|||
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. |
|||
==How do I change the time a diary day begins/ends?== |
|||
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! |
|||
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. |
|||
The functionality for both Cumulus 1 and MX allows you to: |
|||
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). |
|||
* tick ''snow falling'', |
|||
* tick ''snow lying'', |
|||
*enter ''snow depth'' (see note above as only MX allows decimal places) |
|||
* record 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), |
|||
The label on the button to store what you entered varies: |
|||
== Web tags available for your web site == |
|||
*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. |
|||
= Cumulus 1 and MX diary differences = |
|||
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. |
|||
There are a number of differences between the Cumulus 1 and MX implementations, as covered in following sub-sections. There is some discussion in the Cumulus support forum at [https://cumulus.hosiene.co.uk/viewtopic.php?f=36&t=17919&p=139854&hilit=weather+diary#p139854 Weather Diary (C1 and MX Differences)]. |
|||
For any more information you need to read the [[Log.xml|Log.xml file]] and process that as indicated on referenced page. |
|||
= Cumulus MX implementation = |
|||
= Where is the diary held? = |
|||
There are a number of differences between the Cumulus 1 and MX implemenations. Please read more at [https://cumulus.hosiene.co.uk/viewtopic.php?f=36&t=17919&p=139854&hilit=weather+diary#p139854 Weather Diary (C1 and MX Differences)] |
|||
In all flavours, the diary is held in a file in the [[Data folder|data sub-folder]]. |
|||
== How to edit the MX Weather Diary == |
|||
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. |
|||
=== Using the admin interface === |
|||
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]. |
|||
#Under the '''Edit''' tab, select '''Weather Diary''' and a calendar based selector appears. |
|||
#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!). |
|||
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. |
|||
=== Accessing outside MX === |
|||
=How to edit the contents= |
|||
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. It can also be accessed using PDO instructions in PHP Hypertext Preprocessor. |
|||
Original Cumulus software: |
|||
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): |
|||
# On the main Cumulus screen select Weather Diary from the [[Cumulus_Screenshots#View_Menu|View menu]]. |
|||
<pre>$diary = 'sqlite:' . $snowDiary; // Parameter to identify a SQLite database puts a prefix in front of file path |
|||
#Select date |
|||
$dbhandle = new PDO($diary); // connect to db |
|||
#update tick boxes for falling and lying |
|||
if($dbhandle === false) |
|||
#enter snow depth (must be integer, but you can enter it in any unit you like) |
|||
{ |
|||
#enter any text |
|||
$liteError = sqlite_last_error ($dbhandle ); |
|||
#save (if an entry already exists for this date, an extra entry will be created) |
|||
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> |
|||
== Web tags available for your web site == |
|||
Using the MX admin interface: |
|||
Cumulus MX provides [[Webtags#Today|web tags]] for everything in the weather diary for current day (except the comment). There are no web tags for past days. |
|||
#Under the '''Edit''' tab, select '''Weather Diary''' and a calendar based selector appears. |
|||
#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!). |
|||
# 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?== |
||
The diary loads displaying the current calendar day. |
The Cumulus 1 diary loads displaying the current calendar day. The MX diary loads displaying a calendar with current calendar day highlighted, click on that to load the current 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. |
This may not be the right day to enter current information as the rollover time for Weather Diary information is configurable using [[Cumulus.ini_(Cumulus_1)|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. |
|||
The SnowDepthHour label applies because the only part of the diary that is, in the original Cumulus 1, converted to a [[Webtags#Today|web tags]] 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. For MX, other web tags are available, and these apply to same day. |
|||
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). |
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 = |
|||
=Snow= |
|||
See [[Webtags#Today|web tags]] page for the definitive list. |
|||
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. |
|||
For Cumulus 1, the only web tag is today's <#snowdepth>. Obviously a non-zero value means snow is lying, so it can be treated as a boolean for that. The '''snow index''' is calculated (see [https://cumulus.hosiene.co.uk/viewtopic.php?f=4&t=215 "snow index" forum post] and there is a [[Cumulus_Screenshots#View_Menu|menu item]] to show it. |
|||
==Entering Snow Information== |
|||
For MX, today's <#snowfalling>, <#snowlying>, and <#snowdepth> are available as; this is everything in the weather diary for current day (except the comment). There are no web tags for past days. Snow index is not in MX functionality. |
|||
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== |
==Displaying on a customised web page== |
||
If you understand HTML table syntax, the |
If you understand HTML table syntax, the web tag ''<#snowdepth>'' can be inserted on a web template (e.g. ''todayT.htm''). If you are using MX some other web tags can be used too. More help is available on the [[Customised templates]]) page. |
||
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 1 that plots rainfall as a bar chart. |
|||
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 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 1 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). |
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). |
||
==How to view the contents of Cumulus 1 diary on a web page== |
|||
[[Category: Terminology]] |
|||
[[Category:Log Files]] |
|||
The php script included in [[File:Cumulus 1 Weather Diary PHP reader.zip]] will read the Cumulus 1 weather diary and output it to a web page. Although that script is not in English, it is possible to translate the text, and it is possible to modify the script in various ways. For example, in one modification I made it combine the multiple entries possible for one day into a single "worst case" output and in another modification I supply it with a date and it only outputs records for that date as shown below: |
|||
<pre>$fh = fopen($snowDiary, 'r'); |
|||
if ($fh == FALSE) |
|||
{ |
|||
echo 'ERROR - cannot access weather diary'; |
|||
}else{ |
|||
if($debug) echo 'Success, database ' . $snowDiary . ' is open' . PHP_EOL; |
|||
$data = fread($fh, filesize($snowDiary)); |
|||
fclose($fh); |
|||
$converted = iconv("Windows-1250", "UTF-8//IGNORE", $data); |
|||
$xml = simplexml_load_string($converted); |
|||
$dayArray = array(); |
|||
$oldKey = ''; |
|||
foreach ($xml->xpath('//ROW') as $item) |
|||
{ |
|||
$key = substr($item['EntryDate'],0,4) . '-' . substr($item['EntryDate'],4,2) . '-' . substr($item['EntryDate'],6,2); |
|||
if($key > $rowMetDayStamp) break; |
|||
$falling = $item['SnowFalling'] == 'TRUE' ? 1 : 0; |
|||
$lying = $item['SnowLying'] == 'TRUE' ? 1 : 0; |
|||
$depth = $item['SnowDepth']; |
|||
if($key == $oldKey) // update to another record for same day, retain worse boolean for falling and lying |
|||
{ |
|||
$falling = $oldFalling == 1 ? 1 : $falling; |
|||
$lying = $oldLying == 1 ? 1 : $lying; |
|||
$depth = ($depth - $oldDepth) > 0 ? $depth : $oldDepth; |
|||
} |
|||
$Entry = $item['Entry']; |
|||
// novel to SPAWS |
|||
$oldFalling = $falling; |
|||
$oldLying = $lying; |
|||
$oldDepth = $depth; |
|||
$oldKey = $key; |
|||
} // end of loop through XML records |
|||
if($key == $rowMetDayStamp) |
|||
{ |
|||
$snowKnown = true; |
|||
if ($debug) |
|||
{ |
|||
echo ' ----- Found entry in weather diary for ' . $englishProcessingDate . $lf; |
|||
} |
|||
goto snowDone; |
|||
} |
|||
if($debug) echo ' ----- NO entry in Cumulus 1 weather diary for ' . $englishProcessingDate . $lf . '============================' . $lf; |
|||
$snowKnown = false; |
|||
$Entry = Null; // Other variables were previously set to values appropriate for the lowest temperature |
|||
goto snowDone; |
|||
}// end snow diary file processing</pre> |
Latest revision as of 15:34, 16 June 2022
Introduction
Cumulus 1 introduced the "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.
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.
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 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).
Entering Snow Information
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 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 (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!
The functionality for both Cumulus 1 and MX allows you to:
- tick snow falling,
- tick snow lying,
- enter snow depth (see note above as only MX allows decimal places)
- record 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),
The label on the button to store what you entered varies:
- 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.
Cumulus 1 and MX diary differences
There are a number of differences between the Cumulus 1 and MX implementations, as covered in following sub-sections. There is some discussion in the Cumulus support forum at Weather Diary (C1 and MX Differences).
Where is the diary held?
In all flavours, the diary is held in a file in the data sub-folder.
For Cumulus 1, see 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 web server and write coding to display the contents, see Cumulus 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
Original Cumulus software:
- On the main Cumulus screen select Weather Diary from the View menu.
- Select date
- update tick boxes for falling and lying
- enter snow depth (must be integer, but you can enter it in any unit you like)
- enter any text
- save (if an entry already exists for this date, an extra entry will be created)
Using the MX admin interface:
- Under the Edit tab, select Weather Diary and a calendar based selector appears.
- 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!).
- 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?
The Cumulus 1 diary loads displaying the current calendar day. The MX diary loads displaying a calendar with current calendar day highlighted, click on that to load the current 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, in the original Cumulus 1, converted to a web tags 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. For MX, other web tags are available, and these apply to same day.
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
See web tags page for the definitive list.
For Cumulus 1, the only web tag is today's <#snowdepth>. Obviously a non-zero value means snow is lying, so it can be treated as a boolean for that. The snow index is calculated (see "snow index" forum post and there is a menu item to show it.
For MX, today's <#snowfalling>, <#snowlying>, and <#snowdepth> are available as; this is everything in the weather diary for current day (except the comment). There are no web tags for past days. Snow index is not in MX functionality.
Displaying on a customised web page
If you understand HTML table syntax, the web tag <#snowdepth> can be inserted on a web template (e.g. todayT.htm). If you are using MX some other web tags can be used too. More help is available on the Customised templates) page.
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 1 that plots rainfall as a bar chart.
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 1 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).
How to view the contents of Cumulus 1 diary on a web page
The php script included in File:Cumulus 1 Weather Diary PHP reader.zip will read the Cumulus 1 weather diary and output it to a web page. Although that script is not in English, it is possible to translate the text, and it is possible to modify the script in various ways. For example, in one modification I made it combine the multiple entries possible for one day into a single "worst case" output and in another modification I supply it with a date and it only outputs records for that date as shown below:
$fh = fopen($snowDiary, 'r'); if ($fh == FALSE) { echo 'ERROR - cannot access weather diary'; }else{ if($debug) echo 'Success, database ' . $snowDiary . ' is open' . PHP_EOL; $data = fread($fh, filesize($snowDiary)); fclose($fh); $converted = iconv("Windows-1250", "UTF-8//IGNORE", $data); $xml = simplexml_load_string($converted); $dayArray = array(); $oldKey = ''; foreach ($xml->xpath('//ROW') as $item) { $key = substr($item['EntryDate'],0,4) . '-' . substr($item['EntryDate'],4,2) . '-' . substr($item['EntryDate'],6,2); if($key > $rowMetDayStamp) break; $falling = $item['SnowFalling'] == 'TRUE' ? 1 : 0; $lying = $item['SnowLying'] == 'TRUE' ? 1 : 0; $depth = $item['SnowDepth']; if($key == $oldKey) // update to another record for same day, retain worse boolean for falling and lying { $falling = $oldFalling == 1 ? 1 : $falling; $lying = $oldLying == 1 ? 1 : $lying; $depth = ($depth - $oldDepth) > 0 ? $depth : $oldDepth; } $Entry = $item['Entry']; // novel to SPAWS $oldFalling = $falling; $oldLying = $lying; $oldDepth = $depth; $oldKey = $key; } // end of loop through XML records if($key == $rowMetDayStamp) { $snowKnown = true; if ($debug) { echo ' ----- Found entry in weather diary for ' . $englishProcessingDate . $lf; } goto snowDone; } if($debug) echo ' ----- NO entry in Cumulus 1 weather diary for ' . $englishProcessingDate . $lf . '============================' . $lf; $snowKnown = false; $Entry = Null; // Other variables were previously set to values appropriate for the lowest temperature goto snowDone; }// end snow diary file processing