Update of /cvsroot/phpweather/phpweather
In directory usw-pr-cvs1:/tmp/cvs-serv13725
Modified Files:
metar_parser.php
Log Message:
I've updated the code that produces the weather-string, so that it's
more correct now. It probably still needs some testing.
Index: metar_parser.php
===================================================================
RCS file: /cvsroot/phpweather/phpweather/metar_parser.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- metar_parser.php 2001/05/20 13:07:16 1.6
+++ metar_parser.php 2001/06/28 11:44:01 1.7
@@ -317,21 +317,24 @@
$decoded_metar['runway_group' . $runway_groups]['meter'] = $regs[4] * 1;
$decoded_metar['runway_group' . $runway_groups]['ft'] = round($regs[4] *
3.28084);
}
- } elseif
(ereg('^(-|\+|VC)?(BC|BL|DR|FZ|MI|PR|SH|TS)?((BR|DS|DU|FC|FG|FU|HZ|PO|SA|SQ|SS|VA|DZ|GR|GS|IC|PL|RA|SG|SN|PL|UP|PY)+)$',
$part, $regs)) {
+ } elseif (ereg('^(VC)?' . /* Proximity */
+ '(-|\+)?' . /* Intensity */
+ '(MI|PR|BC|DR|BL|SH|TS|FZ)?' . /* Descriptor */
+ '((DZ|RA|SN|SG|IC|PE|GR|GS|UP)+)?' . /* Precipitation */
+ '(BR|FG|FU|VA|DU|SA|HZ|PY)?' . /* Obscuration */
+ '(PO|SQ|FC|SS)?$', /* Other */
+ $part, $regs)) {
/*
* Current weather-group
*/
$weather_groups++;
- $decoded_metar['weather_group'.$weather_groups]['intensity'] = $regs[1];
- $decoded_metar['weather_group'.$weather_groups]['prefix'] = $regs[2];
- if (strlen($regs[3]) > 2) {
-
ereg('^(BR|DS|DU|FC|FG|FU|HZ|PO|SA|SQ|SS|VA|DZ|GR|GS|IC|PL|RA|SG|SN|PL|UP|PY)?(BR|DS|DU|FC|FG|FU|HZ|PO|SA|SQ|SS|VA|DZ|GR|GS|IC|PL|RA|SG|SN|PL|UP|PY)$',
$regs[3], $mprecip_type);
- $decoded_metar['weather_group'.$weather_groups]['weather'] =
$mprecip_type[1];
- $decoded_metar['weather_group'.$weather_groups]['weather2'] =
$mprecip_type[2];
- }
- else {
- $decoded_metar['weather_group'.$weather_groups]['weather'] = $regs[3];
- }
+ $decoded_metar['weather_group'.$weather_groups]['proximity'] = $regs[1];
+ $decoded_metar['weather_group'.$weather_groups]['intensity'] = $regs[2];
+ $decoded_metar['weather_group'.$weather_groups]['descriptor'] = $regs[3];
+ $decoded_metar['weather_group'.$weather_groups]['precipitation'] = $regs[4];
+ $decoded_metar['weather_group'.$weather_groups]['obscuration'] = $regs[6];
+ $decoded_metar['weather_group'.$weather_groups]['other'] = $regs[7];
+
} elseif ($part == 'SKC' || $part == 'CLR') {
/*
* Cloudr-group.
_______________________________________________
PHPWeather-checkins mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/phpweather-checkins