[Xfce4-commits] <xfce4-weather-plugin:master> Fix checking constraints for apparent temperatures.
Harald Judt
noreply at xfce.org
Thu Jan 10 16:34:03 CET 2013
Updating branch refs/heads/master
to ee6750351e877b890a95b51d45525b804f94f0a1 (commit)
from e71e1ae2bd7a79606a6aaef9c3f66ab1dfbb12f7 (commit)
commit ee6750351e877b890a95b51d45525b804f94f0a1
Author: Harald Judt <h.judt at gmx.at>
Date: Wed Jan 9 16:11:24 2013 +0100
Fix checking constraints for apparent temperatures.
Move the checks to where they belong.
panel-plugin/weather-data.c | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/panel-plugin/weather-data.c b/panel-plugin/weather-data.c
index 5984794..2b33d43 100644
--- a/panel-plugin/weather-data.c
+++ b/panel-plugin/weather-data.c
@@ -181,16 +181,17 @@ calc_apparent_temperature(const xml_location *loc,
/* If temperature is lower than 10 °C, use wind chill index,
if above 26.7°C use the heat index / Summer Simmer Index. */
- /* wind chill is only defined for wind speeds above 3.0 mph */
- windspeed *= 3.6;
- if (windspeed < 4.828032)
- return temp;
-
/* Wind chill, source:
http://www.nws.noaa.gov/os/windchill/index.shtml */
- if (temp <= 10.0)
+ if (temp <= 10.0) {
+ /* wind chill is only defined for wind speeds above 3.0 mph */
+ windspeed *= 3.6;
+ if (windspeed < 4.828032)
+ return temp;
+
return 13.12 + 0.6215 * temp - 11.37 * pow(windspeed, 0.16)
+ 0.3965 * temp * pow(windspeed, 0.16);
+ }
if (temp >= 26.7 || (night_time && temp >= 22.0)) {
/* humidity needs to be higher than 40% for a valid result */
@@ -233,16 +234,17 @@ calc_apparent_temperature(const xml_location *loc,
if above 20.0 °C use humidex. Source:
http://www.weatheroffice.gc.ca/mainmenu/faq_e.html */
- /* wind chill is only defined for wind speeds above 2.0 km/h */
- windspeed *= 3.6;
- if (windspeed < 2.0)
- return temp;
+ if (temp <= 0) {
+ /* wind chill is only defined for wind speeds above 2.0 km/h */
+ windspeed *= 3.6;
+ if (windspeed < 2.0)
+ return temp;
- if (temp <= 0)
/* wind chill, source:
http://www.nws.noaa.gov/os/windchill/index.shtml */
return 13.12 + 0.6215 * temp - 11.37 * pow(windspeed, 0.16)
+ 0.3965 * temp * pow(windspeed, 0.16);
+ }
if (temp >= 20.0) {
/* Canadian humidex, source:
More information about the Xfce4-commits
mailing list