cvs: pear /Services_Weather/Weather Metar.php
| From: | Alexander Wirtz | Date: | Fri, 09 Jul 2004 23:41:25 +0000 |
| Subject: | cvs: pear /Services_Weather/Weather Metar.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-21692@lists.php.net to get a copy of this message | ||
eru Fri Jul 9 19:41:25 2004 EDT
Modified files:
/pear/Services_Weather/Weather Metar.php
Log:
o Added validRaw to $forecast
o Changed handling of type, probability and from/to in fmc (forecast)
http://cvs.php.net/diff.php/pear/Services_Weather/Weather/Metar.php?r1=1.60&r2=1.61&ty=u
Index: pear/Services_Weather/Weather/Metar.php
diff -u pear/Services_Weather/Weather/Metar.php:1.60 pear/Services_Weather/Weather/Metar.php:1.61
--- pear/Services_Weather/Weather/Metar.php:1.60 Fri Jul 9 12:10:15 2004
+++ pear/Services_Weather/Weather/Metar.php Fri Jul 9 19:41:25 2004
@@ -16,7 +16,7 @@
// | Authors: Alexander Wirtz <alex@pc4p.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Metar.php,v 1.60 2004/07/09 16:10:15 eru Exp $
+// $Id: Metar.php,v 1.61 2004/07/09 23:41:25 eru Exp $
/**
* @package Services_Weather
@@ -888,6 +888,7 @@
unset($tafCode["station"]);
break;
case "valid":
+ $pointer["validRaw"] = $result[0];
// Generates the timeperiod the report is valid for
list($year, $month, $day) = explode("-",
date("Y-m-d", $forecastData["update"]));
// Date is in next month
@@ -1037,14 +1038,20 @@
// increase field-counter
$i++;
}
+ } else {
+ $type = $result[1];
+ if (isset($result[2]) && is_numeric($result[2])) {
+ $probability = $result[2];
+ }
}
if (preg_match("/^(\d{2})(\d{2})$/i", $taf[$i + 1],
$lresult)) {
$from = $lresult[1].":00";
$to = $lresult[2].":00";
- // Same as above?, we have a time for this FMC from our TAF,
+ // Same as above, we have a time for this FMC from our TAF,
// increase field-counter
$i++;
}
+
// Handle the FMC, generate neccessary array if it's the
first...
if
(!isset($forecastData["time"][$fromTime]["fmc"])) {
$forecastData["time"][$fromTime]["fmc"] =
array();
@@ -1055,18 +1062,14 @@
$fmcCount++;
// Insert data
- if (isset($type)) {
- $pointer["type"] = $type;
- } else {
- $pointer["type"] = $result[1];
- }
+ $pointer["type"] = $type;
if (isset($probability)) {
$pointer["probability"] = $probability;
- } elseif (isset($result[2]) && is_numeric($result[2])) {
- $pointer["probability"] = $result[2];
}
- $pointer["from"] = $from;
- $pointer["to"] = $to;
+ if (isset($from)) {
+ $pointer["from"] = $from;
+ $pointer["to"] = $to;
+ }
break;
default:
// Do nothing