Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv19240
Modified Files:
phpweather.php
Log Message:
This was giving errors if there wasn't any data available.
Index: phpweather.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/phpweather.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- phpweather.php 24 Mar 2002 17:25:35 -0000 1.18
+++ phpweather.php 25 Mar 2002 20:26:33 -0000 1.19
@@ -685,15 +685,20 @@
/*
* Compute windchill if temp < 40f and windspeed > 3 mph
*/
- if ($decoded_metar['temperature']['temp_f'] <= '40' && $decoded_metar['wind']['miles_per_hour'] > '3'){
- $decoded_metar['windchill']['windchill_f'] =
- number_format(35.74 + 0.6215*$decoded_metar['temperature']['temp_f']
- - 35.75*pow($decoded_metar['wind']['miles_per_hour'],0.16)
- + 0.4275*$decoded_metar['temperature']['temp_f']*pow($decoded_metar['wind']['miles_per_hour'],0.16));
- $decoded_metar['windchill']['windchill_c'] =
- number_format(13.112 + 0.6215*$decoded_metar['temperature']['temp_c']
- - 13.37*pow(($decoded_metar['wind']['miles_per_hour']/1.609),0.16)
- + 0.3965*$decoded_metar['temperature']['temp_c']*pow(($decoded_metar['wind']['miles_per_hour']/1.609),0.16));
+ if (!empty($decoded_metar['temperature']['temp_f']) &&
+ $decoded_metar['temperature']['temp_f'] <= '40' &&
+ !empty($decoded_metar['wind']['miles_per_hour']) &&
+ $decoded_metar['wind']['miles_per_hour'] > '3'){
+ $decoded_metar['windchill']['windchill_f'] =
+ number_format(35.74 + 0.6215*$decoded_metar['temperature']['temp_f']
+ - 35.75*pow($decoded_metar['wind']['miles_per_hour'], 0.16)
+ + 0.4275*$decoded_metar['temperature']['temp_f'] *
+ pow($decoded_metar['wind']['miles_per_hour'], 0.16));
+ $decoded_metar['windchill']['windchill_c'] =
+ number_format(13.112 + 0.6215*$decoded_metar['temperature']['temp_c']
+ - 13.37*pow(($decoded_metar['wind']['miles_per_hour']/1.609), 0.16)
+ + 0.3965*$decoded_metar['temperature']['temp_c'] *
+ pow(($decoded_metar['wind']['miles_per_hour']/1.609), 0.16));
}
/* Finally we store our decoded METAR in $this->decoded_metar so
|