Update of /cvsroot/phpweather/phpweather
In directory sc8-pr-cvs1:/tmp/cvs-serv13726
Modified Files:
phpweather.php
Log Message:
Fixed decoded of UK temperature parts with missing dew-point, thanks
to the report and explanation given by Tom McDonald and Nick B.
Index: phpweather.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/phpweather.php,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- phpweather.php 2 Sep 2002 18:17:47 -0000 1.32
+++ phpweather.php 14 Jun 2003 23:34:59 -0000 1.33
@@ -439,7 +439,7 @@
}
$decoded_metar['clouds'][] = $group;
- } elseif (ereg('^(M?[0-9]{2})/(M?[0-9]{2})?$', $part, $regs)) {
+ } elseif (ereg('^(M?[0-9]{2})/(M?[0-9]{2}|//)?$', $part, $regs)) {
/*
* Temperature/Dew Point Group.
*/
@@ -447,7 +447,11 @@
round(strtr($regs[1], 'M', '-'));
$decoded_metar['temperature']['temp_f'] =
round(strtr($regs[1], 'M', '-') * (9/5) + 32);
- if (!empty($regs[2])) {
+
+ /* The dewpoint could be missing, this is indicated by the
+ * second group being empty at most places, but in the UK they
+ * use '//' instead of the missing temperature... */
+ if (!empty($regs[2]) && $regs[2] != '//') {
$decoded_metar['temperature']['dew_c'] =
round(strtr($regs[2], 'M', '-'));
$decoded_metar['temperature']['dew_f'] =
|