Пример #1
0
$lbl->set("font", "liberation");
$lbl->set("size", 18);
//$lbl->set("color", $black);
$lbl->set("position", MS_AUTO);
$lbl->set("force", MS_ON);
$ly2 = $map->getLayerByName("pointonly");
$ly2->set("status", MS_ON);
$ly2->setProjection("init=epsg:4326");
$barbs = $map->getlayerbyname("barbs");
$barbs->set("status", MS_ON);
$bclass = $barbs->getClass(0);
$now = time();
foreach ($sts as $key => $value) {
    $bzz = $value;
    $sped = $bzz->db["sknt"] * 1.15078;
    $bzz->db["relh"] = relh(f2c($bzz->db["tmpf"]), f2c($bzz->db["dwpf"]));
    $bzz->db["feel"] = feels_like($bzz->db["tmpf"], $bzz->db["relh"], $sped);
    $val = round(@$bzz->db[$var], @$rnd[$var]);
    $mynetwork = $bzz->db["network"];
    if (($now - $bzz->ts < 3900 || (substr($mynetwork, 3, 4) == "COOP" || $mynetwork == "IACOCORAHS") && $now - $bzz->ts < 86400) && $val > -99 & $val != 99) {
        if (in_array('barbs', $layers)) {
            $pt = ms_newPointObj();
            $pt->setXY($bzz->db["x"], $bzz->db["y"], 0);
            $rotate = 0 - intval($bzz->db["drct"]);
            $bclass->getLabel(0)->set("angle", doubleval($rotate));
            $pt->draw($map, $barbs, $img, 0, skntChar($bzz->db["sknt"]));
        }
        if ($var == "barb" && $bzz->db["sknt"] > -1) {
            $pt = ms_newPointObj();
            $pt->setXY($bzz->db["x"], $bzz->db["y"], 0);
            $rotate = 0 - intval($bzz->db["drct"]);
Пример #2
0
function formatter($i, $row)
{
    $ts = strtotime(substr($row["valid"], 0, 16));
    $relh = relh(f2c($row["tmpf"]), f2c($row["dwpf"]));
    return sprintf("<tr style=\"background: %s;\"><td>%s</td><td>%s</td><td>%s</td>\n\t<td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>\n\t<td><span class=\"high\">%s</span></td>\n\t<td><span class=\"low\">%s</span></td>\n\t<td>%.0f%%</td>\n\t<td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n\t<tr style=\"background: %s;\" class=\"metar\"><td colspan=\"15\">%s</td></tr>", $i % 2 == 0 ? "#FFF" : "#EEE", date("g:i A", $ts), wind_formatter($row), vis_formatter($row["vsby"]), sky_formatter($row), $row["presentwx"], temp_formatter($row["tmpf"]), temp_formatter($row["dwpf"]), temp_formatter(feels_like($row["tmpf"], $relh, $row["sknt"] * 1.15)), temp_formatter($row["max_tmpf_6hr"]), temp_formatter($row["min_tmpf_6hr"]), relh(f2c($row["tmpf"]), f2c($row["dwpf"])), $row["alti"], $row["pres"], $row["phour"], $row["p03i"], $row["p06i"], $i % 2 == 0 ? "#FFF" : "#EEE", $row["raw"]);
}
Пример #3
0
    for ($j = 0; $row2 = @pg_fetch_assoc($rs2, $j); $j++) {
        if ($ostation != $row2["station"]) {
            if ($stfound > 0 && $stfound % 3 == 0) {
                $table .= "</td></tr>";
                $ostation = "";
            }
            if ($ostation == "") {
                $table .= "<tr><td valign='top'>";
            } else {
                $table .= "</td><td valign='top'>";
            }
            $ostation = $row2["station"];
            $stfound += 1;
            $table .= sprintf("<u>UGC Code: %s</u><br/>", $station2ugc[$row2["station"]]);
        }
        $table .= sprintf("%s %sZ %s/%.0f %s %s %s%s<br>", $row2["station"], $row2["z"], c4($row2["tmpf"]), $row2["dwpf"], c1(relh(f2c($row2["tmpf"]), f2c($row2["dwpf"]))), c3($row2["vsby"]), c2($row2["sknt"], $row2["gust"]), c5($row2["wcht"]));
    }
    $table .= "</td></tr></table>";
}
$t->content = <<<EOF
  <h2>NWS Watch/Warning/Advisory + ASOS Observations</h2>
  
  <p>This app allows you to view an office's warnings for a year and
  then looks for ASOS/AWOS observations valid for the warning period. The observations
  presented are coded like:
  <br />ID DDHHMI TMPF/DWPF RELH VSBY SKNT/GUST WC WINDCHILL
  <br />Where ID is the station identifier, DDHHMI is the day-hour-minute of the
  observation in UTC, TMPF is the air temperature in Fahrenheit, DWPF is the
  dew point temperature in Fahrenheit, RELH is the relative humidity, VSBY is
  the visibility, SKNT is the wind speed in knots and GUST is the wind gust in knots. 
  The wind chill is displayed when the temperature is below 32&deg;F.
Пример #4
0
        arsort($indexMap);
    }
    while (list($firstIndex, ) = each($indexMap)) {
        if (is_numeric($firstIndex)) {
            $sortedArray[] = $multiArray[$firstIndex];
        } else {
            $sortedArray[$firstIndex] = $multiArray[$firstIndex];
        }
    }
    return $sortedArray;
}
$mydata = array();
while (list($key, $iemob) = each($asos)) {
    $mydata[$key] = $iemob->db;
    $mydata[$key]["sped"] = $mydata[$key]["sknt"] * 1.15078;
    $mydata[$key]["relh"] = relh(f2c($mydata[$key]["tmpf"]), f2c($mydata[$key]["dwpf"]));
    if ($mydata[$key]["relh"] < 5) {
        $mydata[$key]["relh"] = "M";
        $mydata[$key]["dewpf"] = "M";
        if ($sortcol == "feel" || $sortcol == "dwpf" || $sortcol == "relh") {
            $mydata[$key] = 0;
            continue;
        }
    }
    if ($mydata[$key]["tmpf"] < -60) {
        $mydata[$key]["tmpf"] = "M";
        if ($sortcol == "tmpf" || $sortcol == "feel" || $sortcol == "dwpf" || $sortcol == "relh") {
            $mydata[$key] = 0;
            continue;
        }
    }
Пример #5
0
system($cmd);
unlink("/tmp/wxc_ildot.txt");
// ------------------------------------------------
pg_close($nt->dbconn);
$nt = new NetworkTable(array("OH_RWIS", "IN_RWIS", "KY_RWIS"));
$cities = $nt->table;
$mydata = $iem->getNetwork(array("OH_RWIS", "IN_RWIS", "KY_RWIS"));
$rwis = fopen('/tmp/wxc_oh_in_kydot.txt', 'w');
$rwiscsv = fopen('/tmp/csv_oh_in_kydot.txt', 'w');
fwrite($rwis, "Weather Central 001d0300 Surface Data TimeStamp={$tstamp}\n  22\n   6 Station\n  52 CityName\n   2 State\n   7 Lat\n   8 Lon\n   2 Day\n   4 Hour\n   5 AirTemp\n   5 AirDewp\n   4 Wind Direction Degrees\n   4 Wind Direction Text\n   5 Wind Speed\n   5 SubSurface Temp\n   5 P1 Temp\n   5 P2 Temp\n   5 P3 Temp\n   5 P4 Temp\n   5 Pave Ave Temp\n   5 Wind Chill F\n   5 Heat Index F\n   5 Today High Temp F\n   5 Today Low Temp F\n");
fwrite($rwiscsv, "station,cityname,state,lat,lon,day,hour,airtemp,airdewp," . "drct,drcttxt,sped,subsurfacetemp,p1temp,p2temp,p3temp,p4temp," . "pavetemp,wcht,hidx,today_high,today_low\n");
$now = time();
while (list($key, $val) = each($mydata)) {
    $tdiff = $now - $val->db["ts"];
    // Heat index
    $relh = relh(f2c($val->db['tmpf']), f2c($val->db['dwpf']));
    $val->db["heat"] = round(heat_idx($val->db['tmpf'], $relh), 1);
    $val->db["wcht"] = round(wcht_idx($val->db['tmpf'], $val->db['sknt'] * 1.15), 1);
    if ($val->db['dwpf'] < -99.0) {
        $val->db['dwpf'] = 'M';
        $val->db['heat'] = 'M';
    } else {
        $val->db['dwpf'] = round($val->db['dwpf'], 1);
    }
    if ($val->db['tmpf'] < -99.0) {
        $val->db['tmpf'] = 'M';
        $val->db['heat'] = 'M';
        $val->db['wcht'] = 'M';
    } else {
        $val->db['tmpf'] = round($val->db['tmpf'], 1);
    }