$db = "isuag"; $sql = sprintf("SELECT *, null as pres, null as raw\n\t\tfrom alldata where \n\t\tstation = \$1 and valid >= \$3 and valid < \$4 \n\t\tand \$2 = \$2 ORDER by valid DESC"); } else { $db = "asos"; $sql = sprintf("SELECT *, mslp as pres, metar as raw, p01i as phour,\n\t\t\t\tnull as relh\n\t\t\t\tfrom alldata where\n\t\t\t\tstation = \$1 and valid >= \$3 and valid < \$4\n\t\t\t\tand \$2 = \$2 ORDER by valid DESC"); } } } $dbconn = iemdb($db); pg_query($dbconn, "SET TIME ZONE '" . $metadata["tzname"] . "'"); $rs = pg_prepare($dbconn, "_MYSELECT", $sql); $rs = pg_execute($dbconn, "_MYSELECT", array($station, $network, date("Y-m-d", $date), date("Y-m-d", $date + 90400))); $table = ""; for ($i = 0; $row = @pg_fetch_assoc($rs, $i); $i++) { if ($row['dwpf'] == null && $row['relh'] != null) { $row['dwpf'] = dwpf($row["tmpf"], $row["relh"]); } $table .= formatter($i, $row); } pg_close($dbconn); include "../../include/myview.php"; $t = new MyView(); $t->thispage = "iem-sites"; $t->title = "Observation History"; $t->sites_current = 'obhistory'; $savevars = array("year" => date("Y", $date), "month" => date("m", $date), "day" => date("d", $date)); $t->jsextra = <<<EOF <script type="text/javascript"> var hide = false; function hideMetars(){ \tvar table = document.getElementById("datatable");
temp, inside humidity, solar radiation, UV index */ while (list($line_num, $line) = each($fcontents)) { $tokens = explode(' ', $line); if (sizeof($tokens) != 21) { continue; } $tstring = sprintf("%s %s %s %s", $tokens[0], $tokens[1], $tokens[2], $tokens[3]); $v = strtotime($tstring); if ($v < $myTime || trim($tstring) == "") { continue; } $valid[] = $v; $tmpf[] = $tokens[5]; $relh[] = floatval($tokens[8]); $dwpf[] = dwpf($tokens[5], floatval($tokens[8])); } // End of while } include "../../../include/jpgraph/jpgraph.php"; include "../../../include/jpgraph/jpgraph_line.php"; include "../../../include/jpgraph/jpgraph_date.php"; // Create the graph. These two calls are always required $graph = new Graph(600, 300, "example1"); $graph->SetScale("datlin"); if (isset($_REQUEST["rh"])) { $graph->SetY2Scale("lin", 0, 100); $graph->y2axis->SetTitle("Relative Humidity [%]"); $graph->y2axis->title->SetFont(FF_FONT1, FS_BOLD, 12); $graph->title->Set("{$titleDate} Outside Temperature & Relative Humidity"); } else {
temp, inside humidity, solar radiation, UV index */ while (list($line_num, $line) = each($fcontents)) { $tokens = explode(' ', $line); if (sizeof($tokens) != 21) { continue; } $tstring = sprintf("%s %s %s %s", $tokens[0], $tokens[1], $tokens[2], $tokens[3]); $v = strtotime($tstring); if ($v < $myTime || trim($tstring) == "") { continue; } $valid[] = $v; $tmpf[] = $tokens[17]; $relh[] = $tokens[18]; $dwpf[] = dwpf($tokens[17], $tokens[18]); } // End of while } include "../../../include/jpgraph/jpgraph.php"; include "../../../include/jpgraph/jpgraph_line.php"; include "../../../include/jpgraph/jpgraph_date.php"; // Create the graph. These two calls are always required $graph = new Graph(600, 300, "example1"); $graph->SetScale("datelin"); //$graph->SetY2Scale("lin",0,100); $graph->img->SetMargin(65, 40, 55, 70); $graph->xaxis->SetLabelAngle(90); //$graph->yaxis->scale->ticks->SetPrecision(1); $graph->yaxis->scale->ticks->Set(1, 0.5); //$graph->yscale->SetGrace(10);
temp, inside humidity, solar radiation, UV index */ while (list($line_num, $line) = each($fcontents)) { $tokens = explode(' ', $line); if (sizeof($tokens) != 21) { continue; } $tstring = sprintf("%s %s %s %s", $tokens[0], $tokens[1], $tokens[2], $tokens[3]); $v = strtotime($tstring); if ($v < $myTime || trim($tstring) == "") { continue; } $valid[] = $v; $orelh[] = floatval($tokens[8]); $irelh[] = $tokens[18]; $_dwpf[] = dwpf(floatval($tokens[5]), floatval($tokens[8])); } // End of while } include "../../../include/jpgraph/jpgraph.php"; include "../../../include/jpgraph/jpgraph_line.php"; include "../../../include/jpgraph/jpgraph_scatter.php"; include "../../../include/jpgraph/jpgraph_date.php"; // Create the graph. These two calls are always required $graph = new Graph(600, 300, "example1"); $graph->SetScale("datelin", 0, 100); $graph->img->SetMargin(65, 40, 55, 70); //$graph->yaxis->scale->ticks->SetPrecision(1); $graph->title->Set("{$titleDate} Relative Humidity"); $graph->legend->SetLayout(LEGEND_HOR); $graph->legend->Pos(0.01, 0.08);