[Phphtmllib-devel] SF.net SVN: phphtmllib:[3496] trunk/open2300/lib/modules/api/ AviationWeather.in
Status: Beta
Brought to you by:
hemna
From: <he...@us...> - 2010-06-17 18:38:51
|
Revision: 3496 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3496&view=rev Author: hemna Date: 2010-06-17 18:38:45 +0000 (Thu, 17 Jun 2010) Log Message: ----------- cleaned up some vars in the metar parsing Modified Paths: -------------- trunk/open2300/lib/modules/api/AviationWeather.inc Modified: trunk/open2300/lib/modules/api/AviationWeather.inc =================================================================== --- trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-17 18:26:25 UTC (rev 3495) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-17 18:38:45 UTC (rev 3496) @@ -333,7 +333,7 @@ } else { $unit = ' miles'; } - $wxInfo['VISIBILITY'] = $prefix . $integerMile . $part . $unit; + $wxInfo['Visibility'] = $prefix . $integerMile . $part . $unit; $metarPtr++; $group++; @@ -346,14 +346,14 @@ if ($distance > 5) $distance = round($distance); if ($distance <= 1) $unit = ' mile'; else $unit = ' miles'; - $wxInfo['VISIBILITY'] = $distance . $unit; + $wxInfo['Visibility'] = $distance . $unit; $metarPtr++; $group++; } else if ($part == 'CAVOK') { // good weather - $wxInfo['VISIBILITY'] = 'greater than 7 miles'; // or 10 km - $wxInfo['CONDITIONS'] = ''; - $wxInfo['CLOUDS'] = 'clear skies'; + $wxInfo['Visibility'] = 'greater than 7 miles'; // or 10 km + $wxInfo['Conditions'] = ''; + $wxInfo['Clouds'] = 'clear skies'; $metarPtr++; $group += 4; // can skip the next 3 groups @@ -428,11 +428,11 @@ $conditions .= $wxCode[$code] . ' '; $part = substr($part,2); } - $wxInfo['CONDITIONS'] = $conditions; + $wxInfo['Conditions'] = $conditions; $metarPtr++; } else { - $wxInfo['CONDITIONS'] = $conditions; + $wxInfo['Conditions'] = $conditions; $group++; } } @@ -452,7 +452,7 @@ 'OVC' => 'overcast', 'VV' => 'vertical visibility'); if ($part == 'SKC' || $part == 'CLR') { - $wxInfo['CLOUDS'] = $cloudCode[$part]; + $wxInfo['Clouds'] = $cloudCode[$part]; $metarPtr++; $group++; } @@ -461,7 +461,7 @@ $wxInfo['CLOUDS'] = $cloudCode[$pieces[1]]; if ($pieces[1] == 'VV') { $altitude = (integer) 100 * $pieces[2]; // units are feet - $wxInfo['CLOUDS'] .= " to $altitude ft"; + $wxInfo['Clouds'] .= " to $altitude ft"; } $metarPtr++; } @@ -479,7 +479,7 @@ $hiF += -0.00000199 * pow($tempF, 2) * pow($rh, 2); $hiF = round($hiF); $hiC = round(($hiF - 32) / 1.8); - $wxInfo['HEAT INDEX'] = "$hiF°F ($hiC°C)"; + $wxInfo['HeatIndex'] = "$hiF°F ($hiC°C)"; } } @@ -493,7 +493,7 @@ $chillF = 35.74 + 0.6215 * $tempF - 35.75 * pow($windspeed, 0.16) + 0.4275 * $tempF * pow($windspeed, 0.16); $chillF = round($chillF); $chillC = round(($chillF - 32) / 1.8); - $wxInfo['WIND CHILL'] = "$chillF°F ($chillC°C)"; + $wxInfo['WindChill'] = "$chillF°F ($chillC°C)"; } } } @@ -510,14 +510,18 @@ if (preg_match('/^(M?[0-9]{2})\/(M?[0-9]{2}|[X]{2})?$/',$part,$pieces)) { $tempC = (integer) strtr($pieces[1], 'M', '-'); $tempF = round(1.8 * $tempC + 32); - $wxInfo['TEMP'] = "$tempF°F ($tempC°C)"; + $wxInfo['Temperature'] = "$tempF°F ($tempC°C)"; + $wxInfo['TempC'] = $tempC; + $wxInfo['TempF'] = $tempF; $this->get_wind_chill($tempF, $wxInfo); if (strlen($pieces[2]) != 0 && $pieces[2] != 'XX') { $dewC = (integer) strtr($pieces[2], 'M', '-'); $dewF = round(1.8 * $dewC + 32); - $wxInfo['DEWPT'] = "$dewF°F ($dewC°C)"; + $wxInfo['Dewpoint'] = "$dewF°F ($dewC°C)"; + $wxInfo['DewpointC'] = $dewC; + $wxInfo['DewpointF'] = $dewF; $rh = round(100 * pow((112 - (0.1 * $tempC) + $dewC) / (112 + (0.9 * $tempC)), 8)); - $wxInfo['HUMIDITY'] = $rh . '%'; + $wxInfo['Humidity'] = $rh . '%'; $this->get_heat_index($tempF, $rh, $wxInfo); } $metarPtr++; @@ -547,7 +551,9 @@ $pressureHPA = (integer) $pieces[2]; // units are hectoPascals $pressureIN = round(0.02953 * $pressureHPA,2); // convert to inches Hg } - $wxInfo['BAROMETER'] = "$pressureHPA hPa ($pressureIN in Hg)"; + $wxInfo['Barometer'] = "$pressureHPA hPa ($pressureIN in Hg)"; + $wxInfo['BaroHg'] = $pressureIN; + $wxInfo['BaroHPA'] = $pressureHPA; $metarPtr++; $group++; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |