示例#1
0
文件: currents.php 项目: raprasad/iem
$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"]);
            $bclass->getLabel(0)->set("angle", doubleval($rotate));
示例#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
文件: obs.php 项目: raprasad/iem
    }
    if ($mydata[$key]["alti"] < -60) {
        $mydata[$key]["alti"] = "M";
        if ($sortcol == "alti") {
            $mydata[$key] = 0;
            continue;
        }
    }
    if ($mydata[$key]["vsby"] < 0) {
        $mydata[$key]["vsby"] = "M";
        if ($sortcol == "vsby") {
            $mydata[$key] = 0;
            continue;
        }
    }
    $mydata[$key]["feel"] = feels_like($mydata[$key]["tmpf"], $mydata[$key]["relh"], $mydata[$key]["sped"]);
    if ($mydata[$key]["max_gust"] > $mydata[$key]["max_sknt"]) {
        $mydata[$key]["peak"] = $mydata[$key]["max_gust"];
        $mydata[$key]["peak_ts"] = strtotime(substr($mydata[$key]["lmax_gust_ts"], 0, 16));
    } else {
        $mydata[$key]["peak"] = $mydata[$key]["max_sknt"];
        $mydata[$key]["peak_ts"] = 0;
        if ($mydata[$key]["max_sknt_ts"] > 0) {
            $mydata[$key]["peak_ts"] = strtotime(substr($mydata[$key]["lmax_sknt_ts"], 0, 16));
        }
    }
}
$table = "";
$finalA = array();
$finalA = aSortBySecondIndex($mydata, $sortcol);
$now = time();
示例#4
0
文件: kelo.php 项目: muthulatha/iem
}
include "../../include/mlib.php";
include "../../include/iemaccess.php";
include "../../include/iemaccessob.php";
$station = isset($_GET["station"]) ? substr($_GET["station"], 0, 5) : 'SSAS2';
$iemdb = new IEMAccess();
$myOb = $iemdb->getSingleSite($station);
//print_r($myOb);
$tmpf = $myOb->db["tmpf"];
$relh = $myOb->db["relh"];
$alti = $myOb->db["alti"];
$pday = $myOb->db["pday"];
$drct = drct2txt($myOb->db["drct"]);
$gust = round($myOb->db["max_gust"] * 1.15, 0);
$sped = round($myOb->db["sknt"] * 1.15, 0);
$feel = feels_like($tmpf, $relh, $sped);
$time = "Valid: " . date("d M Y h:i a", $myOb->db["ts"]);
$dwpf = $myOb->db["dwpf"];
$gustDir = drct2txt($myOb->db["max_drct"]);
$maxTemp = $myOb->db["max_tmpf"];
$minTemp = $myOb->db["min_tmpf"];
$width = 320;
$height = 240;
$Font = '/mesonet/data/gis/static/fonts/kcci.ttf';
$gif = ImageCreate($width, $height);
//int imagecopy ( resource dst_im, resource src_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h)
$black = ImageColorAllocate($gif, 0, 0, 0);
$white = ImageColorAllocate($gif, 250, 250, 250);
$green = ImageColorAllocate($gif, 0, 255, 0);
$yellow = ImageColorAllocate($gif, 255, 255, 120);
$red = ImageColorAllocate($gif, 148, 52, 53);
示例#5
0
文件: alpha.php 项目: muthulatha/iem
<?php

$station = isset($_GET['station']) ? substr($_GET['station'], 0, 5) : 'SJEI4';
include "../../config/settings.inc.php";
include "../../include/iemaccess.php";
include "../../include/mlib.php";
include "../../include/iemaccessob.php";
$iem = new IEMAccess();
$ob = $iem->getSingleSite($station);
header('Content-type: text/plain');
echo $ob->db["tmpf"] . "\n";
echo $ob->db["dwpf"] . "\n";
echo $ob->db["sknt"] . "\n";
echo drct2txt($ob->db["drct"]) . "\n";
echo round($ob->db["gust"], 0) . "\n";
echo $ob->db["pday"] . "\n";
echo $ob->db["relh"] . "\n";
echo $ob->db["pres"] . "\n";
echo feels_like($ob->db['tmpf'], $ob->db['relh'], $ob->db['sknt']) . "\n";