CVS: phpweather phpweather.php,1.26,1.27
Brought to you by:
iridium
From: Martin G. <gim...@us...> - 2002-05-18 09:20:23
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv27173 Modified Files: phpweather.php Log Message: It seams that pow() cannot handle floats passed to it as strings, at least not in PHP 4.2.0 at gimpster.com. The strange thing is that it works in PHP 4.1.2 at my local machine. Index: phpweather.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/phpweather.php,v retrieving revision 1.26 retrieving revision 1.27 diff -u -3 -r1.26 -r1.27 --- phpweather.php 18 May 2002 08:39:08 -0000 1.26 +++ phpweather.php 18 May 2002 09:20:20 -0000 1.27 @@ -240,14 +240,15 @@ } else { $month = gmdate('n'); } - $decoded_metar['time'] = gmmktime($regs[2] + $this->properties['offset'], $regs[3], 0, $month, $regs[1], gmdate('Y')); + $decoded_metar['time'] = + gmmktime($regs[2] + $this->properties['offset'], + $regs[3], 0, $month, $regs[1], gmdate('Y')); } elseif (ereg('(AUTO|COR|RTD|CC[A-Z]|RR[A-Z])', $part, $regs)) { /* * Report Modifier: AUTO, COR, CCx or RRx */ - - $decoded_metar['report_mod'] = $regs[1]; + $decoded_metar['report_mod'] = $regs[1]; } elseif (ereg('([0-9]{3}|VRB)([0-9]{2,3})G?([0-9]{2,3})?(KT|MPS|KMH)', $part, $regs)) { /* Wind Group */ @@ -258,8 +259,7 @@ $regs[4], $decoded_metar['wind']['knots'], $decoded_metar['wind']['meters_per_second'], - $decoded_metar['wind']['miles_per_hour'] - ); + $decoded_metar['wind']['miles_per_hour']); if (!empty($regs[3])) { @@ -646,9 +646,9 @@ $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) + - 35.75*pow((float)$decoded_metar['wind']['miles_per_hour'], 0.16) + 0.4275*$decoded_metar['temperature']['temp_f'] * - pow($decoded_metar['wind']['miles_per_hour'], 0.16)); + pow((float)$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) @@ -662,26 +662,27 @@ if (!empty($decoded_metar['temperature']['temp_f']) && $decoded_metar['temperature']['temp_f'] > 70 && !empty($decoded_metar['rel_humidity'])) { - $decoded_metar['heatindex']['heatindex_f']= - number_format(-42.379 + 2.04901523*$decoded_metar['temperature']['temp_f'] - + 10.14333127*$decoded_metar['rel_humidity'] - - 0.22475541*$decoded_metar['temperature']['temp_f'] - *$decoded_metar['rel_humidity'] - - 0.00683783*$decoded_metar['temperature']['temp_f'] - *$decoded_metar['temperature']['temp_f'] - - 0.05481717*$decoded_metar['rel_humidity'] - *$decoded_metar['rel_humidity'] - + 0.00122874*$decoded_metar['temperature']['temp_f'] - *$decoded_metar['temperature']['temp_f'] - *$decoded_metar['rel_humidity'] - + 0.00085282*$decoded_metar['temperature']['temp_f'] - *$decoded_metar['rel_humidity'] - *$decoded_metar['rel_humidity'] - - 1.99*pow(10,-6)*$decoded_metar['temperature']['temp_f'] - *$decoded_metar['temperature']['temp_f'] - *$decoded_metar['rel_humidity'] - *$decoded_metar['rel_humidity']); - $decoded_metar['heatindex']['heatindex_c']= + $decoded_metar['heatindex']['heatindex_f'] = + number_format(-42.379 + + 2.04901523 * $decoded_metar['temperature']['temp_f'] + + 10.1433312 * $decoded_metar['rel_humidity'] + - 0.22475541 * $decoded_metar['temperature']['temp_f'] + * $decoded_metar['rel_humidity'] + - 0.00683783 * $decoded_metar['temperature']['temp_f'] + * $decoded_metar['temperature']['temp_f'] + - 0.05481717 * $decoded_metar['rel_humidity'] + * $decoded_metar['rel_humidity'] + + 0.00122874 * $decoded_metar['temperature']['temp_f'] + * $decoded_metar['temperature']['temp_f'] + * $decoded_metar['rel_humidity'] + + 0.00085282 * $decoded_metar['temperature']['temp_f'] + * $decoded_metar['rel_humidity'] + * $decoded_metar['rel_humidity'] + - 0.00000199 * $decoded_metar['temperature']['temp_f'] + * $decoded_metar['temperature']['temp_f'] + * $decoded_metar['rel_humidity'] + * $decoded_metar['rel_humidity']); + $decoded_metar['heatindex']['heatindex_c'] = number_format(($decoded_metar['heatindex']['heatindex_f'] - 32) / 1.8); } |