Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv31635
Modified Files:
phpweather.php
Log Message:
Added heat index, thanks to David Kjellquist
Index: phpweather.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/phpweather.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- phpweather.php 13 Apr 2002 13:23:41 -0000 1.23
+++ phpweather.php 12 May 2002 15:08:59 -0000 1.24
@@ -632,6 +632,35 @@
+ 0.3965*$decoded_metar['temperature']['temp_c'] *
pow(($decoded_metar['wind']['miles_per_hour']/1.609), 0.16));
}
+
+ /*
+ * Compute heat index if temp > 70F
+ */
+ 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']=
+ number_format(($decoded_metar['heatindex']['heatindex_f'] - 32) / 1.8);
+ }
+
/* Finally we store our decoded METAR in $this->decoded_metar so
* that other methods can use it.
|