Log.xml: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
271 bytes removed ,  31 May 2020
m
no edit summary
mNo edit summary
mNo edit summary
echo 'ERROR - cannot access weather diary';
}else{
if($debug) echo 'Success, database ' . $snowDiary . ' is open' . PHP_EOL;
$data = fread($fh, filesize($snowDiary));
fclose($fh); // close diary, now contents in $data
$converted = iconv("Windows-1250", "UTF-8//IGNORE", $data); // Convert from windows format that Cumulus uses to UTF-8 to match what most scripts now use
$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'];
$oldFalling = $falling;
// novel to SPAWS
$oldFallingoldLying = $fallinglying;
$oldLyingoldDepth = $lyingdepth;
$oldKey $oldDepth = $depthkey;
} // end of loop through XML records
$oldKey = $key;
if($key == $rowMetDayStamp)
} // end of loop through XML records
{
if($key == $rowMetDayStamp)
$snowKnown = true;
{
goto snowDone;
$snowKnown = true;
}
if ($debug)
$snowKnown = false;
{
$Entry = Null; // Other variables were previously set to values appropriate for the lowest temperature
echo ' ----- Found entry in weather diary for ' . $englishProcessingDate . $lf;
goto snowDone;
}
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;
}
snowDone:</pre>
5,838

edits

Navigation menu