diff --git a/php/RemoteDataCenter/IPIM.php b/php/RemoteDataCenter/IPIM.php index 9769f5e..2cdacca 100644 --- a/php/RemoteDataCenter/IPIM.php +++ b/php/RemoteDataCenter/IPIM.php @@ -136,7 +136,7 @@ class IPIM extends SimulationDataCenterClass return $this->getFileName($resourceID); } - public function getData($params) + public function getData($params, $isSpectra = false) { // $r = print_r($params,true); // error_log($params['accessUrl'],3,'/home/budnik/LOG'); diff --git a/php/RemoteDataCenter/LESIA.php b/php/RemoteDataCenter/LESIA.php index 379fb08..4930e78 100644 --- a/php/RemoteDataCenter/LESIA.php +++ b/php/RemoteDataCenter/LESIA.php @@ -300,7 +300,7 @@ class LESIA extends SimulationDataCenterClass $TemplatesXml->save(RemoteData.$this->baseID."/".$this->templateFile); } - public function getData($params) + public function getData($params, $isSpectra = false) { // $r = print_r($params,true); // error_log($r,3,'/home/budnik/LOG'); diff --git a/php/RemoteDataCenter/SimulationDataCenterClass.php b/php/RemoteDataCenter/SimulationDataCenterClass.php index 866d5a0..877341f 100644 --- a/php/RemoteDataCenter/SimulationDataCenterClass.php +++ b/php/RemoteDataCenter/SimulationDataCenterClass.php @@ -445,7 +445,7 @@ class SimulationDataCenterClass extends RemoteDataCenterClass $TemplatesXml->save(RemoteData.$this->baseID.'/'.$this->templateFile); } - protected function createSpecialArgs($dom = null) + protected function createSpecialArgs($dom) { return array(); } diff --git a/php/WebServices/WebServer.php b/php/WebServices/WebServer.php index 6ef6f0a..abaa05e 100644 --- a/php/WebServices/WebServer.php +++ b/php/WebServices/WebServer.php @@ -175,8 +175,6 @@ class WebServer $xpath = new DOMXpath($orbitsXml); $path = '//orbites[@mission="'.$spacecraft.'" and @coordinate_system="'.$orbitRequest['coordinateSystem'].'" and @units="'.$orbitRequest['units'].'" ] '; -error_log($path); - $orbits = $xpath->query($path); foreach ($orbits as $orbit) @@ -199,7 +197,7 @@ error_log($path); "Cannot find orbit data for ".$orbitRequest['spacecraft']." for ".$orbitRequest['startTime']."-".$orbitRequest['stopTime']." in ".$orbitRequest['units']." ".$orbitRequest['coordinateSystem']."($paramStart - $paramStop)"); } - private function doDownloadRequest($interval, $paramList, $formatInfo) + private function doDownloadRequest($interval, $paramList, $formatInfo, $file_info) { if (!isset($this->paramLoader)) $this->paramLoader = new IHMUserParamLoaderClass(); @@ -236,6 +234,8 @@ error_log($path); $params[] = $param; } + $ref_sampling_param = isset($formatInfo['ref_sampling_param']) ? $formatInfo['ref_sampling_param'] : NULL; + $obj = (object)array( "sampling" => $interval['sampling'], "startDate" => $interval['startTime'], @@ -243,7 +243,9 @@ error_log($path); "list" => $params, "fileformat" => $formatInfo['format'], "timeformat" => $formatInfo['timeFormat'], - "compression" => $formatInfo['gzip'] + "compression" => $formatInfo['gzip'], + "ref_sampling_param" => $ref_sampling_param, + "file_info" => $file_info, ); @@ -296,7 +298,7 @@ error_log($path); $locParamSrcDom = new DomDocument("1.0"); $locParamSrcDom->preserveWhiteSpace = FALSE; /// Important !!! otherwise removeChild() leaves empty text nodes - if (!$locParamSrcDom->load($locParamSrc)) + if (!@$locParamSrcDom->load($locParamSrc)) $this->throwError("getObsDataTree", "Cannot load Amda Local DataBase Parameters description file".$this->userID); $xp = new domxpath($locParamSrcDom); @@ -376,10 +378,10 @@ error_log($path); $this->excludePrivateNodes($locParamSrc,$locParamDst); - if (!copy($wsParamSrc, WSConfigClass::getWsResultDir().$wsParamDst)) + if (($this->userID == WSConfigClass::getAnonymousUserName()) || !copy($wsParamSrc, WSConfigClass::getWsResultDir().$wsParamDst)) return array('success' => true,'ParameterList' => array("LocalDataBaseParameters" => WSConfigClass::getUrl().$locParamDst)); - + return array('success' => true,'ParameterList' => array("UserDefinedParameters" => WSConfigClass::getUrl().$wsParamDst, "LocalDataBaseParameters" => WSConfigClass::getUrl().$locParamDst)); @@ -390,7 +392,6 @@ error_log($path); */ public function getParameter($data) { -error_log("BRE =============================> getParameter"); $res = $this->init($data); if (!$res['success']){ @@ -446,7 +447,7 @@ error_log("BRE =============================> getParameter"); $res = $this->doDownloadRequest( array("startTime" => $vars["startTime"], "stopTime" => $vars["stopTime"], "sampling" => $sampling), array("params" => $paramId), - array("format" => $outputFormat, "timeFormat"=> $timeFormat, "gzip"=>$gzip)); + array("format" => $outputFormat, "timeFormat"=> $timeFormat, "gzip"=>$gzip), $paramId); if ($res['success']) return $res; @@ -503,60 +504,52 @@ error_log("BRE =============================> getParameter"); $this->checkInputTime(strtotime($vars["startTime"]),strtotime($vars["stopTime"])); } - if (!$vars["timeFormat"]) { + if (empty($vars["timeFormat"])) { $timeFormat = "ISO8601"; } else { $timeFormat = $vars["timeFormat"]; } - - $dataSetDom = $this->getDatasetInfo($vars['datasetID']); + + if (empty($vars['datasetID'])) { + $this->throwError("requestError", "Missing datasetID definition"); + } + $datasetId = $vars['datasetID']; + $dataSetDom = $this->getDatasetInfo($datasetId); $params = $dataSetDom->getElementsByTagName("parameter"); if ($params->length == 0) - $this->throwError("systemError", "Cannot find parameter list for dataset ".$vars['datasetID']); + $this->throwError("systemError", "Cannot find parameter list for dataset ".$datasetId); $paramId = array(); foreach ($params as $p) $paramId[] = $p->nodeValue; - if (!$vars["sampling"]) + if (empty($vars["sampling"])) { - $sampling = $dataSetDom->getElementsByTagName('min_sampling')->item(0)->nodeValue; - - $units = substr($sampling,-1); - $sampling = substr($sampling,0,strlen($sampling)-1); - - switch ($units) { -// case 'S': -// $sampling = floatval($sampling); -// break; - case 'M': - $sampling = floatval($sampling)*60; - break; - case 'H': - $sampling = floatval($sampling)*60*60; - break; - default: - } + $sampling = NULL; + $ref_sampling_param = $paramId[0]; } else { $sampling = $vars["sampling"]; + $ref_sampling_param = NULL; } - if (!$vars["gzip"]) + if (empty($vars["gzip"])) $gzip = 0; else - $gzip = $vars["gzip"]; + $gzip = ($vars["gzip"] == 1); + + $outputFormat = !empty($vars["outputFormat"]) ? $vars["outputFormat"] : 'ASCII'; $this->service = strtolower(__FUNCTION__); $res = $this->doDownloadRequest( - array("startTime" => $vars["startTime"], "stopTime" => $vars["stopTime"], "sampling" => $sampling), + array("startTime" => $vars["startTime"], "stopTime" => $vars["stopTime"], "sampling" => $sampling, "ref_sampling_param" => $ref_sampling_param), array("params" => $paramId), - array("format" => $vars["outputFormat"], "timeFormat"=> $timeFormat, "gzip"=>$gzip)); + array("format" => $outputFormat, "timeFormat"=> $timeFormat, "gzip"=>$gzip), $datasetId); if ($res['success']) return $res; @@ -693,17 +686,24 @@ error_log("BRE =============================> getParameter"); $this->checkInputTime(strtotime($vars["startTime"]),strtotime($vars["stopTime"])); } - if (!$vars["timeFormat"]) { + if (empty($vars["timeFormat"])) { $timeFormat = "ISO8601"; } else { $timeFormat = $vars["timeFormat"]; } - + + if (empty($vars["spacecraft"])) { + $this->throwError("requestError", "Missing spacecraft definition"); + } $spacecraft = $vars["spacecraft"]; + + if (empty($vars["coordinateSystem"])) { + $this->throwError("requestError", "Missing coordinateSystem definition"); + } $coordinateSystem = $vars["coordinateSystem"]; - if (!$vars["units"]) + if (empty($vars["units"])) $units = "km"; else $units = $vars["units"]; @@ -720,17 +720,21 @@ error_log("BRE =============================> getParameter"); $paramId = array(); array_push($paramId, $orbitParam['parameterID']); - if (!$vars["gzip"]) + if (empty($vars["gzip"])) $gzip = 0; else - $gzip = $vars["gzip"]; + $gzip = ($vars["gzip"] == 1); + + $sampling = !empty($vars["sampling"]) ? $vars["sampling"] : NULL; + + $outputFormat = !empty($vars["outputFormat"]) ? $vars["outputFormat"] : 'ASCII'; - $this->service = strtolower(__FUNCTION__); + $this->service = strtolower(__FUNCTION__); $res = $this->doDownloadRequest( - array("startTime" => $vars["startTime"], "stopTime" => $vars["stopTime"], "sampling" => $vars["sampling"]), + array("startTime" => $vars["startTime"], "stopTime" => $vars["stopTime"], "sampling" => $sampling), array("params" => $paramId), - array("format" => $vars["outputFormat"], "timeFormat"=> $timeFormat, "gzip"=>$gzip)); + array("format" => $outputFormat, "timeFormat"=> $timeFormat, "gzip"=>$gzip), $orbitParam['parameterID']); if ($res['success']) return $res; diff --git a/php/classes/AmdaStats.php b/php/classes/AmdaStats.php index 21522a2..e13e0b4 100644 --- a/php/classes/AmdaStats.php +++ b/php/classes/AmdaStats.php @@ -12,7 +12,8 @@ class AmdaStats { public $usersToExclude = array('bouchemit', 'impex'); public $success = true; private $user = null; - private $task = array('request'=>'plot','condition'=>'mining', 'download'=>'print','statistics'=>'statistics','getparameter'=>'ws_print'); + private $task = array('request'=>'plot','condition'=>'mining', 'download'=>'print','statistics'=>'statistics', + 'getparameter'=>'ws_print', 'getdataset' => 'ws_print', 'getorbites' => 'ws_print'); public function __construct($user) { diff --git a/php/classes/CatalogMgr.php b/php/classes/CatalogMgr.php index 74d390c..f0054a4 100644 --- a/php/classes/CatalogMgr.php +++ b/php/classes/CatalogMgr.php @@ -31,7 +31,7 @@ class CatalogMgr extends TimeTableMgr } - public function loadIntervalsFromObject($id, $type, $start = NULL, $limit = NULL) + public function loadIntervalsFromObject($id, $type = '', $start = NULL, $limit = NULL) { $result = parent::loadIntervalsFromObject($id, $type, $start, $limit); if (!isset($result['success']) || !$result['success']) { diff --git a/php/rest/getParameterList.php b/php/rest/getParameterList.php index 3f2d257..1ffa056 100644 --- a/php/rest/getParameterList.php +++ b/php/rest/getParameterList.php @@ -39,7 +39,7 @@ if ($result['ParameterList']){ foreach($result['ParameterList'] as $key => $value) { - echo "<$key>$value
"; + echo "<$key>$value"; } } else { -- libgit2 0.21.2