Пример #1
0
<?php

include "../../config/settings.inc.php";
define("IEM_APPID", 156);
include_once "../../include/myview.php";
include_once "../../include/database.inc.php";
include_once "../../include/forms.php";
include_once "../../include/imagemaps.php";
include_once "../../include/network.php";
$nt = new NetworkTable("NWSCLI");
$station = isset($_GET["station"]) ? $_GET["station"] : 'KDSM';
$year = isset($_GET["year"]) ? intval($_GET["year"]) : date("Y");
$month = isset($_GET["month"]) ? intval($_GET["month"]) : null;
$day = isset($_GET["day"]) ? intval($_GET["day"]) : null;
$opt = isset($_GET["opt"]) ? $_GET["opt"] : "bystation";
$ys = yearSelect(2009, $year, "year");
$ms = monthSelect($month, "month");
$ds = daySelect($day, "day");
$pgconn = iemdb("iem");
$byday = false;
if ($opt === "bystation") {
    $title = sprintf("Station: %s for Year: %s", $station, $year);
    $col1label = "Date";
    $rs = pg_prepare($pgconn, "SELECT", "SELECT *,\n\t\t\tarray_to_string(high_record_years, ' ') as hry,\n\t\t\tarray_to_string(low_record_years, ' ') as lry,\n\t\t\tarray_to_string(precip_record_years, ' ') as pry,\n\t\t\tarray_to_string(snow_record_years, ' ') as sry\n\t\t\tfrom cli_data where\n\t\t\tstation = \$1 and valid BETWEEN \$2 and \$3 ORDER by valid ASC");
    $rs = pg_execute($pgconn, "SELECT", array($station, "{$year}-01-01", "{$year}-12-31"));
} else {
    $col1label = "Station";
    $byday = true;
    $day = mktime(0, 0, 0, $month, $day, $year);
    $title = sprintf("All Stations for Date: %s", date("d F Y", $day));
    $rs = pg_prepare($pgconn, "SELECT", "SELECT *,\n\t\t\tarray_to_string(high_record_years, ' ') as hry,\n\t\t\tarray_to_string(low_record_years, ' ') as lry,\n\t\t\tarray_to_string(precip_record_years, ' ') as pry,\n\t\t\tarray_to_string(snow_record_years, ' ') as sry\n\t\t\tfrom cli_data where\n\t\t\tvalid = \$1 ORDER by station ASC");
Пример #2
0
<?php

include "../../../config/settings.inc.php";
include "../../../include/myview.php";
$t = new MyView();
$station = isset($_GET["station"]) ? $_GET["station"] : "";
$year = isset($_GET["year"]) ? $_GET["year"] : date("Y");
$month = isset($_GET["month"]) ? $_GET["month"] : date("m");
$day = isset($_GET["day"]) ? $_GET["day"] : date("d");
$t->thispage = "networks-awos";
$t->title = "AWOS 1 Minute Time Series";
include "../../../include/imagemaps.php";
include "../../../include/forms.php";
$nselect = networkSelect("AWOS", $station);
$yselect = yearSelect(1995, 2011, $year);
$mselect = monthSelect($month);
$dselect = daySelect($day);
$content = <<<EOF
<ol class="breadcrumb">
 <li><a href="/AWOS/">AWOS Network</a></li>
 <li class="active">One minute time series</li>
</ol>

<p><b>Note:</b>The archive currently contains data from 1 Jan 1995 
till the end of the previous month.  Fort Dodge and Clinton were converted to ~ASOS, 
but are available for some times earlier in the archive.<p>

  <form method="GET" action="1station_1min.php">
Make plot selections: <br>
    {$nselect} 
 
Пример #3
0
$t->thispage = "networks-agclimate";
include "../../include/forms.php";
$prod = isset($_GET["prod"]) ? intval($_GET["prod"]) : 1;
$year = isset($_REQUEST["year"]) ? intval($_REQUEST["year"]) : date("Y");
$month = isset($_REQUEST["month"]) ? intval($_REQUEST["month"]) : date("m");
$old2new = array("/data/agclimate/air-temp-out.png" => 1, "/data/agclimate/4in-temp-out.png" => 2, "/agclimate/daily_pics/4in-temp-out.png" => 2, "/data/agclimate/soil-hilo-out.png" => 3, "/agclimate/daily_pics/soil-hilo-out.png" => 3, "/data/agclimate/rad-out.png" => 4, "/data/agclimate/prec-out.png" => 5, "/data/agclimate/et-out.png" => 6, "/data/agclimate/pk-wind-out.png" => 7, "/data/agclimate/avewind-out.png" => 8, "/data/agclimate/dwpts.png" => 9, "/data/agclimate/mon-et-out.png" => 10, "/data/agclimate/mon-prec-out.png" => 11);
// Legacy
if (isset($_GET["src"])) {
    $prod = $old2new[$_GET["src"]];
}
$data = array(1 => array("mapurl" => "/data/agclimate/air-temp-out.png", "desc" => "High and low air temperature for a local day. Measurements are \n            made at a 2 meter height."), 2 => array("mapurl" => "/data/agclimate/4in-temp-out.png", "desc" => "Average 4 inch soil depth temperature.  Usually under a \n            bare soil."), 3 => array("mapurl" => "/data/agclimate/soil-hilo-out.png", "desc" => "High and low 4 inch soil depth temperature.  Usually under a \n            bare soil."), 4 => array("mapurl" => "/data/agclimate/rad-out.png", "desc" => "Daily total (direct + diffuse) solar radiation."), 5 => array("mapurl" => "/data/agclimate/prec-out.png", "desc" => "Daily total precipitation.  This is measured with a <b>non-heated</b> tipping bucket located near the ground.  These reported values should be\nused with extreme caution.  For various reasons, the reported values are \noften too low."), 6 => array("mapurl" => "/data/agclimate/et-out.png", "desc" => "Potential maximum estimated evapotranspiration.  This value uses\n            a daily Penman formulation with a crop coefficient of 1."), 7 => array("mapurl" => "/data/agclimate/pk-wind-out.png", "desc" => "Peak 5 second sustained wind gust.  The value is presented along\n      with the time using a 24 hour clock.  For example, 18:00 would be 6 PM.\n      Values are in local time, either CDT or CST depending on the time of\n      year."), 8 => array("mapurl" => "/data/agclimate/avewind-out.png", "desc" => "Average wind speed for the day as recorded by the data logger\n            on the station."), 9 => array("mapurl" => "/data/agclimate/dwpts.png", "desc" => "High and low dew points for the day."), 10 => array("mapurl" => "/GIS/apps/agclimate/month.php?dvar=dailyet&direct=yes&year={$year}&month={$month}", "desc" => "Monthly total of daily maximum potential evapotranspiration. The\n            daily value is calculated via a Penman formulation with a crop\n            coefficient of 1.  The value would be a theoretical maximum."), 11 => array("mapurl" => "/GIS/apps/agclimate/month.php?dvar=rain_mm_tot&direct=yes&year={$year}&month={$month}", "desc" => "Monthly total of daily reported precipitation. This is measured with a <b>non-heated</b> tipping bucket located near the ground.  These reported values should be\nused with extreme caution.  For various reasons, the reported values are \noften too low."), 12 => array("mapurl" => "/data/agclimate/chill-sum.png", "desc" => "The Standard Chill Unit map is a summation of hours during \n   which the temperature was between 32 and 45 degrees <b>after</b> \n   1 September.  The value has application for \n   fruit growers in the state.  The departure from average is also \n   presented.  This average is computed from the observational record at\n   the site."));
$extra = "";
if ($prod == 10 || $prod == 11) {
    $extra .= "<form method='GET' name='ts'>";
    $extra .= "<input type='hidden' value='{$prod}' name='prod'>";
    $extra .= "<strong>Select Year: </strong>" . yearSelect(1987, $year);
    $extra .= "<strong>Select Month: </strong>" . monthSelect($month, "month");
    $extra .= "<input type='submit' value='Update Plot' />";
    $extra .= '</form>';
}
$t->content = <<<EOF

<table style="float: left;" width="100%">
<TR>
<TD valign="top">
{$extra}

<img src="{$data[$prod]["mapurl"]}" ALT="ISU Ag Climate" style="border: 1px solid #000; ">

<p><strong>Plot Description:</strong><br />
{$data[$prod]["desc"]}
Пример #4
0
\t\tif (table.rows[i].className == 'metar'){
\t    \ttable.rows[i].style.display = rowStyle;
\t\t}
\t}
\tif (hide){
\t\tdocument.getElementById("metar_toggle").innerHTML = "Show METARs";
\t} else{
\t\tdocument.getElementById("metar_toggle").innerHTML = "Hide METARs";
\t}
\thide = !hide;
}
</script>
EOF;
$dstr = date("d F Y", $date);
$tzname = $metadata["tzname"];
$ys = yearSelect($startyear, date("Y", $date));
$ms = monthSelect(date("m", $date));
$ds = daySelect(date("d", $date));
$mbutton = preg_match("/ASOS|AWOS/", $network) ? "<a onclick=\"javascript:hideMetars();\" class=\"btn btn-default\" id=\"metar_toggle\">Show Metars</a>" : "";
$content = <<<EOF
<style>
.high {
  color: #F00;
}
.low {
  color: #00F;
}
.metar {
  display: none;
}
</style>
Пример #5
0
$wfo = isset($_REQUEST['wfo']) ? $_REQUEST['wfo'] : 'DMX';
$year = isset($_REQUEST["year"]) ? intval($_REQUEST["year"]) : date("Y");
$month = isset($_REQUEST["month"]) ? $_REQUEST["month"] : date("m");
$rs = pg_prepare($dbconn, "MYSELECT", "select id, name,\n count(*) as total, \n sum(case when pday >= 0 then 1 else 0 end) as pobs, \n sum(case when snow >= 0 then 1 else 0 end) as sobs, \n sum(case when snowd >= 0 then 1 else 0 end) as sdobs, \n sum(case when max_tmpf > -60 then 1 else 0 end) as tobs \n from summary_{$year} s JOIN stations t on (t.iemid = s.iemid) \n WHERE day >= \$1 and day < (\$1::date + '1 month'::interval) \n and day < 'TOMORROW'::date\n and t.wfo = \$2 and t.network ~* 'COOP' GROUP by id, name ORDER by id ASC");
$tstring = sprintf("%s-%02d-01", $year, intval($month));
$data = pg_execute($dbconn, "MYSELECT", array($tstring, $wfo));
$t->title = "NWS COOP Obs per month per WFO";
$wselect = "";
while (list($key, $value) = each($nt->table)) {
    $wselect .= "<option value=\"{$key}\" ";
    if ($wfo == $key) {
        $wselect .= "SELECTED";
    }
    $wselect .= ">[" . $key . "] " . $nt->table[$key]["name"] . "\n";
}
$ys = yearSelect("2010", $year);
$ms = monthSelect($month);
$table = "";
for ($i = 0; $row = @pg_fetch_assoc($data, $i); $i++) {
    $table .= sprintf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>", $row["id"], $row["name"], $row["total"], $row["pobs"], $row["tobs"], $row["sobs"], $row["sdobs"]);
}
$t->content = <<<EOF
<ol class="breadcrumb">
 <li><a href="/nws/">NWS User Resources</a></li>
 <li class="active">NWS COOP Observation Counts by Month by WFO</li>
</ol>

<p>This application prints out a summary of COOP reports received by the IEM 
on a per month and per WFO basis.  Errors do occur and perhaps the IEM's ingestor
is "missing" data from sites.  Please <a href="/info/contacts.php">let us know</a> of any errors you may suspect!
Пример #6
0
<?php

include "../../../config/settings.inc.php";
include_once "../../../include/myview.php";
include "../../../include/forms.php";
include "../../../include/imagemaps.php";
$t = new MyView();
$t->title = "COOP Data vs Year";
$station = isset($_GET["station"]) ? $_GET["station"] : "";
$year = isset($_GET["year"]) ? $_GET["year"] : date("Y");
$imgurl = sprintf("/cgi-bin/climate/daily.py?plot=compare&station1=%s&year=%s", $station, $year);
$nselect = networkSelect("IACLIMATE", $station);
$yselect = yearSelect(1893, $year);
$t->content = <<<EOF

<p>With this form, you can interactively plot one year vs 
climatology for a station.</p>


<form method="GET" action="vyear_fe.php">

<table>
<tr>
  <th class="subtitle">Station:</th>
  <th class="subtitle">Select Year:</th>
  <td></td>
</tr>

<tr>
<td>
{$nselect}
Пример #7
0
$ar = explode(".", $mode);
$phenomena = $ar[0];
$significance = $ar[1];
$t->title = "NWS Watch/Warning/Advisory + ASOS Observations";
$ar = array("BZ.W" => "Blizzard Warning", "FG.Y" => "Dense Fog Advisory", "FR.Y" => "Frost Advisory", "FZ.W" => "Freeze Warning", "HZ.W" => "Hard Freeze Warning", "HW.W" => "High Wind Warning", "FW.W" => "Red Flag Warning", "WI.Y" => "Wind Advisory", "WC.Y" => "Wind Chill Advisory", "WC.W" => "Wind Chill Warning");
$mselect = make_select("mode", $mode, $ar);
$wselect = "<select name=\"wfo\">\n";
while (list($key, $value) = each($nt->table)) {
    $wselect .= "<option value=\"{$key}\" ";
    if ($wfo == $key) {
        $wselect .= "SELECTED";
    }
    $wselect .= ">[" . $key . "] " . $nt->table[$key]["name"] . "\n";
}
$wselect .= "</select>";
$yselect = yearSelect(2005, $year);
$postgis = iemdb("postgis");
$asos = iemdb("asos");
pg_query($postgis, "SET TIME ZONE 'GMT'");
pg_query($asos, "SET TIME ZONE 'GMT'");
$rs = pg_prepare($postgis, "FIND", "SELECT array_to_string(array_accum(ugc),',')\n\t\tas a, eventid, issue, expire from\n\t\twarnings_{$year} WHERE wfo = \$1 and phenomena =  \$4 and\n\t\tsignificance = \$5 and eventid >= \$2 and eventid < \$3\n\t\tGROUP by issue, expire, eventid ORDER by issue ASC");
$station2ugc = array();
$ugc2station = array();
$rs = pg_prepare($postgis, "STATIONS", "SELECT id, ugc_zone from stations\n  \t\twhere wfo = \$1 and (network ~* 'ASOS' or network = 'AWOS')");
$rs = pg_execute($postgis, "STATIONS", array($wfo));
for ($i = 0; $row = @pg_fetch_assoc($rs, $i); $i++) {
    if (!array_key_exists($row["ugc_zone"], $ugc2station)) {
        $ugc2station[$row["ugc_zone"]] = array();
    }
    $ugc2station[$row["ugc_zone"]][] = $row["id"];
    $station2ugc[$row["id"]] = $row["ugc_zone"];
Пример #8
0
if ($prod == 2) {
    $current = "monthrain";
}
$t->sites_current = $current;
$products = array(0 => "7day_hilo_plot.php", 1 => "month_hilo_plot.php", 2 => "/plotting/month/rainfall_plot.php");
$form = "";
if ($prod == 1 or $prod == 2) {
    $timestamp = mktime(0, 0, 0, $month, 1, $year);
    $lmonth = $timestamp - 5 * 86400;
    $nmonth = $timestamp + 35 * 86400;
    $llink = sprintf("plot.php?prod=%s&amp;station=%s&amp;network=%s&amp;month=%s&amp;year=%s", $prod, $station, $network, date("m", $lmonth), date("Y", $lmonth));
    $nlink = sprintf("plot.php?prod=%s&amp;station=%s&amp;network=%s&amp;month=%s&amp;year=%s", $prod, $station, $network, date("m", $nmonth), date("Y", $nmonth));
    $ltext = date("M Y", $lmonth);
    $ntext = date("M Y", $nmonth);
    $ms = monthSelect($month);
    $ys = yearSelect(2004, $year);
    $form = <<<EOF
<form method="GET" name="changemonth">
 <input type="hidden" name="station" value="{$station}">
 <input type="hidden" name="network" value="{$network}">
 <input type="hidden" name="prod" value="{$prod}">
 <h3>Select month and year:</h3>
 <div class="row">
 <div class="col-sm-3">
 <a href="{$llink}" class="btn btn-default">{$ltext} <i class="glyphicon glyphicon-arrow-left"></i></a>
\t</div>
\t<div class="col-sm-6">
  {$ms} {$ys}
 <input type="submit" value="Generate Plot">
 </div>
 <div class="col-sm-3">