CVS: phpweather phpweather.php,1.28,1.29
Brought to you by:
iridium
From: Martin G. <gim...@us...> - 2002-08-12 23:52:06
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv19064 Modified Files: phpweather.php Log Message: Support for humidex thanks to Robin Senior <8r...@ql...>. See this page for an explaination of humidex: http://www.theweathernetwork.com/help/glossary/humidex.htm Index: phpweather.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/phpweather.php,v retrieving revision 1.28 retrieving revision 1.29 diff -u -3 -r1.28 -r1.29 --- phpweather.php 29 Jun 2002 10:51:08 -0000 1.28 +++ phpweather.php 12 Aug 2002 23:52:03 -0000 1.29 @@ -685,6 +685,20 @@ $decoded_metar['heatindex']['heatindex_c'] = number_format(($decoded_metar['heatindex']['heatindex_f'] - 32) / 1.8); } + + /* + * Compute the humidity index + */ + if (!empty($decoded_metar['rel_humidity'])) { + $e = (6.112 * pow(10, 7.5 * $decoded_metar['temperature']['temp_c'] + / (237.7 + $decoded_metar['temperature']['temp_c'])) + * $decoded_metar['rel_humidity'] / 100) - 10; + $decoded_metar['humidex']['humidex_c'] = + number_format($decoded_metar['temperature']['temp_c'] + 5/9 * $e, 1); + $decoded_metar['humidex']['humidex_f'] = + number_format($decoded_metar['humidex']['humidex_c'] * 9/5 + 32, 1); + } + /* Finally we store our decoded METAR in $this->decoded_metar so * that other methods can use it. |