Thread: [Phphtmllib-devel] SF.net SVN: phphtmllib:[3500] trunk/open2300/lib/modules/api/ AviationWeather.in (Page 2)
Status: Beta
Brought to you by:
hemna
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3500]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-06-17 19:32:00
|
Revision: 3500 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3500&view=rev Author: hemna Date: 2010-06-17 19:31:54 +0000 (Thu, 17 Jun 2010) Log Message: ----------- Age 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 19:13:01 UTC (rev 3499) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-17 19:31:54 UTC (rev 3500) @@ -193,7 +193,7 @@ $now = time(); $wxInfo['Now'] = date('D M j, H:i T',$now); $timeDiff = floor(($now - $local) / 60); - if ($timeDiff < 91) $wxInfo['AGE'] = "$timeDiff min ago"; + if ($timeDiff < 91) $wxInfo['Age'] = "$timeDiff min ago"; else { $min = $timeDiff % 60; if ($min < 10) $min = '0' . $min; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3501]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-06-17 19:38:00
|
Revision: 3501 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3501&view=rev Author: hemna Date: 2010-06-17 19:37:54 +0000 (Thu, 17 Jun 2010) Log Message: ----------- clouds 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 19:31:54 UTC (rev 3500) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-17 19:37:54 UTC (rev 3501) @@ -465,7 +465,7 @@ } else { if (preg_match('/^([A-Z]{2,3})([0-9]{3})/',$part,$pieces)) { // codes for CB and TCU are ignored - $wxInfo['CLOUDS'] = $cloudCode[$pieces[1]]; + $wxInfo['Clouds'] = $cloudCode[$pieces[1]]; if ($pieces[1] == 'VV') { $altitude = (integer) 100 * $pieces[2]; // units are feet $wxInfo['Clouds'] .= " to $altitude ft"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3505]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-06-17 21:30:18
|
Revision: 3505 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3505&view=rev Author: hemna Date: 2010-06-17 21:30:11 +0000 (Thu, 17 Jun 2010) Log Message: ----------- move caching 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 20:51:49 UTC (rev 3504) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-17 21:30:11 UTC (rev 3505) @@ -54,6 +54,13 @@ public function process_airport($icao) { + $cache_key = "METAR_".$icao; + $info = $this->cache->get($cache_key); + if ($info) { + $wxInfo = $info; + return $wxInfo; + } + $wxInfo = array("icao" => strtoupper($icao)); $metar = $this->get_metar($icao, $wxInfo); @@ -79,7 +86,8 @@ //$this->metars[] = $wxInfo; //need to combine this info w/ the airport data cache. } - + + $this->cache->set($cache_key, $wxInfo, AviationWeather::METAR_CACHE_TIMEOUT); return $wxInfo; } @@ -144,14 +152,6 @@ public function get_metar($station, &$wxInfo) { - $cache_key = "METAR_".$station; - - $info = $this->cache->get($cache_key); - if ($info) { - $wxInfo = $info; - $metar = $wxInfo["metar"]; - return $metar; - } // This function retrieves METAR information for a given station from the // National Weather Service. It assumes that the station exists. // A slower URL is "ftp://weather.noaa.gov/data/observations/metar/stations/$station.TXT" @@ -179,7 +179,6 @@ $wxInfo["metar"] = $metar; - $this->cache->set($cache_key, $wxInfo, AviationWeather::METAR_CACHE_TIMEOUT); return $metar; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3508]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-06-17 22:37:26
|
Revision: 3508 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3508&view=rev Author: hemna Date: 2010-06-17 22:37:20 +0000 (Thu, 17 Jun 2010) Log Message: ----------- moved temp 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 22:34:29 UTC (rev 3507) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-17 22:37:20 UTC (rev 3508) @@ -192,11 +192,11 @@ $now = time(); $wxInfo['Now'] = date('D M j, H:i T',$now); $timeDiff = floor(($now - $local) / 60); - if ($timeDiff < 91) $wxInfo['Age'] = "$timeDiff min ago"; + if ($timeDiff < 91) $wxInfo['Age'] = "$timeDiff min"; else { $min = $timeDiff % 60; if ($min < 10) $min = '0' . $min; - $wxInfo['Age'] = floor($timeDiff / 60) . ":$min hr ago"; + $wxInfo['Age'] = floor($timeDiff / 60) . ":$min hr"; } } @@ -465,10 +465,10 @@ else { if (preg_match('/^([A-Z]{2,3})([0-9]{3})/',$part,$pieces)) { // codes for CB and TCU are ignored $wxInfo['Clouds'] = $cloudCode[$pieces[1]]; - if ($pieces[1] == 'VV') { +// if ($pieces[1] == 'VV') { $altitude = (integer) 100 * $pieces[2]; // units are feet $wxInfo['Clouds'] .= " to $altitude ft"; - } +// } $metarPtr++; } else { @@ -485,7 +485,7 @@ $hiF += -0.00000199 * pow($tempF, 2) * pow($rh, 2); $hiF = round($hiF); $hiC = round(($hiF - 32) / 1.8); - $wxInfo['HeatIndex'] = "$hiF°F ($hiC°C)"; + $wxInfo['HeatIndex'] = "$hiC°C ($hiF°F)"; } } @@ -499,7 +499,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['WindChill'] = "$chillF°F ($chillC°C)"; + $wxInfo['WindChill'] = "$chillC°C ($chillF°F)"; } } } @@ -516,14 +516,14 @@ 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['Temperature'] = "$tempF°F ($tempC°C)"; + $wxInfo['Temperature'] = "$tempC°C ($tempF°F)"; $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['Dewpoint'] = "$dewF°F ($dewC°C)"; + $wxInfo['Dewpoint'] = "$dewC°C ($dewF°F)"; $wxInfo['DewpointC'] = $dewC; $wxInfo['DewpointF'] = $dewF; $rh = round(100 * pow((112 - (0.1 * $tempC) + $dewC) / (112 + (0.9 * $tempC)), 8)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3509]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-06-17 22:53:49
|
Revision: 3509 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3509&view=rev Author: hemna Date: 2010-06-17 22:53:43 +0000 (Thu, 17 Jun 2010) Log Message: ----------- at 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 22:37:20 UTC (rev 3508) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-17 22:53:43 UTC (rev 3509) @@ -56,14 +56,13 @@ $cache_key = "METAR_".$icao; $info = $this->cache->get($cache_key); - if ($info) { + if ($info && false) { $wxInfo = $info; return $wxInfo; } $wxInfo = array("icao" => strtoupper($icao)); $metar = $this->get_metar($icao, $wxInfo); - if ($metar != null && strlen($metar) > 0) { $this->process_metar($metar, $wxInfo); $wxInfo["metar"] = $metar; @@ -467,7 +466,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'] .= " at $altitude ft"; // } $metarPtr++; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3513]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-06-18 03:45:28
|
Revision: 3513 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3513&view=rev Author: hemna Date: 2010-06-18 03:45:21 +0000 (Fri, 18 Jun 2010) Log Message: ----------- pressure altitude 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-18 02:10:33 UTC (rev 3512) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-18 03:45:21 UTC (rev 3513) @@ -66,6 +66,7 @@ if ($metar != null && strlen($metar) > 0) { $this->process_metar($metar, $wxInfo); $wxInfo["metar"] = $metar; + $airport = $this->cache->get($icao); if ($airport != null) { @@ -81,6 +82,9 @@ $this->cache->set($icao,$airport); } } + + //now do Pressure Altitude and Density Altitude + $wxInfo["PressureAltitude"] = $this->pressure_altitude($wxInfo["BaroHPA"], $wxInfo["altitude"]); } //$this->metars[] = $wxInfo; //need to combine this info w/ the airport data cache. @@ -619,6 +623,31 @@ $offset = $origin_dtz->getOffset($origin_dt) - $remote_dtz->getOffset($remote_dt); return $offset/3600; } + + + protected function pressure_altitude($pressure, $altitude) { + // Pressure Altitude + // Palt = ( 1 - (P / 1013.25) ^ .190284) * 145366.45 + + $Pst = 1013.25; + $Pexp = .190284; + $fn = 145366.45; + + $tmp1 = $pressure/$Pst; + $tmp2 = pow($tmp1, $Pexp); + + $Pa = $fn * (1 - pow(($pressure/$Pst) , $Pexp)); + + return round($Pa + $altitude,1); + } + + + protected function density_altitude() { + + } + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3518]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-06-26 00:18:05
|
Revision: 3518 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3518&view=rev Author: hemna Date: 2010-06-26 00:17:58 +0000 (Sat, 26 Jun 2010) Log Message: ----------- stuff 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-21 21:16:01 UTC (rev 3517) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-26 00:17:58 UTC (rev 3518) @@ -53,22 +53,24 @@ public function process_airport($icao) { - + $icao = strtoupper($icao); + $cache_key = "METAR_".$icao; $info = $this->cache->get($cache_key); - if ($info && false) { + if ($info) { $wxInfo = $info; return $wxInfo; } - $wxInfo = array("icao" => strtoupper($icao)); + $airport = $this->cache->get($icao); + + $wxInfo = array("icao" => $icao); $metar = $this->get_metar($icao, $wxInfo); if ($metar != null && strlen($metar) > 0) { $this->process_metar($metar, $wxInfo); $wxInfo["metar"] = $metar; - $airport = $this->cache->get($icao); if ($airport != null) { $wxInfo["runways"] = $this->get_runways($airport, $wxInfo); $wxInfo["altitude"] = $airport["elevation"]; @@ -86,6 +88,32 @@ //now do Pressure Altitude and Density Altitude $wxInfo["PressureAltitude"] = $this->pressure_altitude($wxInfo["BaroHPA"], $wxInfo["altitude"]); } + + if (is_null($wxInfo["images"]) || !isset($wxInfo["images"])) { + $images = $this->do_images($icao); + if ($images) { + $wxInfo["images"] = $images; + } + } + + if (!isset($airport["taf"]) || $airport["taf"] == 1) { + $taf = $this->get_taf($icao); + + if (is_null($taf)) { + //if we couldn't find the TAF + //no reason to try again. + //not many airports have taf reports + $airport["taf"] = 0; + } else { + $airport["taf"] = 1; + $wxInfo["taf"] = $taf; + } + + //we changed settings, save them to the cache. + $this->cache->set($icao,$airport); + } + + //$this->metars[] = $wxInfo; //need to combine this info w/ the airport data cache. } @@ -185,6 +213,39 @@ return $metar; } + public function get_taf($station) { + + // This function retrieves TAF information for a given station from the + // National Weather Service. It assumes that the station exists. + // A slower URL is "ftp://weather.noaa.gov/data/forecasts/taf/stations/$station.TXT" + $fileName = "http://weather.noaa.gov/pub/data/forecasts/taf/stations/$station.TXT"; + $taf = ''; + + + $proxy = $GLOBALS["config"]->get("proxy"); + if (!empty($proxy)) { + $context = stream_context_create(array("http" => array("proxy" => "tcp://".$proxy))); + } else { + $context = null; + } + + $fileData = @file($fileName, 0, $context); // or die('Data not available'); + if ($fileData != false) { + list($i, $date) = each($fileData); + $utc = strtotime(trim($date)); + $this->set_time_data($utc,$wxInfo); + while (list($i, $line) = each($fileData)) { + //$taf .= ' ' . trim($line); + $taf .= ' ' . $line; + } + $taf = trim(str_replace(' ', ' ', $taf)); + return $taf; + } else { + return null; + } + + } + protected function set_time_data($utc, &$wxInfo) { // This function formats observation time in the local time zone of server, the // current local time on server, and time difference since observation. $utc is a @@ -649,7 +710,90 @@ - + protected function do_images($icao) { + $airport_images = array(); + $airportdiagram = ""; + + //first lets see if we can find some airport images. + $flyagogo_url = 'http://flyagogo.net/uploads/'; + + for ($x=1; $x<=3; $x++) { + $result = $this->http_head_curl($flyagogo_url.$icao."/".$x.".jpg"); + if ($result !== false && $result["http_code"] == 200) { + $airport_images[] = $result["url"]; + } else { + //if n doesn't work then n+1 won't either + break; + } + } + + //lets see if we can snag an airport diagram + $page = $this->http_get_curl("http://airnav.com/airport/".$icao); + if ($page !== false) { + //first snag the airport image itself. + $str = strstr($page,"http://img.airnav.com/ap/"); + if ($str) { + $image_url = substr($str,0,strpos($str, '"')); + $airport_images[] = $image_url; + } + + + //now the airport diagram. + $str = strstr($page,"http://img.airnav.com/aptdiag"); + if ($str) { + $airportdiagram = substr($str,0,strpos($str, '"')); + } + } + + + $images = array("images" => $airport_images, "diagram" => $airportdiagram); + return $images; + } + + /** + * @return boolean false on error, content otherwise + * @param string $url + * @desc makes a HEAD request using cURL + * @author Svetoslav Marinov + * @link http://devquickref.com/ + */ + function http_head_curl($url) { + if (!extension_loaded('curl_init') || !function_exists('curl_init')) { + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 30s + curl_setopt($ch, CURLOPT_HEADER, 1); + curl_setopt($ch, CURLOPT_NOBODY, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + $result = curl_exec($ch); + $info = curl_getinfo($ch); + curl_close($ch); + return $info; + } + return false; + } + + + function http_get_curl($url) { + if (!extension_loaded('curl_init') || !function_exists('curl_init')) { + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 30s + curl_setopt($ch, CURLOPT_HEADER, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $result = curl_exec($ch); + $info = curl_getinfo($ch); + curl_close($ch); + if ($info["http_code"] == 200) { + return $result; + } else { + return false; + } + } + return false; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3519]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-06-28 22:37:53
|
Revision: 3519 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3519&view=rev Author: hemna Date: 2010-06-28 22:37:47 +0000 (Mon, 28 Jun 2010) Log Message: ----------- added density altitude 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-26 00:17:58 UTC (rev 3518) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-28 22:37:47 UTC (rev 3519) @@ -703,8 +703,33 @@ } - protected function density_altitude() { + /** + * + * @param unknown_type $altitude -- airport altitude + * @param unknown_type $Pmb -- pressure in millibars + * * @param unknown_type $PinHg -- pressure in inches of Mercury + * @param unknown_type $temp -- degress Celcius + * @param unknown_type $dewpoint -- degress Celcius + * @return unknown_type + * + * @link http://www.4wx.com/wxcalc/formulas/densityAltitude.php + */ + protected function density_altitude($altitude, $Pmb, $PinHg, $tempC, $dewC) { + + //get vapor pressure ($Vp) + $Vpexp = (7.5*$dewC) / (237.7+$dewC); + $Vp = 6.11*pow(10, $Vpexp); + //get virtual Temp $Tv (in Kelvin) + $TvK = ($tempC / (1-($Vp / $Pmb) * (1-0.622))); + + //convert temp to Rankine + $TvR = (9/5) * ($TvK + 764.84); + + //get density altitude + $Ad = 145366 * ( 1 - pow( ((17.326*$PinHG) / $TvR), 0.235) ); + + return $Ad; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3520]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-06-28 22:40:49
|
Revision: 3520 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3520&view=rev Author: hemna Date: 2010-06-28 22:40:43 +0000 (Mon, 28 Jun 2010) Log Message: ----------- added call to density a 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-28 22:37:47 UTC (rev 3519) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-28 22:40:43 UTC (rev 3520) @@ -87,6 +87,8 @@ //now do Pressure Altitude and Density Altitude $wxInfo["PressureAltitude"] = $this->pressure_altitude($wxInfo["BaroHPA"], $wxInfo["altitude"]); + $wxInfo["DensityAltitude"] = $this->density_altitude($wxInfo["altitude"], $wxInfo["BaroHPA"], + $wxInfo["BaroHg"], $wxInfo["TempC"], $wxInfo["DewpointC"]); } if (is_null($wxInfo["images"]) || !isset($wxInfo["images"])) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3521]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-06-28 23:20:47
|
Revision: 3521 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3521&view=rev Author: hemna Date: 2010-06-28 23:20:40 +0000 (Mon, 28 Jun 2010) Log Message: ----------- hacks 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-28 22:40:43 UTC (rev 3520) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-28 23:20:40 UTC (rev 3521) @@ -717,10 +717,10 @@ * @link http://www.4wx.com/wxcalc/formulas/densityAltitude.php */ protected function density_altitude($altitude, $Pmb, $PinHg, $tempC, $dewC) { + $this->e_calc($altitude, $Pmb, $PinHg, $tempC, $dewC); //get vapor pressure ($Vp) - $Vpexp = (7.5*$dewC) / (237.7+$dewC); - $Vp = 6.11*pow(10, $Vpexp); + $Vp = $this->vapor_pressure($dewC); //get virtual Temp $Tv (in Kelvin) $TvK = ($tempC / (1-($Vp / $Pmb) * (1-0.622))); @@ -733,9 +733,164 @@ return $Ad; } + + + private function vapr_pressure($dewC) { + $Vpexp = (7.5*$dewC) / (237.7+$dewC); + $Vp = 6.11*pow(10, $Vpexp); + return $Vp; + } + // Calculate absolute air pressure given the barometric pressure(mb) and altitude(meters) + private function calcAbsPress($Pmb, $altM) { + $k1 = 0.190284; + $k2 = 8.4288*Math.pow(10,-5); + $p1 = pow($Pmb,$k1); + $p2 = $altM*$k2; + $p3 = 0.3+pow( ($p1-$p2), (1/$k1) ); + return $p3; + } + + + // Calculate the air density in kg/m3 + private function calcDensity($absPmb, $e, $tc) { + $Rv=461.4964; + $Rd=287.0531; + + $tk = $tc + 273.15; + $pv = $e*100; + $pd = ($absPmb-$e)*100; + $d= ($pv/($Rv*$tk)) + ($pd/($Rd*$tk)); + return $d; + } + + // Calculate the ISA altitude (meters) for a given density (kg/m3) + private function calcAltitude($d) { + $g=9.80665; + $Po=101325; + $To=288.15; + $L=6.5; + $R=8.314320; + $M=28.9644; + $D=$d*1000; + $p2=( ($L*$R)/($g*$M-$L*$R) )*log( ($R*$To*$D)/($M*$Po) ); + + $H=-($To/$L)*( exp($p2)-1 ); + + $h = $H*1000; + + return $h; + } + + + + // Calculate the Z altitude (meters), given the H altitide (meters) + private function calcZ($h) { + $r=6369E3; + + return (($r*$h)/($r-$h)); + + } + + + // Calculate the H altitude (meters), given the Z altitide (meters) + private function calcH($z) { + $r=6369E3; + + return (($r*$z)/($r+$z)); + } + + + // Calculate the actual pressure (mb)from the altimeter setting (mb) and geopotential altitude (m) + private function calcAs2Press($As, $h) { + $k1=.190263; + $k2=8.417286E-5; + + $p=pow( (pow($As,$k1)-($k2*$h)),(1/$k1) ); + + return $p; + } + + + private function e_calc($altitude, $Pmb, $PinHg, $tempC, $dewC) { + + $in_per_mb = (1/33.86389); + $mb_per_in = 33.86389; + + $m_per_ft = 0.304800; + $ft_per_m = (1/.304800); + + + $zm = $altitude*$m_per_ft; + + + // Calculate the vapor pressures (mb) given the ambient temperature (c) and dewpoint (c) + + $esmb = $this->calcVaporPressure_wobus($tempC); + $emb = $this->calcVaporPressure_wobus($dewC); + + + // Calculate geopotential altitude H (m) from geometric altitude (m) Z + + $hm = $this->calcH($zm); + + + // Calculate the absolute pressure given the altimeter setting(mb) and geopotential elevation(meters) + + $actpressmb = $this->calcAs2Press($Pmb, $hm); + + + // Calculate the air density (kg/m3) from absolute pressure (mb) vapor pressure (mb) and temp (c) + + $density = $this->calcDensity($actpressmb, $emb, $tempC); + $relden = 100*($density/1.225); + + + // Calculate the geopotential altitude (m) in ISA with that same density (kg/m3) + + $densaltm = $this->calcAltitude($density); + + // Calculate geometric altitude Z (m) from geopotential altitude (m) H + + $densaltzm = $this->calcZ($densaltm); + + + // Convert Units for output + + $actpress = $actpressmb*$in_per_mb; + $densalt = $densaltzm*$ft_per_m; + + if ( $densalt > 36090 || $densalt < -15000 ) { + + var_dump ("Out of range for Troposhere Algorithm: Altitude =" . round($densalt,0) . " feet" ); + return; + } + + var_dump("Absolute Pressure ".round($actpress,3)); + var_dump("Density altitude ".round($densalt,0)); + var_dump("Relative Density ".round($relden,2)); + + } + + + + + + + + + + + + + + + + + + protected function do_images($icao) { $airport_images = array(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3522]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-06-28 23:21:59
|
Revision: 3522 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3522&view=rev Author: hemna Date: 2010-06-28 23:21:53 +0000 (Mon, 28 Jun 2010) Log Message: ----------- fixed 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-28 23:20:40 UTC (rev 3521) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-28 23:21:53 UTC (rev 3522) @@ -828,8 +828,8 @@ // Calculate the vapor pressures (mb) given the ambient temperature (c) and dewpoint (c) - $esmb = $this->calcVaporPressure_wobus($tempC); - $emb = $this->calcVaporPressure_wobus($dewC); + $esmb = $this->vapr_pressure($tempC); + $emb = $this->vapr_pressure($dewC); // Calculate geopotential altitude H (m) from geometric altitude (m) Z This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3523]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-06-28 23:22:44
|
Revision: 3523 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3523&view=rev Author: hemna Date: 2010-06-28 23:22:38 +0000 (Mon, 28 Jun 2010) Log Message: ----------- bleh 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-28 23:21:53 UTC (rev 3522) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-28 23:22:38 UTC (rev 3523) @@ -735,7 +735,7 @@ } - private function vapr_pressure($dewC) { + private function vapor_pressure($dewC) { $Vpexp = (7.5*$dewC) / (237.7+$dewC); $Vp = 6.11*pow(10, $Vpexp); return $Vp; @@ -828,8 +828,8 @@ // Calculate the vapor pressures (mb) given the ambient temperature (c) and dewpoint (c) - $esmb = $this->vapr_pressure($tempC); - $emb = $this->vapr_pressure($dewC); + $esmb = $this->vapor_pressure($tempC); + $emb = $this->vapor_pressure($dewC); // Calculate geopotential altitude H (m) from geometric altitude (m) Z This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3524]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-06-28 23:25:30
|
Revision: 3524 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3524&view=rev Author: hemna Date: 2010-06-28 23:25:24 +0000 (Mon, 28 Jun 2010) Log Message: ----------- new d_alt 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-28 23:22:38 UTC (rev 3523) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-28 23:25:24 UTC (rev 3524) @@ -705,34 +705,6 @@ } - /** - * - * @param unknown_type $altitude -- airport altitude - * @param unknown_type $Pmb -- pressure in millibars - * * @param unknown_type $PinHg -- pressure in inches of Mercury - * @param unknown_type $temp -- degress Celcius - * @param unknown_type $dewpoint -- degress Celcius - * @return unknown_type - * - * @link http://www.4wx.com/wxcalc/formulas/densityAltitude.php - */ - protected function density_altitude($altitude, $Pmb, $PinHg, $tempC, $dewC) { - $this->e_calc($altitude, $Pmb, $PinHg, $tempC, $dewC); - - //get vapor pressure ($Vp) - $Vp = $this->vapor_pressure($dewC); - - //get virtual Temp $Tv (in Kelvin) - $TvK = ($tempC / (1-($Vp / $Pmb) * (1-0.622))); - - //convert temp to Rankine - $TvR = (9/5) * ($TvK + 764.84); - - //get density altitude - $Ad = 145366 * ( 1 - pow( ((17.326*$PinHG) / $TvR), 0.235) ); - - return $Ad; - } private function vapor_pressure($dewC) { @@ -814,7 +786,7 @@ } - private function e_calc($altitude, $Pmb, $PinHg, $tempC, $dewC) { + private function density_altitude($altitude, $Pmb, $PinHg, $tempC, $dewC) { $in_per_mb = (1/33.86389); $mb_per_in = 33.86389; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3525]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-06-28 23:27:19
|
Revision: 3525 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3525&view=rev Author: hemna Date: 2010-06-28 23:27:13 +0000 (Mon, 28 Jun 2010) Log Message: ----------- return 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-28 23:25:24 UTC (rev 3524) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-28 23:27:13 UTC (rev 3525) @@ -839,10 +839,12 @@ var_dump ("Out of range for Troposhere Algorithm: Altitude =" . round($densalt,0) . " feet" ); return; } + + return round($densalt,0); - var_dump("Absolute Pressure ".round($actpress,3)); - var_dump("Density altitude ".round($densalt,0)); - var_dump("Relative Density ".round($relden,2)); +// var_dump("Absolute Pressure ".round($actpress,3)); +// var_dump("Density altitude ".round($densalt,0)); +// var_dump("Relative Density ".round($relden,2)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3526]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-06-30 22:51:01
|
Revision: 3526 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3526&view=rev Author: hemna Date: 2010-06-30 22:50:55 +0000 (Wed, 30 Jun 2010) Log Message: ----------- VFR conditions 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-28 23:27:13 UTC (rev 3525) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-06-30 22:50:55 UTC (rev 3526) @@ -57,7 +57,7 @@ $cache_key = "METAR_".$icao; $info = $this->cache->get($cache_key); - if ($info) { + if ($info && false) { $wxInfo = $info; return $wxInfo; } @@ -70,6 +70,7 @@ $this->process_metar($metar, $wxInfo); $wxInfo["metar"] = $metar; + $this->decide_vfr($wxInfo); if ($airport != null) { $wxInfo["runways"] = $this->get_runways($airport, $wxInfo); @@ -392,6 +393,7 @@ if (strlen($part) == 1) { // visibility is limited to a whole mile plus a fraction part $integerMile = $part . ' '; $metarPtr++; + $wxInfo["vis_distance"] = $integerMile; } else if (substr($part,-2) == 'SM') { // visibility is in miles $part = substr($part,0,strlen($part)-2); if (substr($part,0,1) == 'M') { @@ -408,6 +410,8 @@ $wxInfo['Visibility'] = $prefix . $integerMile . $part . $unit; $metarPtr++; $group++; + + $wxInfo["vis_distance"] = $integerMile.$part; } else if (substr($part,-2) == 'KM') { // unknown (Reported by NFFN in Fiji) $metarPtr++; @@ -421,6 +425,8 @@ $wxInfo['Visibility'] = $distance . $unit; $metarPtr++; $group++; + + $wxInfo["vis_distance"] = $distance; } else if ($part == 'CAVOK') { // good weather $wxInfo['Visibility'] = 'greater than 7 miles'; // or 10 km @@ -428,6 +434,9 @@ $wxInfo['Clouds'] = 'clear skies'; $metarPtr++; $group += 4; // can skip the next 3 groups + + //just need to mark this as > 5 + $wxInfo["vis_distance"] = 10; } else { $group++; @@ -525,6 +534,7 @@ 'VV' => 'vertical visibility'); if ($part == 'SKC' || $part == 'CLR') { $wxInfo['Clouds'] = $cloudCode[$part]; + $this->add_cloud_entry($part, $cloudCode[$part], "", $wxInfo); $metarPtr++; $group++; } @@ -535,6 +545,11 @@ $altitude = (integer) 100 * $pieces[2]; // units are feet $wxInfo['Clouds'] .= " at $altitude ft"; // } + $code = substr($part,0,2); + if ($code != "VV") { + $code = substr($part,0,3); + } + $this->add_cloud_entry($code, $clodeCode[$part], $altitude, $wxInfo); $metarPtr++; } else { @@ -542,6 +557,20 @@ } } } + + private function add_cloud_entry($code, $human, $altitude, &$wxInfo) { + $newEntry = array("code" => $code, "human" => $human, "altitude" => $altitude); + $wxInfo['CloudArr'][] = $newEntry; + if (!empty($altitude) && !isset($wxInfo['lowestClouds'])) { + $wxInfo['lowestClouds'] = $newEntry; + } else if (!empty($altitude)) { + if ($wxInfo['lowestClouds']['altitude'] > $altitude) { + $wxInfo['lowestClouds'] = $newEntry; + } + } + } + + protected function get_heat_index($tempF, $rh, &$wxInfo) { // Calculate Heat Index based on temperature in F and relative humidity (65 = 65%) if ($tempF > 79 && $rh > 39) { @@ -835,9 +864,8 @@ $densalt = $densaltzm*$ft_per_m; if ( $densalt > 36090 || $densalt < -15000 ) { - - var_dump ("Out of range for Troposhere Algorithm: Altitude =" . round($densalt,0) . " feet" ); - return; + Log::singleton()->err("AviationWeather::density_altitude($altitude, $Pmb, $PinHg, $tempC, $dewC) -- Out of range for Troposhere Algorithm: Altitude =" . round($densalt,0) . " feet" ); + return null; } return round($densalt,0); @@ -950,6 +978,64 @@ } return false; } + + + + /** + * decide what meteorological conditions + * the airport is in. + * + * @see http://aviationweather.gov/adds/metars/description_ifr.php + */ + function decide_vfr($wxInfo) { + //first lets try the easy approach. + //if we have > 5 miles visibility + if ($wxInfo["vis_distance"] >= 5) { + //clouds need to be > 3000 AGL + if ($wxInfo["lowestClouds"]["altitude"] >= 3000 || + ( $wxInfo["lowestClouds"]["altitude"] < 3000 && + ($wxInfo["lowestClouds"]["code"] == "CLR" || + $wxInfo["lowestClouds"]["code"] == "SKC" || + $wxInfo["lowestClouds"]["code"] == "FEW" || + $wxInfo["lowestClouds"]["code"] == "SCT")) + ) { + $wxInfo["SkyConditions"] = "VFR"; + } else { + $wxInfo["SkyConditions"] = "MVFR"; + } + + } else if ($wxInfo["vis_distance"] >=3) { + //clounds between 1000' and 3000' + if ($wxInfo["lowestClouds"]["altitude"] >= 1000 || + ( $wxInfo["lowestClouds"]["altitude"] < 1000 && + ( $wxInfo["lowestClouds"]["code"] == "CLR" || + $wxInfo["lowestClouds"]["code"] == "SKC" || + $wxInfo["lowestClouds"]["code"] == "FEW" || + $wxInfo["lowestClouds"]["code"] == "SCT")) + ) { + $wxInfo["SkyConditions"] = "MVFR"; + } else { + $wxInfo["SkyConditions"] = "IFR"; + } + + } else if ($wxInfo["vis_distance"] >=1) { + //clouds between 500' and 1000' + if ($wxInfo["lowestCloudes"]["altitude"] >= 500) { + $wxInfo["SkyConditions"] = "IFR"; + } else { + $wxInfo["SkyConditions"] = "LIFR"; + } + + + } else if ($wxInfo["vis_distance"] <1) { + //clouds < 500' + if ($wxInfo["lowestCloudes"]["altitude"] < 500) { + $wxInfo["SkyConditions"] = "LIFR"; + } else { + $wxInfo["SkyConditions"] = "IFR"; + } + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3528]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-07-09 23:25:40
|
Revision: 3528 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3528&view=rev Author: hemna Date: 2010-07-09 23:25:33 +0000 (Fri, 09 Jul 2010) Log Message: ----------- added loggin 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-07-08 19:35:12 UTC (rev 3527) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-07-09 23:25:33 UTC (rev 3528) @@ -19,21 +19,27 @@ //list of airports to fetch. protected $airports; + protected $airports_raw; protected $metars = array(); protected $timer = NULL; private $cache; + + private $log; public function init() { $airports = Request::singleton()->get("airports"); + $this->airports_raw = $airports; if (strlen($airports) >0) { $this->airports = explode(',', strtoupper($airports)); } $this->cache = AirportCache::singleton(); //$this->timer = new Timer(); + $this->log = new Log(); + $this->log->add_writer(FileLogWriter::factory(realpath($GLOBALS["path_base"])."/logs/aviation_weather.log")); } public function build_object() { @@ -43,6 +49,11 @@ foreach($this->airports as $icao) { //$this->timer->start(); $airport = $this->process_airport($icao); + if (!empty($airport) && !is_null($airport)) { + $this->log->info("request for ".$this->airports_raw." yes"); + } else { + $this->log->info("request for ".$this->airports_raw." no"); + } //echo "Time took ".$this->timer->get_elapsed()."<br>"; $this->metars[] = $airport; } @@ -69,7 +80,6 @@ if ($metar != null && strlen($metar) > 0) { $this->process_metar($metar, $wxInfo); $wxInfo["metar"] = $metar; - $this->decide_vfr($wxInfo); if ($airport != null) { @@ -561,7 +571,7 @@ private function add_cloud_entry($code, $human, $altitude, &$wxInfo) { $newEntry = array("code" => $code, "human" => $human, "altitude" => $altitude); $wxInfo['CloudArr'][] = $newEntry; - if (!empty($altitude) && !isset($wxInfo['lowestClouds'])) { + if (!isset($wxInfo['lowestClouds'])) { $wxInfo['lowestClouds'] = $newEntry; } else if (!empty($altitude)) { if ($wxInfo['lowestClouds']['altitude'] > $altitude) { @@ -987,7 +997,7 @@ * * @see http://aviationweather.gov/adds/metars/description_ifr.php */ - function decide_vfr($wxInfo) { + function decide_vfr(&$wxInfo) { //first lets try the easy approach. //if we have > 5 miles visibility if ($wxInfo["vis_distance"] >= 5) { @@ -1020,7 +1030,7 @@ } else if ($wxInfo["vis_distance"] >=1) { //clouds between 500' and 1000' - if ($wxInfo["lowestCloudes"]["altitude"] >= 500) { + if ($wxInfo["lowestClouds"]["altitude"] >= 500) { $wxInfo["SkyConditions"] = "IFR"; } else { $wxInfo["SkyConditions"] = "LIFR"; @@ -1029,7 +1039,7 @@ } else if ($wxInfo["vis_distance"] <1) { //clouds < 500' - if ($wxInfo["lowestCloudes"]["altitude"] < 500) { + if ($wxInfo["lowestClouds"]["altitude"] < 500) { $wxInfo["SkyConditions"] = "LIFR"; } else { $wxInfo["SkyConditions"] = "IFR"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3529]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-07-11 20:53:31
|
Revision: 3529 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3529&view=rev Author: hemna Date: 2010-07-11 20:53:24 +0000 (Sun, 11 Jul 2010) Log Message: ----------- make sure we use the cache now 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-07-09 23:25:33 UTC (rev 3528) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-07-11 20:53:24 UTC (rev 3529) @@ -68,7 +68,7 @@ $cache_key = "METAR_".$icao; $info = $this->cache->get($cache_key); - if ($info && false) { + if ($info) { $wxInfo = $info; return $wxInfo; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3531]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-07-12 21:35:22
|
Revision: 3531 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3531&view=rev Author: hemna Date: 2010-07-12 21:35:15 +0000 (Mon, 12 Jul 2010) Log Message: ----------- log ip 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-07-12 21:35:01 UTC (rev 3530) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-07-12 21:35:15 UTC (rev 3531) @@ -50,9 +50,9 @@ //$this->timer->start(); $airport = $this->process_airport($icao); if (!empty($airport) && !is_null($airport)) { - $this->log->info("request for ".$this->airports_raw." yes"); + $this->log->info($_SERVER["REMOTE_ADDR"]." ".$this->airports_raw." yes"); } else { - $this->log->info("request for ".$this->airports_raw." no"); + $this->log->info($_SERVER["REMOTE_ADDR"]." ".$this->airports_raw." no"); } //echo "Time took ".$this->timer->get_elapsed()."<br>"; $this->metars[] = $airport; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3537]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2010-11-19 23:53:49
|
Revision: 3537 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3537&view=rev Author: hemna Date: 2010-11-19 23:53:42 +0000 (Fri, 19 Nov 2010) Log Message: ----------- tracker crap 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-07-14 19:25:38 UTC (rev 3536) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2010-11-19 23:53:42 UTC (rev 3537) @@ -40,6 +40,16 @@ //$this->timer = new Timer(); $this->log = new Log(); $this->log->add_writer(FileLogWriter::factory(realpath($GLOBALS["path_base"])."/logs/aviation_weather.log")); + + PiwikTracker::$URL = 'http://wx.hemna.com/piwik/'; + $this->tracker = new PiwikTracker(1); + $this->tracker->setUrl($_SERVER["SCRIPT_URI"]); + $this->tracker->setBrowserLanguage($_SERVER["HTTP_ACCEPT_LANGUAGE"]); + $this->tracker->setUserAgent($_SERVER["HTTP_USER_AGENT"]); + $this->tracker->setIp($_SERVER["REMOTE_ADDR"]); + + $this->tracker->setCustomData(array("airports" => $this->airports)); + $this->tracker->doTrackPageView('AviationWeather'); } public function build_object() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3547]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2011-09-03 05:43:35
|
Revision: 3547 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3547&view=rev Author: hemna Date: 2011-09-03 05:43:29 +0000 (Sat, 03 Sep 2011) Log Message: ----------- fixed issue Modified Paths: -------------- trunk/open2300/lib/modules/api/AviationWeather.inc Modified: trunk/open2300/lib/modules/api/AviationWeather.inc =================================================================== --- trunk/open2300/lib/modules/api/AviationWeather.inc 2011-04-10 02:49:37 UTC (rev 3546) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2011-09-03 05:43:29 UTC (rev 3547) @@ -148,16 +148,18 @@ protected function get_runways(&$airport, &$wxInfo) { $runways = &$airport["runways"]; $info = array(); - - foreach($runways as &$runway) { - $number = $runway["runway_number"]; - $width = $runway["runway_width"] * 3.2808399; - $xw = $this->do_crosswind($runway, $wxInfo["Wind"]); - $info[] = array("runway" => $runway["runway_number"], - "length" => $runway["length"], - "crosswind" => $runway["crosswind"], - "headwind" => $runway["headwind"]); + + if ($runways != null && is_array($runways)) { + foreach($runways as &$runway) { + $number = $runway["runway_number"]; + $width = $runway["runway_width"] * 3.2808399; + $xw = $this->do_crosswind($runway, $wxInfo["Wind"]); + $info[] = array("runway" => $runway["runway_number"], + "length" => $runway["length"], + "crosswind" => $runway["crosswind"], + "headwind" => $runway["headwind"]); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Phphtmllib-devel] SF.net SVN: phphtmllib:[3549]
trunk/open2300/lib/modules/api/ AviationWeather.inc
From: <he...@us...> - 2011-09-03 06:27:56
|
Revision: 3549 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3549&view=rev Author: hemna Date: 2011-09-03 06:27:50 +0000 (Sat, 03 Sep 2011) Log Message: ----------- send along the wikipedia url Modified Paths: -------------- trunk/open2300/lib/modules/api/AviationWeather.inc Modified: trunk/open2300/lib/modules/api/AviationWeather.inc =================================================================== --- trunk/open2300/lib/modules/api/AviationWeather.inc 2011-09-03 06:15:41 UTC (rev 3548) +++ trunk/open2300/lib/modules/api/AviationWeather.inc 2011-09-03 06:27:50 UTC (rev 3549) @@ -135,6 +135,10 @@ //we changed settings, save them to the cache. $this->cache->set($icao,$airport); } + + if (isset($airport["wikipedia_url"])) { + $wxInfo["wikipedia_url"] = $airport["wikipedia_url"]; + } //$this->metars[] = $wxInfo; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |