$rs = pg_execute($pgconn, "SELECT", array($station)); $table .= "<table class=\"table table-striped\">\n\t\t\t<thead><tr><th>Physical Code</th><th>Duration</th><th>Extremum</th>\n\t\t\t<th>Valid</th><th>Value</th></thead>"; for ($i = 0; $row = @pg_fetch_assoc($rs, $i); $i++) { $ts = strtotime($row["valid"]); $depth = ""; if ($row["depth"] > 0) { $depth = sprintf("%d inch", $row["depth"]); } $table .= sprintf("<tr><td>[%s] %s %s</td><td>[%s] %s</td><td>[%s] %s</td><td>%s</td><td>%s</td></tr>", $row["physical_code"], $shefcodes[$row["physical_code"]], $depth, $row["duration"], $durationcodes[$row["duration"]], $row["extremum"] == 'Z' ? '-' : $row['extremum'], $extremumcodes[$row["extremum"]], date('d M Y g:i A', $ts), $row["value"]); } $table .= "</table>"; } else { include "../../include/iemaccess.php"; include "../../include/iemaccessob.php"; $iem = new IEMAccess($metadata["tzname"]); $iemob = $iem->getSingleSite($station); $rs = $iemob->db; $vardict = array("lvalid" => "Observation Time", "tmpf" => "Air Temp [F]", "max_tmpf" => "Maximum Air Temperature [F]", "min_tmpf" => "Minimum Air Temperature [F]", "dwpf" => "Dew Point [F]", "relh" => "Relative Humidity [%]", "drct" => "Wind Direction", "sknt" => "Wind Speed [knots]", "srad" => "Solar Radiation", "alti" => "Altimeter [inches]", "pday" => "Daily Precipitation [inches]", "pmonth" => "Monthly Precipitation [inches]", "gust" => "Wind Gust [knots]", "raw" => "Raw Observation/Product"); $table = "<table class=\"table table-striped\">"; foreach ($vardict as $key => $value) { if (array_key_exists($key, $rs) && $rs[$key] != "" && $rs[$key] != -99) { if ($key == "lvalid") { $t2 = date("d M Y, g:i A", strtotime($rs[$key])); $table .= '<tr><td><b>' . $value . '</b></td><td>' . $t2 . '</td></tr>'; } else { $table .= '<tr><td><b>' . $value . '</b></td><td>' . $rs[$key] . '</td></tr>'; } // End if } // End if }
if ($sknt < 50) { return chr(236); } if ($sknt < 55) { return chr(237); } 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"];
include "../../config/settings.inc.php"; function dwp($tmpf, $relh) { if ($relh == 0) { return ""; } $tmpk = 273.15 + 5.0 / 9.0 * ($tmpf - 32.0); $dwpk = $tmpk / (1 + 0.000425 * $tmpk * -log10($relh / 100.0)); return round(($dwpk - 273.15) * 9.0 / 5.0 + 32, 0); } 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;