Small patches to avoid loss of precision in computed SI values.
From: Alec Leamas <leamas.alec%AT%gmail.com>
---
mythweather/scripts/us_nws/ndfd.pl | 10 +++++-----
mythweather/scripts/us_nws/ndfd18.pl | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/mythweather/scripts/us_nws/ndfd.pl b/mythweather/scripts/us_nws/ndfd.pl
index a69ee2f..ef74938 100755
a
|
b
|
foreach $time (sort(keys(%$result))) { |
162 | 162 | my $geticon = 0; |
163 | 163 | if ($lowindex <= 5 && $result->{$time}->{temperature_minimum}) { |
164 | 164 | if ($units eq 'SI') { |
165 | | $result->{$time}->{temperature_minimum} = |
166 | | int ( (5/9) * ($result->{$time}->{temperature_minimum}-32)); |
| 165 | $result->{$time}->{'temperature_minimum'} = |
| 166 | (5/9) * ($result->{$time}->{'temperature_minimum'}-32); |
167 | 167 | } |
168 | | print "low-${lowindex}::$result->{$time}->{temperature_minimum}\n"; |
| 168 | printf "low-%d::%.2f\n", $lowindex, $result->{$time}->{'temperature_minimum'} ; |
169 | 169 | $lowindex++; |
170 | 170 | } elsif ($hiindex <= 5 && $result->{$time}->{temperature_maximum}) { |
171 | 171 | if ($units eq 'SI') { |
172 | 172 | $result->{$time}->{temperature_maximum} = |
173 | | int ( (5/9) * ($result->{$time}->{temperature_maximum}-32)); |
| 173 | (5/9) * ($result->{$time}->{temperature_maximum}-32); |
174 | 174 | } |
175 | | print "high-${hiindex}::$result->{$time}->{temperature_maximum}\n"; |
| 175 | printf "high-%d::%.2f\n", $hiindex, $result->{$time}->{temperature_maximum}; |
176 | 176 | $hiindex++; |
177 | 177 | $geticon = 1; |
178 | 178 | } |
diff --git a/mythweather/scripts/us_nws/ndfd18.pl b/mythweather/scripts/us_nws/ndfd18.pl
index dd0e607..c34ffda 100755
a
|
b
|
foreach my $time (sort keys %$result) { |
141 | 141 | print "time-${index}::" . UnixDate($time, "%i %p\n"); |
142 | 142 | if ($units eq 'SI') { |
143 | 143 | $result->{$time}->{temperature_hourly} = |
144 | | int( (5/9) * ($result->{$time}->{temperature_hourly}-32)); |
| 144 | (5/9) * ($result->{$time}->{temperature_hourly}-32); |
145 | 145 | } |
146 | | print "temp-${index}::$result->{$time}->{temperature_hourly}\n"; |
| 146 | printf "temp-%d::%.2f\n", $index, $result->{$time}->{temperature_hourly}; |
147 | 147 | print "pop-${index}::$pop12 %\n"; |
148 | 148 | $icon = $result->{$time}->{'conditions-icon_forecast-NWS'}; |
149 | 149 | $icon =~ s/.*\/([a-z0-9_]+[.][j][p][g])/$1/; |