$emonth = isset($_GET['emonth']) ? $_GET['emonth'] : 10; $sday = isset($_GET['sday']) ? $_GET['sday'] : 1; $eday = isset($_GET['eday']) ? $_GET['eday'] : 1; $sts = mktime(0, 0, 0, $smonth, $sday, $year); $ets = mktime(0, 0, 0, $emonth, $eday, $year); if ($ets > time()) { $ets = time(); } $sdate = date("Y-m-d", $sts); $edate = date("Y-m-d", $ets); $s2date = date("2000-m-d", $sts); $e2date = date("2000-m-d", $ets); $today = time(); include "../../../include/database.inc.php"; include "../../../include/station.php"; $st = new StationData($station, $network); $st->load_station($st->table[$station]['climate_site']); $cities = $st->table; $coopdb = iemdb("coop"); $iem = iemdb("access"); $climate_site = $cities[$station]["climate_site"]; if (strrpos($network, "CLIMATE") > 0) { $rs = pg_prepare($coopdb, "SELECT", "SELECT precip as pday, day from \n\talldata_" . substr($climate_site, 0, 2) . "\n\t\tWHERE station = \$1 and day between \$2 and \$3 " . " ORDER by day ASC"); $rs = pg_execute($coopdb, "SELECT", array($station, $sdate, $edate)); } else { $rs = pg_prepare($iem, "SELECT", "SELECT pday, day from summary_{$year} s JOIN stations t\n\tON (t.iemid = s.iemid)\n\t\tWHERE id = \$1 and day between \$2 and \$3 " . "and network = \$4 ORDER by day ASC"); $rs = pg_execute($iem, "SELECT", array($station, $sdate, $edate, $network)); } $obs = array(); $aobs = array(); $zeros = array();
<?php include "../../../config/settings.inc.php"; $station = isset($_GET['station']) ? $_GET['station'] : "DSM"; $network = isset($_GET['network']) ? $_GET['network'] : "IA_ASOS"; $month = isset($_GET['month']) ? $_GET['month'] : date("m"); $year = isset($_GET['year']) ? $_GET['year'] : date("Y"); $ts = mktime(0, 0, 0, $month, 1, $year); $today = time(); include "../../../include/iemaccess.php"; include "../../../include/station.php"; $st = new StationData($station, $network); $cnetwork = sprintf("%sCLIMATE", $st->table[$station]["state"]); $st->load_station($st->table[$station]['climate_site'], $cnetwork); $cities = $st->table; $hasclimate = 1; if ($st->table[$station]['climate_site'] == "") { $hasclimate = 0; } $coopdb = iemdb("coop"); if (substr($network, 2) == "CLIMATE") { $db = iemdb('coop'); $table = sprintf("alldata_%s", substr($network, 0, 2)); $rs = pg_prepare($db, "SELECT", "SELECT high as max_tmpf,\n\t\t\tto_char(day, 'YYYYMMDD') as dvalid, extract(day from day) as day,\n\t\t\tlow as min_tmpf, precip as pday,\n\t\t\tNull as max_tmpf_qc, Null as max_gust,\n\t\t\tnull as min_tmpf_qc from {$table} WHERE\n\t\t\tstation = \$1 and month = {$month} and year = {$year}\n\t\t\tORDER by day ASC"); $rs = pg_execute($db, "SELECT", array($station)); $climate_site = $station; } else { $db = iemdb('iem'); $rs = pg_prepare($db, "SELECTOR", "SELECT pday, extract(day from day) as day from summary_{$year} s, stations t\n\t\t\tWHERE t.id = \$1 and t.network = \$2 and t.iemid = s.iemid and extract(month from day) = \$3 \n\t\t\tORDER by day ASC"); $climate_site = $cities[$station]["climate_site"]; $rs = pg_execute($db, "SELECTOR", array($station, $network, $month));
$emonth = isset($_GET['emonth']) ? $_GET['emonth'] : 10; $sday = isset($_GET['sday']) ? $_GET['sday'] : 1; $eday = isset($_GET['eday']) ? $_GET['eday'] : 1; $sts = mktime(0, 0, 0, $smonth, $sday, $year); $ets = mktime(0, 0, 0, $emonth, $eday, $year); if ($ets > time()) { $ets = time(); } $sdate = date("Y-m-d", $sts); $edate = date("Y-m-d", $ets); $s2date = date("2000-m-d", $sts); $e2date = date("2000-m-d", $ets); $today = time(); include "../../../include/database.inc.php"; include "../../../include/station.php"; $st = new StationData($station, $network); $climate_site = $st->table[$station]['climate_site']; $st->load_station($climate_site); $cities = $st->table; $coopdb = iemdb("coop"); $iem = iemdb("access"); function calcGDD($high, $low) { if ($low < 50) { $low = 50.0; } if ($high > 86) { $high = 86.0; } if ($high < 50) { return 0.0;