当前位置: 首页>>代码示例>>PHP>>正文


PHP iemdb函数代码示例

本文整理汇总了PHP中iemdb函数的典型用法代码示例。如果您正苦于以下问题:PHP iemdb函数的具体用法?PHP iemdb怎么用?PHP iemdb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了iemdb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_iemprop

function get_iemprop($propname)
{
    $dbconn = iemdb("mesosite");
    $rs = pg_prepare($dbconn, "SELECT321" . $propname, "SELECT * from properties where\n        propname = \$1");
    $rs = pg_execute($dbconn, "SELECT321" . $propname, array($propname));
    if (pg_num_rows($rs) < 1) {
        return null;
    }
    $row = pg_fetch_array($rs, 0);
    return $row["propvalue"];
}
开发者ID:muthulatha,项目名称:iem,代码行数:11,代码来源:iemprop.php

示例2: neighbors

function neighbors($station, $lat, $lon)
{
    $con = iemdb("mesosite");
    $rs = pg_prepare($con, "_SELECT", "SELECT *,\n         ST_distance(ST_transform(geom,3857), \n                     ST_transform(ST_GeomFromEWKT('SRID=4326;POINT(" . $lon . " " . $lat . ")'), 3857)) /1000.0 as dist from stations \n         WHERE ST_point_inside_circle(geom, " . $lon . ", " . $lat . ", 0.25) \n         and id != \$1 ORDER by dist ASC");
    $result = pg_execute($con, "_SELECT", array($station));
    $s = "<table class=\"table table-striped\">\n   <thead><tr><th>Distance [km]</th><th>Network</th><th>Station Name</th></tr></thead>";
    for ($i = 0; $row = @pg_fetch_assoc($result, $i); $i++) {
        $s .= sprintf("<tr><td>%.3f</td><td><a href=\"locate.php?network=%s\">%s</a></td><td><a href=\"site.php?station=%s&network=%s\">%s</a></td></tr>", $row["dist"], $row["network"], $row["network"], $row["id"], $row["network"], $row["name"]);
    }
    $s .= "</table>";
    return $s;
}
开发者ID:muthulatha,项目名称:iem,代码行数:12,代码来源:neighbors.php

示例3: get_data2

function get_data2()
{
    global $phenomena, $significance;
    $dbconn = iemdb("postgis");
    $rs = pg_query("\n\t\tWITH data as (\n\t\t\tSELECT distinct wfo, eventid, extract(year from issue) as yr\n\t\t\tfrom warnings where phenomena = '{$phenomena}' and\n\t\t\tsignificance = '{$significance}'\n\t\t)\n\t\tSELECT wfo, yr, count(*) from data GROUP by wfo, yr\n\t");
    $data = array();
    for ($i = 0; $row = @pg_fetch_assoc($rs, $i); $i++) {
        $yr = $row["yr"];
        if (!array_key_exists($yr, $data)) {
            $data[$yr] = array();
        }
        $data[$yr][$row["wfo"]] = $row["count"];
    }
    return $data;
}
开发者ID:muthulatha,项目名称:iem,代码行数:15,代码来源:yearly_counts.php

示例4: NetworkTable

 function NetworkTable($a)
 {
     $this->table = array();
     $this->dbconn = iemdb("mesosite", PGSQL_CONNECT_FORCE_NEW);
     $rs = pg_prepare($this->dbconn, "SELECT", "SELECT *, ST_x(geom) as lon, \n    \tST_y(geom) as lat from stations WHERE network = \$1 ORDER by name ASC");
     $rs = pg_prepare($this->dbconn, "SELECTST", "SELECT *, ST_x(geom) as lon, \n    \tST_y(geom) as lat from stations WHERE id = \$1");
     if (is_string($a)) {
         $this->load_network($a);
     } else {
         if (is_array($a)) {
             foreach ($a as $network) {
                 $this->load_network($network);
             }
         }
     }
 }
开发者ID:muthulatha,项目名称:iem,代码行数:16,代码来源:network.php

示例5: StationData

 function StationData($a, $n = "")
 {
     $this->table = array();
     $this->dbconn = iemdb("mesosite");
     $rs = pg_prepare($this->dbconn, "SELECT  ST1", "SELECT *, " . "ST_x(geom) as lon, ST_y(geom) as lat from stations " . "WHERE id = \$1 and network = \$2");
     $rs = pg_prepare($this->dbconn, "SELECT  ST2", "SELECT *, " . "ST_x(geom) as lon, ST_y(geom) as lat from stations " . "WHERE id = \$1");
     if (is_string($a)) {
         $this->load_station($a, $n);
     } else {
         if (is_array($a)) {
             foreach ($a as $id) {
                 $this->load_station($id, $n);
             }
         }
     }
 }
开发者ID:muthulatha,项目名称:iem,代码行数:16,代码来源:station.php

示例6: download_data

function download_data($sts, $ets)
{
    $dbconn = iemdb('other');
    $rs = pg_prepare($dbconn, "SELECT", "SELECT * from asi_data WHERE\n\t\t\tvalid >= \$1 and valid < \$2 ORDER by valid ASC");
    $rs = pg_execute($dbconn, "SELECT", array(date("Y-m-d", $sts), date("Y-m-d", $ets)));
    header("Content-type: text/plain");
    echo "station,valid,";
    for ($i = 1; $i < 13; $i++) {
        echo sprintf("ch%savg,ch%ssd,ch%smax,ch%smin,", $i, $i, $i, $i);
    }
    echo "\n";
    for ($i = 0; $row = @pg_fetch_assoc($rs, $i); $i++) {
        echo sprintf("%s,%s,", $row['station'], $row['valid']);
        for ($j = 1; $j < 13; $j++) {
            echo sprintf("%s,%s,%s,%s,", $row["ch{$j}avg"], $row["ch{$j}sd"], $row["ch{$j}max"], $row["ch{$j}min"]);
        }
        echo "\n";
    }
}
开发者ID:muthulatha,项目名称:iem,代码行数:19,代码来源:asi.php

示例7: selectNetwork

function selectNetwork($selected, $extra = array())
{
    $selected = strtoupper($selected);
    include_once dirname(__FILE__) . "/database.inc.php";
    $dbconn = iemdb('mesosite');
    $rs = pg_exec($dbconn, "SELECT * from networks ORDER by name ASC");
    $s = "<select name=\"network\">\n";
    reset($extra);
    while (list($idx, $sid) = each($extra)) {
        $s .= "<option value=\"{$idx}\" ";
        if ($selected == $idx) {
            $s .= "SELECTED";
        }
        $s .= ">{$sid}</option>\n";
    }
    for ($i = 0; $row = @pg_fetch_array($rs, $i); $i++) {
        $s .= "<option value=\"" . $row["id"] . "\" ";
        if ($row["id"] == $selected) {
            $s .= "SELECTED";
        }
        $s .= ">" . $row["name"] . "</option>\n";
    }
    return $s;
}
开发者ID:muthulatha,项目名称:iem,代码行数:24,代码来源:imagemaps.php

示例8: define

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");
    $rs = pg_execute($pgconn, "SELECT", array(date("Y-m-d", $day)));
}
$table = <<<EOF
开发者ID:muthulatha,项目名称:iem,代码行数:31,代码来源:clitable.php

示例9: sqrt

    $var = sqrt($sum / (count($std) - 1));
    return round($var, 2);
}
$station = isset($_GET["station"]) ? $_GET['station'] : 'IA0200';
/* Setup start/end dates */
$smonth = isset($_GET['smonth']) ? $_GET['smonth'] : 5;
$sday = isset($_GET['sday']) ? $_GET['sday'] : 1;
$emonth = isset($_GET['emonth']) ? $_GET['emonth'] : 5;
$eday = isset($_GET['eday']) ? $_GET['eday'] : 31;
$sts = mktime(0, 0, 0, $smonth, $sday, 2000);
$ets = mktime(0, 0, 0, $emonth, $eday, 2000);
$stsSQL = date("Y-m-d", $sts);
$etsSQL = date("Y-m-d", $ets);
$subtitle = sprintf("Between %s and %s", date('M d', $sts), date('M d', $ets));
/* Query out the average accumulations during that time */
$coop = iemdb("coop");
pg_prepare($coop, "SELECTOR", "select year, round(sum(precip)::numeric,2) as rain from alldata_ia\n  WHERE extract(doy from day) BETWEEN extract(doy from '{$stsSQL}'::date) and \n  extract(doy from '{$etsSQL}'::date) and station = \$1 and \n  year < extract(year from now()) GROUP by year ORDER by rain ASC");
$rs = pg_execute($coop, "SELECTOR", array($station));
/* Generate plot */
$rowcount = pg_numrows($rs);
$data = array();
$rdata = array();
for ($i = 0; $row = @pg_fetch_array($rs, $i); $i++) {
    if ($i == 0) {
        $lowVal = $row["rain"];
        $lowYear = $row["year"];
    }
    if ($i == $rowcount - 1) {
        $hiVal = $row["rain"];
        $hiYear = $row["year"];
    }
开发者ID:raprasad,项目名称:iem,代码行数:31,代码来源:precip_cdf.php

示例10: header

<?php

header("Content-type: text/plain");
echo 'Title: SchoolNet Where is it raining?
Refresh: 1 
Color: 200 200 255
Font: 1, 11, 1, "Courier New"

';
include "../../../config/settings.inc.php";
include "../../../include/database.inc.php";
include "../../../include/mlib.php";
include "../../../include/network.php";
$nt = new NetworkTable(array("KCCI", "KIMT", "KELO"));
$pgconn = iemdb("access");
$rs = pg_query($pgconn, "select * from events WHERE \n\t\tvalid > now() - '5 minutes'::interval and event = 'P+' ");
for ($i = 0; $row = @pg_fetch_array($rs, $i); $i++) {
    $lat = $nt->table[$row["station"]]["lat"];
    $lon = $nt->table[$row["station"]]["lon"];
    $hover = sprintf("Name: %s\\n15 minute:%s IN", $nt->table[$row["station"]]["name"], $row["magnitude"]);
    echo "Object: " . $lat . "," . $lon . "\n  Text:  0, 0, 1, \"" . $row["magnitude"] . "\", \"{$hover}\"\n End: \n\n";
}
开发者ID:muthulatha,项目名称:iem,代码行数:22,代码来源:snet_raining.php

示例11: putenv

<?php

putenv("TZ=GMT");
include "../../config/settings.inc.php";
include "../../include/database.inc.php";
$mos = iemdb("mos");
pg_exec($mos, "SET TIME ZONE 'GMT'");
$year1 = isset($_GET["year1"]) ? $_GET["year1"] : date("Y", time() + 86400);
$year2 = isset($_GET["year2"]) ? $_GET["year2"] : date("Y", time() + 86400);
$month1 = isset($_GET["month1"]) ? $_GET["month1"] : date("m", time() + 86400);
$month2 = isset($_GET["month2"]) ? $_GET["month2"] : date("m", time() + 86400);
$day1 = isset($_GET["day1"]) ? $_GET["day1"] : date("d", time() + 86400);
$day2 = isset($_GET["day2"]) ? $_GET["day2"] : date("d", time() + 86400);
$hour1 = isset($_GET["hour1"]) ? $_GET["hour1"] : 0;
$hour2 = isset($_GET["hour2"]) ? $_GET["hour2"] : 12;
$model = isset($_GET["model"]) ? $_GET["model"] : "GFS";
$station = isset($_GET["station"]) ? strtoupper($_GET["station"]) : "KAMW";
$sts = mktime($hour1, 0, 0, $month1, $day1, $year1);
$ets = mktime($hour2, 0, 0, $month2, $day2, $year2);
$table = "alldata";
if ($year1 == $year2) {
    $table = sprintf("t%s", $year1);
}
$rs = pg_prepare($mos, "SELECTOR", "select *, t06_1 ||'/'||t06_2 as t06, \n                 t12_1 ||'/'|| t12_2 as t12  from {$table} WHERE station = \$1\n                 and runtime >= \$2 and runtime <= \$3 and \n                 (model = \$4 or model = \$5)\n                 ORDER by runtime,ftime ASC");
if ($model == "NAM") {
    $model2 = "ETA";
}
if ($model == "GFS") {
    $model2 = "AVN";
}
$rs = pg_execute($mos, "SELECTOR", array($station, date("Y-m-d H:i", $sts), date("Y-m-d H:i", $ets), $model, $model2));
开发者ID:muthulatha,项目名称:iem,代码行数:31,代码来源:dl.php

示例12: iemdb

$snet->set("status", MS_ON);
$iards = $map->getlayerbyname("iards");
$iards->set("status", MS_ON);
$bar640t = $map->getlayerbyname("bar640t");
$bar640t->set("status", MS_ON);
$ponly = $map->getlayerbyname("pointonly");
$ponly->set("status", MS_ON);
$states = $map->getlayerbyname("states");
$states->set("status", MS_ON);
$img = $map->prepareImage();
$counties->draw($img);
$states->draw($img);
$iards->draw($img);
$bar640t->draw($img);
$c = iemdb("isuag");
$climatedb = iemdb("coop");
$sstr = strftime("%Y-%m-%d", $gs_start);
$estr = strftime("%Y-%m-%d", $gs_end);
$cStart = "2000" . strftime("-%m-%d", $gs_start);
$cEnd = "2000" . strftime("-%m-%d", $gs_end);
$sstr_txt = strftime("%b %d", $gs_start);
$estr_txt = strftime("%b %d", $gs_end);
function gdd($high, $low, $ceiling, $floor)
{
    if ($low < $floor) {
        $low = $floor;
    }
    if ($high > $ceiling) {
        $high = $ceiling;
    }
    if ($high < $floor) {
开发者ID:muthulatha,项目名称:iem,代码行数:31,代码来源:gsplot.php

示例13: iemdb

<?php

include "../../config/settings.inc.php";
include "../../include/database.inc.php";
$con = iemdb("postgis");
$sql = "SELECT max(valid) as valid from roads_current";
$rs = pg_query($con, $sql);
$row = pg_fetch_array($rs, 0);
$valid = substr($row["valid"], 0, 16);
$map = ms_newMapObj('roads.map');
//$map->setProjection("init=epsg:4326");
$map->setProjection("init=epsg:26915");
$map->selectOutputFormat("jpeg");
$map->setextent(122487.56, 4443095.235, 809431.656, 4919662.5);
$map->set("width", 720);
$map->set("height", 496);
$img = $map->prepareImage();
$background = $map->getlayerbyname("kwwlback");
$background->set("status", MS_ON);
$background->set("data", "images/26915/kcau.tif");
$background->draw($img);
//$counties = $map->getlayerbyname("counties");
//$counties->set("status", MS_ON);
//$counties->draw($img);
//$states = $map->getlayerbyname("states");
//$states->set("status", MS_ON);
//$states->draw($img);
$roads = $map->getlayerbyname("roads");
$roads->set("status", MS_ON);
if (isset($_GET["extreme"])) {
    $roads->set("data", "geom from (select b.type as rtype, b.int1, b.oid as boid, b.segid, c.cond_code, b.geom from roads_base b, roads_2007_log c WHERE b.segid = c.segid and c.valid = '2007-03-02 00:11' and b.type > 1  ORDER by b.segid DESC) as foo using UNIQUE boid using SRID=26915");
开发者ID:muthulatha,项目名称:iem,代码行数:31,代码来源:kcau.php

示例14: isset

<?php

include "../../config/settings.inc.php";
include "../../include/database.inc.php";
/* We need to get some CGI vars! */
$year = isset($_GET['year']) ? $_GET['year'] : die;
$month = isset($_GET['month']) ? $_GET['month'] : die;
$day = isset($_GET['day']) ? $_GET['day'] : die;
$pvar = isset($_GET['pvar']) ? $_GET['pvar'] : die;
$sts = mktime(0, 0, 0, $month, $day, $year);
$vars = array();
$pgconn = iemdb("other");
$sql = "SELECT * from flux_vars ORDER by details ASC";
$rows = pg_exec($pgconn, $sql);
for ($i = 0; $row = @pg_fetch_array($rows, $i); $i++) {
    $vars[$row["name"]] = array("units" => $row["units"], "details" => $row["details"]);
}
$rs = pg_prepare($pgconn, "SELECT", "SELECT * from flux_data WHERE\n      valid >= \$1 and valid < (\$1 + '1 day'::interval) \n\t  and {$pvar} IS NOT NULL ORDER by valid ASC");
$rs = pg_prepare($pgconn, "METADATA", "SELECT * from flux_meta WHERE \n      sts < \$1 and ets > \$1");
$rs = pg_execute($pgconn, "SELECT", array(date('Y-m-d', $sts)));
$data = array("NSTL11" => array(), "NSTL10" => array(), "NSTL30FT" => array(), "NSTL110" => array(), "NSTLNSPR" => array());
$times = array("NSTL11" => array(), "NSTL10" => array(), "NSTL30FT" => array(), "NSTL110" => array(), "NSTLNSPR" => array());
for ($i = 0; $row = @pg_fetch_array($rs, $i); $i++) {
    $ts = strtotime(substr($row["valid"], 0, 16));
    $stid = $row["station"];
    $val = floatval($row[$pvar]);
    if ($val > -90000) {
        $data[$stid][] = floatval($row[$pvar]);
        $times[$stid][] = $ts;
    }
}
开发者ID:bthoover,项目名称:iem,代码行数:31,代码来源:plot.php

示例15: sprintf

    $windhail = "";
    if ($warn["windtag"] != null) {
        $windhail = sprintf("<br />H: %s\"<br />W: %s", $warn["hailtag"], $warn["windtag"]);
    }
    $s = sprintf("<tr><td style=\"background: %s;\"><a href=\"%s\">%s.%s</a>%s</td>\n  \t\t<td>%s</td><td>%s</td>\n  \t\t<td colspan=\"2\"><a href=\"%s\" target=\"_new\">%s</a></td>\n  \t\t<td><a href=\"%s\">%s</a></td><td>%.0f sq km</td>\n  \t\t<td>%.0f sq km</td><td>%.0f %%</td>\n  \t\t<td>%.0f%% <a href=\"/GIS/radmap.php?layers[]=legend&layers[]=ci&layers[]=cbw&layers[]=sbw&layers[]=uscounties&layers[]=bufferedlsr&vtec=%s.K%s.%s.%s.%04d&lsrbuffer=%s\">Visual</a></td>\n  \t\t<td>%s</td></tr>\n", $background, $uri, $warn["phenomena"], $warn["eventid"], $windhail, gmdate("m/d/Y H:i", $warn["sts"]), gmdate("m/d/Y H:i", $warn["expire"]), $uri, implode(", ", $warn["ugcname"]), $uri, $warn["status"], $warn["parea"], $warn["carea"], ($warn["carea"] - $warn["parea"]) / $warn["carea"] * 100, $bratio, date("Y", $ts), $warn["wfo"], $warn["phenomena"], $warn["significance"], $warn["eventid"], $lsrbuffer, clean_area_verify($warn["buffered"], $warn["parea"]));
    reset($warn["lsrs"]);
    if (sizeof($warn["lsrs"]) == 0 && $warn["verify"]) {
        $s .= "<tr><td></td><td colspan=\"10\">The warning above had one or more local\n  \t\t\tstorm reports that were within previously issued warnings and are\n  \t\t\tnot double counted here.  Thus the warning appears as verified,\n  \t\t\tbut no local storm reports are shown. Future code improvements may \n  \t\t\tbe added to the Cow to better account for these.</td></tr>";
    }
    while (list($k, $lsr) = each($warn["lsrs"])) {
        $s .= printLSR($cow->lsrs[$lsr]);
    }
    return $s;
}
include_once "../../include/cow.php";
$cow = new Cow(iemdb("postgis"));
$cow->setLimitWFO(array($wfo));
$cow->setLimitTime($sts, $ets);
$cow->setHailSize($hail);
$cow->setWind($wind);
$cow->setLimitType($wtype);
$cow->setLimitLSRType($ltype);
$cow->setLSRBuffer($lsrbuffer);
$cow->setWarningBuffer($warnbuffer);
if (isset($useWindHailTag) && $useWindHailTag == 'Y') {
    $cow->useWindHailTag = true;
}
if (isset($limitwarns) && $limitwarns == 'Y') {
    $cow->limitwarns = true;
}
$cow->milk();
开发者ID:muthulatha,项目名称:iem,代码行数:31,代码来源:worker.php


注:本文中的iemdb函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。