Re: Meteohub plugin for Saratoga AJAX/PHP templates
Posted: Sun Jan 01, 2012 6:11 pm
Following up my own post, after a lot of digging round the files, I managed to get yesterday's rain figure showing correctly by changing the following in MH-defs.php
$yesterdayrain = MH_seqval('seqday1_rain0_total_mm',1,$uomrain); mh-defs.php
to
$yesterdayrain = MH_seqval('seqday1_rain0_total_mm',0,$uomrain); mh-defs.php
I don't know if this is the correct way but it seems to work.
All this leaves now is the Rain History in MH-trends-inc.php, where:
"Today days since last rain on" has no value showing at all.
"Week 0.0 mm over last 7 days" is not correct (should be 9.00mm) unless it means week so far, not last seven days.
"Month 9.00 mm last month" is correct.
[edit]
A couple of other rain oddities I'm getting on the MH-trends-inc.php page -
1.
RAIN
Today 0.30 mm (0.3 mm last hour)
The 0.30 mm for today is correct but it was several hours ago, not in the last hour.
2.
The Current figures at the top of the page has 0.3mm of rain but this should be zero unless Current means total for the day.
Everything else bar the rainfall issues seems to be working fine - very pleased!
John
[further edit]
Tracked down one of these (I think):
In MH-trends-inc.php, we have:
<td><?php echo langtrans('Today'); ?></td>
<td><?php echo unUnit($dayrn) . $uomRain; ?>
(<?php echo unUnit($hourrn) . $uomRain; ?> <?php langtrans('last hour'); ?>) </td>
<td><?php echo langtrans('Today'); ?></td>
In MH-defs.php
$dayrn is: $dayrn = $WX['day1_rain0_total_mm'];
which is 0.3mm in MHtags.php and displays as the day's rainfall, which is correct
but
$hourrn is: $hourrn = $WX['day1_rain0_total_mm']-$WX['last60m_rain0_total_mm'];
which is 0.3mm and 0mm respectively in MHtags.php, so last hour is displayed as 0.3mm when it is in fact 0mm.
I changed $hourrn to: $hourrn = $WX['last60m_rain0_total_mm']; which seems to have fixed it.
The current rain figure at the top of the page is in MH-trends-inc.php as $rain0minuteago, which in MH-defs.php is $WX['day1_rain0_total_mm'], so it is the total for the day. Is this the way it should be shown?
Just Today and Week in Rain History to sort out! (removed for time being).
[yet another edit]
In the Trends (MH-trends-inc.php) Yesterday max gust speed was not showing the correct value. It is using $maxgustyest. In MH-defs.php:
$maxgustyest = $WX['yday_wind0_gustspeed_mph'];
but I think it should be
$maxgustyest = $WX['yday_wind0_gustspeedmax_mph'];
In my case, this gives the correct value.
John
$yesterdayrain = MH_seqval('seqday1_rain0_total_mm',1,$uomrain); mh-defs.php
to
$yesterdayrain = MH_seqval('seqday1_rain0_total_mm',0,$uomrain); mh-defs.php
I don't know if this is the correct way but it seems to work.
All this leaves now is the Rain History in MH-trends-inc.php, where:
"Today days since last rain on" has no value showing at all.
"Week 0.0 mm over last 7 days" is not correct (should be 9.00mm) unless it means week so far, not last seven days.
"Month 9.00 mm last month" is correct.
[edit]
A couple of other rain oddities I'm getting on the MH-trends-inc.php page -
1.
RAIN
Today 0.30 mm (0.3 mm last hour)
The 0.30 mm for today is correct but it was several hours ago, not in the last hour.
2.
The Current figures at the top of the page has 0.3mm of rain but this should be zero unless Current means total for the day.
Everything else bar the rainfall issues seems to be working fine - very pleased!
John
[further edit]
Tracked down one of these (I think):
In MH-trends-inc.php, we have:
<td><?php echo langtrans('Today'); ?></td>
<td><?php echo unUnit($dayrn) . $uomRain; ?>
(<?php echo unUnit($hourrn) . $uomRain; ?> <?php langtrans('last hour'); ?>) </td>
<td><?php echo langtrans('Today'); ?></td>
In MH-defs.php
$dayrn is: $dayrn = $WX['day1_rain0_total_mm'];
which is 0.3mm in MHtags.php and displays as the day's rainfall, which is correct
but
$hourrn is: $hourrn = $WX['day1_rain0_total_mm']-$WX['last60m_rain0_total_mm'];
which is 0.3mm and 0mm respectively in MHtags.php, so last hour is displayed as 0.3mm when it is in fact 0mm.
I changed $hourrn to: $hourrn = $WX['last60m_rain0_total_mm']; which seems to have fixed it.
The current rain figure at the top of the page is in MH-trends-inc.php as $rain0minuteago, which in MH-defs.php is $WX['day1_rain0_total_mm'], so it is the total for the day. Is this the way it should be shown?
Just Today and Week in Rain History to sort out! (removed for time being).
[yet another edit]
In the Trends (MH-trends-inc.php) Yesterday max gust speed was not showing the correct value. It is using $maxgustyest. In MH-defs.php:
$maxgustyest = $WX['yday_wind0_gustspeed_mph'];
but I think it should be
$maxgustyest = $WX['yday_wind0_gustspeedmax_mph'];
In my case, this gives the correct value.
John