Beispiel #1
0
include "../../config/settings.inc.php";
include "../../include/mlib.php";
include "../../include/network.php";
$nt = new NetworkTable("AWOS");
$cities = $nt->table;
function fancy($v, $floor, $ceil, $p)
{
    if ($v < $floor || $v > $ceil) {
        return "";
    }
    return sprintf("%{$p}.1f", $v);
}
include "../../include/iemaccess.php";
include "../../include/iemaccessob.php";
$iem = new IEMAccess();
$mydata = $iem->getNetwork("AWOS");
$rwis = fopen('/tmp/wxc_ia_awos.txt', 'w');
fwrite($rwis, "Weather Central 001d0300 Surface Data\n  13\n   5 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   4 Wind Speed\n   5 Today Precipitation\n");
$now = time();
while (list($key, $val) = each($mydata)) {
    $tdiff = $now - $val->db["ts"];
    if ($tdiff > 3600) {
        continue;
    }
    if ($val->db['pday'] < 0) {
        $val->db['pday'] = 0;
    }
    $s = sprintf("%5s %52s %2s %7s %8s %2s %4s %5s %5s %4s %4s %4s %5s\n", $key, $cities[$key]['name'], 'IA', round($cities[$key]['lat'], 2), round($cities[$key]['lon'], 2), date('d', $val->db['ts'] + 6 * 3600), date('H', $val->db['ts'] + 6 * 3600), $val->db['tmpf'], $val->db['dwpf'], $val->db['drct'], drct2txt($val->db['drct']), $val->db['sknt'], $val->db['pday']);
    fwrite($rwis, $s);
}
// End of while
Beispiel #2
0
    if ($sknt < 60) {
        return chr(238);
    }
}
$iem = new IEMAccess();
$sts = array();
if (isset($st)) {
    foreach ($st as $key => $value) {
        if (strlen($value) > 0 && $value != "ahack") {
            $o = $iem->getSingleSite($value);
            $sts[$value] = $o;
        }
    }
}
if (strlen($network) > 0) {
    $sts = $iem->getNetwork($network);
}
$varDef = array("tmpf" => "Temperatures", "tsf0" => "Pavement Temp #1", "tsf1" => "Pavement Temp #2", "tsf2" => "Pavement Temp #3", "tsf3" => "Pavement Temp #4", "dwpf" => "Dew Points", "vsby" => "Visibility", "sknt" => "Wind [knots]", "alti" => "Altimeter", "pres" => "Pressure", "barb" => "Wind Barbs", "max_tmpf" => "Maximum Temperature", "max_dwpf" => "Maximum Dew Point", "min_tmpf" => "Minimum Temperature", "gust" => "Peak Wind Gust [knots]", "relh" => "Relative Humidity", "phour" => "Hourly Rainfall", "pday" => "Today Rainfall", "pmonth" => "Rainfall This Month", "snow" => "Today Snowfall", "snowd" => "Today Snow Depth", "snoww" => "Snow Water Equivalent", "max_sknt" => "Peak Gust Today [knots]", "max_gust" => "Peak Gust Today [knots]", "feel" => "Feels Like");
$rnd = array("alti" => 2, "phour" => 2, "vsby" => 1, "tmpf" => 0, "dwpf" => 0, "pday" => 2, "pmonth" => 2, "pres" => 2, "snoww" => 2);
$lats = array();
$lons = array();
$height = 350;
$width = 450;
foreach ($sts as $key => $value) {
    $lats[$key] = $sts[$key]->db["y"];
    $lons[$key] = $sts[$key]->db["x"];
}
$lat0 = min($lats);
$lat1 = max($lats);
$lon0 = min($lons);
$lon1 = max($lons);
Beispiel #3
0
Refresh: 1 
Color: 200 200 255
IconFile: 1, 18, 32, 2, 31, "http://www.tornadocentral.com/grlevel3/windbarbs.png" 
IconFile: 2, 15, 15, 8, 8, "http://www.tornadocentral.com/grlevel3/cloudcover.png" 
Font: 1, 11, 1, "Courier New"

';
include "../../../config/settings.inc.php";
include "{$rootpath}/include/iemaccess.php";
include "{$rootpath}/include/iemaccessob.php";
include "{$rootpath}/include/mlib.php";
include "{$rootpath}/include/network.php";
$nt = new NetworkTable("KELO");
$cities = $nt->table;
$iem = new IEMAccess();
$snet = $iem->getNetwork("KELO");
function s2icon($s)
{
    if ($s < 2.5) {
        return "1,21";
    }
    if ($s < 5) {
        return "1,1";
    }
    if ($s < 10) {
        return "1,2";
    }
    if ($s < 15) {
        return "1,3";
    }
    if ($s < 20) {
Beispiel #4
0
<?php

include "../../../../config/settings.inc.php";
//  mesoplot/plot.php
//  - Replace GEMPAK mesoplots!!!
include_once "../../../../include/iemmap.php";
include "../../../../include/mlib.php";
include "../../../../include/iemaccess.php";
include "../../../../include/iemaccessob.php";
include "../../../../include/network.php";
$network = isset($_GET['network']) ? $_GET['network'] : 'KCCI';
$nt = new NetworkTable($network);
$Scities = $nt->table;
$titles = array("KCCI" => "KCCI SchoolNet8", "KELO" => "KELO WeatherNet", "KIMT" => "KIMT StormNet");
$iem = new IEMAccess();
$data = $iem->getNetwork($network);
function skntChar($sknt)
{
    if ($sknt < 2) {
        return chr(0);
    }
    if ($sknt < 5) {
        return chr(227);
    }
    if ($sknt < 10) {
        return chr(228);
    }
    if ($sknt < 15) {
        return chr(229);
    }
    if ($sknt < 20) {
Beispiel #5
0
/*
 * Generates a Weather Central formatted station datafile with the IEM 
 * processed SHEF (COOP) data included.  Why?  This dataset is difficult
 * to process and I'd like to think I do a great job at it :)
 */
include '../../config/settings.inc.php';
include '../../include/network.php';
$nt = new NetworkTable("IA_COOP");
$cities = $nt->table;
$coop = fopen('/tmp/wxc_coop.txt', 'w');
fwrite($coop, "Weather Central 001d0300 Surface Data\n  12\n   5 Station\n  52 CityName\n   2 State\n   7 Lat\n   9 Lon\n   2 Day\n   2 Hour\n   4 24hr High Temp\n   4 24hr Low Temp\n   6 Precipitation\n   6 Snowfall\n   6 Snowfall Depth\n");
include '../../include/iemaccess.php';
include '../../include/iemaccessob.php';
$iem = new IEMAccess();
$net = $iem->getNetwork("IA_COOP");
$now = time();
while (list($key, $iemob) = each($net)) {
    if ((double) $iemob->db["max_tmpf"] < -50) {
        $iemob->db["max_tmpf"] = " ";
    }
    if ((double) $iemob->db["min_tmpf"] > 90) {
        $iemob->db["min_tmpf"] = " ";
    }
    if ((double) $iemob->db["min_tmpf"] < -90) {
        $iemob->db["min_tmpf"] = " ";
    }
    if ((double) $iemob->db["snow"] < 0) {
        $iemob->db["snow"] = " ";
    }
    if ((double) $iemob->db["snow"] < 0) {
Beispiel #6
0
$rad = isset($_GET['rad']) ? $_GET['rad'] : 'DMX';
$tv = isset($_GET['rad']) ? strtoupper(substr($_GET['tv'], 0, 4)) : 'KCCI';
$station = isset($_GET['station']) ? $_GET['station'] : '';
$sortcol = isset($_GET['sortcol']) ? $_GET['sortcol'] : 'p15m';
$rs = pg_prepare($pgconn, "SELECT", "SELECT * from events WHERE network = \$1\n\tand valid > (now() - '15 minutes'::interval)");
$t->refresh = "<meta http-equiv=\"refresh\" content=\"60\">";
$t->title = "SchoolNet - Where's it raining?";
$t->thispage = "networks-schoolnet";
$ar = array("KCCI" => "KCCI-TV Des Moines", "KELO" => "KELO-TV Sioux Falls", "KIMT" => "KIMT-TV Mason City");
$tvselect = make_select("tv", $tv, $ar);
$ar = array("ABR" => "[ABR] Aberdeen, SD", "ARX" => "[ARX] LaCrosse, WI", "DMX" => "[DMX] Des Moines, IA", "DMXA" => "[DMX] Des Moines, IA (North)", "DMXB" => "[DMX] Des Moines, IA (Central)", "DMXC" => "[DMX] Des Moines, IA (South)", "DVN" => "[DVN] Davenport, IA", "EAX" => "[EAX] Pleasant Hill, MO", "FSD" => "[FSD] Sioux Falls, SD", "MPX" => "[MPX] Minneapolis, MN", "OAX" => "[OAX] Omaha, NE", "UDX" => "[UDX] Rapid City, SD");
$radselect = make_select("rad", $rad, $ar);
$nt = new NetworkTable($tv);
$stbl = $nt->table;
$iemdb = new IEMAccess();
$iemdata = $iemdb->getNetwork($tv);
$data = array();
while (list($key, $iemob) = each($iemdata)) {
    $data[$key] = $iemob->db;
    $data[$key]["p15m"] = 0;
}
$rs = pg_execute($pgconn, "SELECT", array($tv));
for ($i = 0; $row = @pg_fetch_array($rs, $i); $i++) {
    $data[$row["station"]]["p15m"] = $row["magnitude"];
}
function mktitle($map, $imgObj, $titlet)
{
    $layer = $map->getLayerByName("credits");
    // point feature with text for location
    $point = ms_newpointobj();
    $point->setXY(0, 470);
Beispiel #7
0
Refresh: 1 
Color: 200 200 255
IconFile: 1, 18, 32, 2, 31, "http://www.tornadocentral.com/grlevel3/windbarbs.png" 
IconFile: 2, 15, 15, 8, 8, "http://www.tornadocentral.com/grlevel3/cloudcover.png" 
Font: 1, 11, 1, "Courier New"

';
include "../../../config/settings.inc.php";
include "{$rootpath}/include/iemaccess.php";
include "{$rootpath}/include/iemaccessob.php";
include "{$rootpath}/include/mlib.php";
include "{$rootpath}/include/network.php";
$nt = new NetworkTable("KIMT");
$cities = $nt->table;
$iem = new IEMAccess();
$snet = $iem->getNetwork("KIMT");
function s2icon($s)
{
    if ($s < 2.5) {
        return "1,21";
    }
    if ($s < 5) {
        return "1,1";
    }
    if ($s < 10) {
        return "1,2";
    }
    if ($s < 15) {
        return "1,3";
    }
    if ($s < 20) {
Beispiel #8
0
 * Dumps IA and IL CoCoRaHS data to a Weather Central formatted file
 */
include "../../config/settings.inc.php";
include "../../include/mlib.php";
include "../../include/network.php";
$nt = new NetworkTable(array("IACOCORAHS", "ILCOCORAHS"));
include "../../include/iemaccess.php";
include "../../include/iemaccessob.php";
$iem = new IEMAccess();
$rwis = fopen('/tmp/wxc_cocorahs.txt', 'w');
fwrite($rwis, sprintf("Weather Central 001d0300 Surface Data timestamp=%s\n  10\n  12 Station\n  52 CityName\n   2 State\n   7 Lat\n   8 Lon\n   2 Day\n   4 Hour\n   6 Precip Total\n   6 Snow Total\n   6 Snow Depth\n", date("Y.m.d.H.I")));
$states = array("IA", "IL");
reset($states);
$now = time();
while (list($k, $state) = each($states)) {
    $mydata = $iem->getNetwork("{$state}COCORAHS");
    while (list($key, $val) = each($mydata)) {
        $tdiff = $now - $val->db["ts"];
        if ($tdiff > 86400) {
            continue;
        }
        if ($val->db['pday'] < 0) {
            $val->db["pday"] = " ";
        }
        if ($val->db['pday'] == 0.0001) {
            $val->db["pday"] = "T";
        }
        if ($val->db['snowd'] < 0) {
            $val->db["snowd"] = " ";
        }
        if ($val->db['snow'] < 0) {
Beispiel #9
0
<?php

/* Generate a JSON file of network observations */
header("Content-type: application/vnd.geo+json");
require_once 'Zend/Json.php';
include "../../config/settings.inc.php";
include "../../include/database.inc.php";
include "../../include/iemaccess.php";
include "../../include/iemaccessob.php";
include "../../include/network.php";
include "../../include/mlib.php";
$network = isset($_REQUEST["network"]) ? $_REQUEST["network"] : "IA_ASOS";
$callback = isset($_REQUEST["callback"]) ? $_REQUEST["callback"] : null;
$iem = new IEMAccess();
$asos = $iem->getNetwork($network);
$nt = new NetworkTable($network);
$cities = $nt->table;
$mydata = array();
while (list($key, $iemob) = each($asos)) {
    $mydata[$key] = $iemob->db;
    unset($mydata[$key]['geom']);
    unset($mydata[$key]['max_sknt_ts']);
    unset($mydata[$key]['max_gust_ts']);
    unset($mydata[$key]['day']);
    $mydata[$key]["valid"] = gmstrftime('%Y-%m-%dT%H:%MZ', $iemob->ts);
    $mydata[$key]["sname"] = $cities[$key]["name"];
    $mydata[$key]["lat"] = $cities[$key]["lat"];
    $mydata[$key]["lon"] = $cities[$key]["lon"];
    $mydata[$key]["sped"] = $mydata[$key]["sknt"] * 1.15078;
    $mydata[$key]["relh"] = relh(f2c($mydata[$key]["tmpf"]), f2c($mydata[$key]["dwpf"]));
    $mydata[$key]["feel"] = feels_like($mydata[$key]["tmpf"], $mydata[$key]["relh"], $mydata[$key]["sped"]);
Beispiel #10
0
    if ($s < 75) {
        return "1,15";
    }
    if ($s < 80) {
        return "1,16";
    }
    if ($s < 85) {
        return "1,17";
    }
    if ($s < 80) {
        return "1,18";
    }
    if ($s < 100) {
        return "1,19";
    }
    return "1,20";
}
$now = time();
$snet = $iem->getNetwork("AWOS");
while (list($key, $iemob) = each($snet)) {
    $mydata = $iemob->db;
    $meta = $cities[$key];
    $tdiff = $now - $mydata["ts"];
    if ($tdiff > 3600) {
        continue;
    }
    if ($mydata["sknt"] < 2.5) {
        $mydata["drct"] = 0;
    }
    echo "Object: " . $meta["lat"] . "," . $meta["lon"] . "\n  Threshold: 999 \n  Icon: 0,0," . $mydata["drct"] . "," . s2icon(floatval($mydata["sknt"])) . "\n  Icon: 0,0,000,2,5,\"" . $meta["name"] . " @ " . strftime("%d %b %I:%M %p", $mydata['ts']) . "\\nTemp: " . $mydata["tmpf"] . "F (Dew: " . $mydata["dwpf"] . "F)\\nWind: " . drct2txt($mydata["drct"]) . " @ " . intval($mydata["sknt"]) . "kt\\n\" \n  Threshold: 150\n  Text:  -17, 13, 1, \" " . round($mydata["tmpf"], 0) . " \" \n  Text:  -17, -13, 1, \" " . round($mydata["dwpf"], 0) . " \" \n End: \n\n";
}
Beispiel #11
0
Color: 200 200 255
IconFile: 1, 18, 32, 2, 31, "http://www.tornadocentral.com/grlevel3/windbarbs.png" 
IconFile: 2, 15, 15, 8, 8, "http://www.tornadocentral.com/grlevel3/cloudcover.png" 
IconFile: 3, 25, 25, 12, 12, "http://mesonet.agron.iastate.edu/request/grx/rwis_cr.png" 
Font: 1, 11, 1, "Courier New"

';
include "../../../config/settings.inc.php";
include "{$rootpath}/include/iemaccess.php";
include "{$rootpath}/include/iemaccessob.php";
include "{$rootpath}/include/mlib.php";
include "{$rootpath}/include/network.php";
$nt = new NetworkTable("IA_RWIS");
$cities = $nt->table;
$iem = new IEMAccess();
$snet = $iem->getNetwork("IA_RWIS");
function pcolor($tmpf)
{
    if ($tmpf == "M") {
        return "1";
    }
    if ($tmpf >= 35) {
        return "2";
    }
    if ($tmpf >= 34) {
        return "3";
    }
    if ($tmpf >= 33) {
        return "4";
    }
    if ($tmpf >= 32) {
Beispiel #12
0
echo 'Title: KCCI SchoolNet8
Refresh: 1 
Color: 200 200 255
IconFile: 1, 18, 32, 2, 31, "http://www.tornadocentral.com/grlevel3/windbarbs.png" 
IconFile: 2, 15, 15, 8, 8, "http://www.tornadocentral.com/grlevel3/cloudcover.png" 
Font: 1, 11, 1, "Courier New"

';
include "../../../config/settings.inc.php";
include "../../../include/iemaccess.php";
include "../../../include/iemaccessob.php";
include "../../../include/mlib.php";
include "../../../include/network.php";
$nt = new NetworkTable("KCCI");
$iem = new IEMAccess();
$snet = $iem->getNetwork("KCCI");
function s2icon($s)
{
    if ($s < 2.5) {
        return "1,21";
    }
    if ($s < 5) {
        return "1,1";
    }
    if ($s < 10) {
        return "1,2";
    }
    if ($s < 15) {
        return "1,3";
    }
    if ($s < 20) {
Beispiel #13
0
    return sprintf("%{$p}.1f", $v);
}
include "../../include/iemaccess.php";
include "../../include/iemaccessob.php";
$iem = new IEMAccess();
/* Lets also get the traffic data, please */
$rs = pg_query($iem->dbconn, "select l.nwsli, t.* from rwis_traffic t, \n\trwis_locations l where l.id = t.location_id and lane_id < 4");
$traffic = array();
for ($i = 0; $row = @pg_fetch_array($rs, $i); $i++) {
    if (!array_key_exists($row["nwsli"], $traffic)) {
        $traffic[$row["nwsli"]] = array("avgspeed0" => "M", "avgspeed1" => "M", "avgspeed2" => "M", "avgspeed3" => "M");
    }
    $traffic[$row["nwsli"]][sprintf("avgspeed%s", $row["lane_id"])] = round($row["avg_speed"], 0);
}
$tstamp = gmdate("Y-m-d\\TH:i:s");
$mydata = $iem->getNetwork("IA_RWIS");
$rwis = fopen('/tmp/wxc_iadot.txt', 'w');
fwrite($rwis, "Weather Central 001d0300 Surface Data TimeStamp={$tstamp}\n  22\n   5 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   4 Wind Speed\n   4 SubSurface Temp\n   4 P1 Temp\n   4 P2 Temp\n   4 P3 Temp\n   4 P4 Temp\n   4 Pave Ave Temp\n   3 Sensor 0 Average Speed\n   3 Sensor 1 Average Speed\n   3 Sensor 2 Average Speed\n   3 Sensor 3 Average Speed\n");
$now = time();
while (list($key, $val) = each($mydata)) {
    if (!array_key_exists($key, $traffic)) {
        $traffic[$key] = array("avgspeed0" => "M", "avgspeed1" => "M", "avgspeed2" => "M", "avgspeed3" => "M");
    }
    $tdiff = $now - $val->db["ts"];
    if ($val->db['tsf0'] == "") {
        $val->db['tsf0'] = -99.98999999999999;
    }
    if ($val->db['tsf1'] == "") {
        $val->db['tsf1'] = -99.98999999999999;
    }
    if ($val->db['tsf2'] == "") {