Example #1
0
File: obs.php Project: raprasad/iem
    }
    $mydata[$key]["feel"] = feels_like($mydata[$key]["tmpf"], $mydata[$key]["relh"], $mydata[$key]["sped"]);
    if ($mydata[$key]["max_gust"] > $mydata[$key]["max_sknt"]) {
        $mydata[$key]["peak"] = $mydata[$key]["max_gust"];
        $mydata[$key]["peak_ts"] = strtotime(substr($mydata[$key]["lmax_gust_ts"], 0, 16));
    } else {
        $mydata[$key]["peak"] = $mydata[$key]["max_sknt"];
        $mydata[$key]["peak_ts"] = 0;
        if ($mydata[$key]["max_sknt_ts"] > 0) {
            $mydata[$key]["peak_ts"] = strtotime(substr($mydata[$key]["lmax_sknt_ts"], 0, 16));
        }
    }
}
$table = "";
$finalA = array();
$finalA = aSortBySecondIndex($mydata, $sortcol);
$now = time();
$i = 0;
while (list($key, $val) = each($finalA)) {
    $i++;
    $parts = $finalA[$key];
    $table .= "<tr";
    if ($i % 2 == 0) {
        $table .= " bgcolor='#eeeeee'";
    }
    $table .= "><td><input type=\"checkbox\" name=\"st[]\" value=\"" . $key . "\"></td>";
    $tdiff = $now - $parts["ts"];
    $moreinfo = sprintf("/sites/site.php?station=%s&network=%s", $key, $parts["network"]);
    $table .= "<td>" . $parts["sname"] . " (<a href=\"{$moreinfo}\">" . $key . "</a>," . $parts["network"] . ")</td>";
    $table .= "<td ";
    if ($tdiff > 10000) {
Example #2
0
} else {
    if ($sortcol == 'valid') {
        $sortcol = 'station';
    }
    $jdata = file_get_contents("http://iem.local/geojson/climodat_dayclimo.py?network={$network}&month={$month}&day={$day}&syear={$syear}&eyear={$eyear}");
    $URI = sprintf("http://mesonet.agron.iastate.edu/geojson/climodat_dayclimo.py?network={$network}&month={$month}&day={$day}&syear={$syear}&eyear={$eyear}");
    $json = Zend_Json::decode($jdata);
    $data = array();
    $table = "";
    while (list($key, $val) = each($json['features'])) {
        $data[] = $val['properties'];
    }
    if ($sortdir == 'ASC') {
        $sorted_data = sortBySecondIndex($data, $sortcol);
    } else {
        $sorted_data = aSortBySecondIndex($data, $sortcol);
    }
    while (list($key, $val) = each($sorted_data)) {
        $link = sprintf("extremes.php?station=%s&amp;network=%s&amp;tbl=%s", $val["station"], $network, $tbl);
        $table .= sprintf("<tr><td><a href=\"%s\">%s</a> (%s)</td><td>%s</td>\n \t\t\t\t<td>%.1f</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>\n \t\t\t\t<td></td>\n \t\t\t\t<td>%.1f</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>\n \t\t\t\t<td></td>\n \t\t\t\t<td>%.2f</td><td>%.2f</td><td>%s</td>\n \t\t\t\t</tr>", $link, $cities[$val["station"]]['name'], $val["station"], $val["years"], $val["avg_high"], $val["max_high"], implode(", ", $val["max_high_years"]), $val["min_high"], implode(", ", $val["min_high_years"]), $val["avg_low"], $val["max_low"], implode(", ", $val["max_low_years"]), $val["min_low"], implode(", ", $val["min_low_years"]), $val["avg_precip"], $val["max_precip"], implode(", ", $val["max_precip_years"]));
    }
    $h3 = "<h3>NWS COOP Climatology for " . date("d F", $valid) . "</h3>";
}
$ar = array("ILCLIMATE" => "Illinois", "INCLIMATE" => "Indiana", "IACLIMATE" => "Iowa", "KSCLIMATE" => "Kansas", "KYCLIMATE" => "Kentucky", "MICLIMATE" => "Michigan", "MNCLIMATE" => "Minnesota", "MOCLIMATE" => "Missouri", "NECLIMATE" => "Nebraska", "NDCLIMATE" => "North Dakota", "OHCLIMATE" => "Ohio", "SDCLIMATE" => "South Dakota", "WICLIMATE" => "Wisconsin");
$netselect = make_select("network", $network, $ar);
$mselect = monthSelect($month, "month");
$dselect = daySelect($day, "day");
$ar = array("climate" => "All Available", "climate51" => "Since 1951", "climate71" => "1971-2000", "climate81" => "1981-2010");
$tblselect = make_select("tbl", $tbl, $ar);
$sortdir2 = $sortdir == 'ASC' ? 'DESC' : 'ASC';
if ($station != null) {