cvs: pear /Services_Weather/Weather Metar.php

From: Date: Tue, 08 Nov 2005 10:50:20 +0000
Subject: cvs: pear /Services_Weather/Weather Metar.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-36150@lists.php.net to get a copy of this message
eru Tue Nov 8 05:50:20 2005 EDT Modified files: /pear/Services_Weather/Weather Metar.php Log: o Added parsing of australian FM notation in TAF http://cvs.php.net/diff.php/pear/Services_Weather/Weather/Metar.php?r1=1.71&r2=1.72&ty=u Index: pear/Services_Weather/Weather/Metar.php diff -u pear/Services_Weather/Weather/Metar.php:1.71 pear/Services_Weather/Weather/Metar.php:1.72 --- pear/Services_Weather/Weather/Metar.php:1.71 Thu Oct 13 06:09:44 2005 +++ pear/Services_Weather/Weather/Metar.php Tue Nov 8 05:50:12 2005 @@ -16,7 +16,7 @@ // | Authors: Alexander Wirtz <alex@pc4p.net> | // +----------------------------------------------------------------------+ // -// $Id: Metar.php,v 1.71 2005/10/13 10:09:44 eru Exp $ +// $Id: Metar.php,v 1.72 2005/11/08 10:50:12 eru Exp $ /** * @package Services_Weather @@ -860,7 +860,7 @@ "tempmax" => "TX(\d{2})\/(\d{2})(\w)", "tempmin" => "TN(\d{2})\/(\d{2})(\w)", "tempmaxmin" => "TX(\d{2})\/(\d{2})(\w)TN(\d{2})\/(\d{2})(\w)", - "from" => "FM(\d{2})(\d{2})", + "from" => "FM(\d{2})(\d{2})?", "fmc" => "(PROB|BECMG|TEMPO)(\d{2})?" ); @@ -1079,7 +1079,13 @@ case "from": // Next timeperiod is coming up, prepare array and // set pointer accordingly - $fromTime = $result[1].":".$result[2]; + if (sizeof($result) > 2) { + // The ICAO way + $fromTime = $result[1].":".$result[2]; + } else { + // The Australian way (Hey mates!) + $fromTime = $result[1].":00"; + } $forecastData["time"][$fromTime] = array(); $fmcCount = 0; $pointer =& $forecastData["time"][$fromTime];

« previous php.pear.cvs (#36150) next »