cvs: pear /Services_Weather/Weather Metar.php
| From: | Alexander Wirtz | Date: | Thu, 16 Mar 2006 21:06:06 +0000 |
| Subject: | cvs: pear /Services_Weather/Weather Metar.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-39135@lists.php.net to get a copy of this message | ||
eru Thu Mar 16 21:06:06 2006 UTC
Modified files:
/pear/Services_Weather/Weather Metar.php
Log:
o Changed parsing of forecast FMCs to prevent errors from multiple BECMGs and TEMPOs
http://cvs.php.net/viewcvs.cgi/pear/Services_Weather/Weather/Metar.php?r1=1.97&r2=1.98&diff_format=u
Index: pear/Services_Weather/Weather/Metar.php
diff -u pear/Services_Weather/Weather/Metar.php:1.97 pear/Services_Weather/Weather/Metar.php:1.98
--- pear/Services_Weather/Weather/Metar.php:1.97 Thu Mar 16 17:08:28 2006
+++ pear/Services_Weather/Weather/Metar.php Thu Mar 16 21:06:06 2006
@@ -40,7 +40,7 @@
* @author Alexander Wirtz <alex@pc4p.net>
* @copyright 2005-2006 Alexander Wirtz
* @license http://www.opensource.org/licenses/bsd-license.php
BSD License
- * @version CVS: $Id: Metar.php,v 1.97 2006/03/16 17:08:28 eru Exp $
+ * @version CVS: $Id: Metar.php,v 1.98 2006/03/16 21:06:06 eru Exp $
* @link http://pear.php.net/package/Services_Weather
* @link http://weather.noaa.gov/weather/metar.shtml
* @link http://weather.noaa.gov/weather/taf.shtml
@@ -1286,7 +1286,7 @@
break;
case "fmc";
// Test, if this is a probability for the next FMC
- if (preg_match("/^BECMG|TEMPO$/i", $taf[$i + 1], $lresult)) {
+ if (isset($result[2]) &&
preg_match("/^BECMG|TEMPO$/i", $taf[$i + 1], $lresult)) {
// Set type to BECMG or TEMPO
$type = $lresult[0];
// Set probability
@@ -1316,11 +1316,9 @@
// Same as above, we have a time for this FMC from our TAF,
// increase field-counter
$i += 1;
- } else {
+ } elseif (isset($result[2])) {
// This is either a PROBdd or a malformed TAF with missing
timegroup
- if (isset($result[2])) {
- $probability = $result[2];
- }
+ $probability = $result[2];
}
// Handle the FMC, generate neccessary array if it's the first...