예제 #1
0
            }
        }
    }
    $d['station'] = $stations[$i];
    array_push($data, $d);
}
date_default_timezone_set('UTC');
$t = '';
// assume same time for all obs
$o = array();
foreach ($data as $d) {
    foreach ($d as $k => $v) {
        if ($k != 'DateTimeStamp' && $k != 'station') {
            $dEnd = date('m/d/Y H:i');
            $dBegin = date('m/d/Y H:i', time() - 60 * 60 * (24 * 1 + 1));
            $a = convertUnits($v, nerrsUnits($k), $_REQUEST['uom'] == 'english');
            $u = $a[0]["uom"];
            $v = $a[0]["val"];
            $uEscape = str_replace('"', '\\"', "graph.php?name={$k}&tz=" . $_REQUEST['tz'] . '&uom=' . $_REQUEST['uom'] . '&lon=' . $_REQUEST['lon'] . '&lat=' . $_REQUEST['lat'] . '&cat=' . $a[0]['cat'] . "&NERRS=" . $d['station'] . "&startDt={$dBegin}&endDt={$dEnd}");
            $extra = '';
            if (count($a) == 2) {
                $extra = "<br><a href='javascript:showObsTimeseries([\"" . str_replace('graph.php?', 'graph.php?uomB&', $uEscape) . "\"])'><img src='img/graph.png' width=10 height=10></a> " . $a[1]["val"] . ' ' . $a[1]["uom"];
            }
            array_push($o, sprintf("<tr><td><b>%s</b></td><td><a href='javascript:showObsTimeseries([\"{$uEscape}\"])'><img src='img/graph.png' width=10 height=10></a> {$v} {$u}{$extra}</td></tr>", $k));
        }
    }
}
if (count($data) > 0) {
    $t = $data[0]['DateTimeStamp'];
}
if ($t == '') {
예제 #2
0
                    $v = $newVal[1]['val'];
                    $uom = $newVal[1]['uom'];
                }
                $data[$t] = $v;
            }
        }
    }
} else {
    if (isset($_REQUEST['NERRS'])) {
        require_once '/usr/local/nusoap/lib/nusoap.php';
        nusoap_base::setGlobalDebugLevel(0);
        $wsdl = new nusoap_client('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
        $result = $wsdl->call('exportAllParamsDateRangeXML', array('tbl' => $_REQUEST['NERRS'], 'mindate' => $_REQUEST['startDt'], 'maxdate' => $_REQUEST['endDt'], 'fieldlist' => $_REQUEST['name']));
        $d2 = array();
        $col2idx = array();
        $uomOrig = nerrsUnits($_REQUEST['name']);
        foreach ($result['nds']['data']['r'] as $r) {
            $d = array();
            // figure out the col mapping
            if (count($col2idx) == 0) {
                foreach ($r['c'] as $c) {
                    array_push($col2idx, $c['!v']);
                }
            } else {
                foreach ($r['c'] as $c) {
                    if (rtrim($c['!v']) != 'null') {
                        $d[$col2idx[count($d)]] = rtrim($c['!v']);
                    }
                }
            }
            array_push($d2, $d);