echo '<!-- metardisplay --> <div class="blockDiv"> <h3 class="blockHead">' . langtransstr('Nearby METAR Reports') . '</h3> <table class="genericTable"> <tr>'; for ($n1 = 0; $n1 < $maxCols; $n1++) { echo '<th style="width: ' . $col_width . '%;"> </th>'; } echo '</tr> <tr>' . PHP_EOL; foreach ($MetarList as $idx => $Mrec) { list($mtrICAO, $mtrName, $mtrDistanceM, $mtrDistanceK, $direction) = explode('|', $Mrec . '|||||'); if ($mtrICAO == '') { continue; } $mtr = mtr_conditions($mtrICAO); if ($mtr == false) { continue; ws_message('<!-- module metarDisplay.php (' . __LINE__ . '): Invalid METAR: ' . $mtrICAO . ', skipped -->', true); } $metarUpdated = date($SITE['timeFormat'], strtotime($mtr['time'])); /* now $mtr array contains the decoded values [metar_raw] => KAVP 011107Z 13003KT 4SM BR BKN023 18/17 A3010 RMK AO2 T01830167 [metar_cleaned] => KAVP 011107Z 13003KT 4SM BR BKN023 18/17 A3010 RMK AO2 T01830167 [station_id] => KAVP [errors] => Array () [time] => 2015-09-01T11:07:00 UTC [age] => 1643 [max-icon] => 350 [wind_dir] => 130 [wind_speed_kt] => 03
continue; } // skip lines with non-numeric lat lon $key++; $my_metars[$metar] = array('key' => $key, 'name' => $area, 'lat' => $lat, '$lon' => $lon, 'found' => false); } $testDash = false; $number_cities = 0; $start_metar = microtime(true); if (!function_exists('mtr_conditions')) { $script = $metar_folder . 'wsMetarTxt.php'; ws_message('<!-- module dash_metar.php (' . __LINE__ . '): loading ' . $script . ' -->'); include $script; } foreach ($my_metars as $key => $arr) { $mtr = mtr_conditions($key); if ($mtr == false) { unset($my_metars[$key]); continue; } $number_cities++; $my_metars[$key]['found'] = true; $my_metars[$key]['temp'] = round(wsConvertTemperature($mtr['temp'], 'C'), 0); $my_metars[$key]['iconurl'] = $mtr['icon_url']; $extra = $long_text = ''; if (isset($mtr['conditions']) && $mtr['conditions'] != '') { $end = count($mtr['conditions']); for ($n1 = 0; $n1 < $end; $n1++) { $text = langtransstr($mtr['conditions'][$n1]); $long_text .= $extra . $text; $extra = ', ';
wsChangeIcon('yahoo', $iconIn, $ccnIconNr, $urlIn, $ccnIconUrl); $headerClass = wsHeaderLookup('yahoo', $iconIn); break; case 'wd': if (isset($ws['wdCurCond']) && isset($ws['wdCurIcon'])) { $condDesc = cleanCurCond($ws['wdCurCond']); $ccnIconNr = $ccnIconUrl = $urlIn = $notUsed = ''; wsChangeIcon('wd', $ws['wdCurIcon'], $ccnIconNr, $urlIn, $ccnIconUrl); $headerClass = wsHeaderLookup('wd', $ws['wdCurIcon']); break; } default: $script = $SITE['metarDir'] . 'wsMetarTxt.php'; ws_message('<!-- module wsDataGet.php (' . __LINE__ . '): loading ' . $script . ' -->'); include $script; $mtr = mtr_conditions($SITE["METAR"]); $extra = $long_text = ''; if (isset($mtr['conditions']) && $mtr['conditions'] != '') { $end = count($mtr['conditions']); for ($n1 = 0; $n1 < $end; $n1++) { $text = $mtr['conditions'][$n1]; if (trim($text) == 'Clear' && $dayNight != 'nighttime') { $text = 'Sunny'; } $text = langtransstr($text); $long_text .= $extra . $text; $extra = ', '; } } if (isset($mtr['covers_max']) && $mtr['covers_max'] != '') { $text = $mtr['covers_max'];