diff --git a/js/app/models/RemoteSimuParamNode.js b/js/app/models/RemoteSimuParamNode.js index aa47137..15c5977 100644 --- a/js/app/models/RemoteSimuParamNode.js +++ b/js/app/models/RemoteSimuParamNode.js @@ -58,124 +58,146 @@ Ext.define('amdaModel.RemoteSimuParamNode', { }, - allMenuItems : function() { - var menuItems = - [ { - fnId : 'root-collapseAll', - text : 'Close All' - }, { - fnId : 'dire-collapseAll', - text : 'Close All' - },{ - fnId : 'leaf-createAlias', - text : 'Create/Edit Alias' - }, { - fnId : 'leaf-createDerivedParam', - text : 'Create Derived Parameter' - } - ]; - - return menuItems; - }, + allMenuItems : function() + { + var menuItems = + [ { + fnId : 'root-collapseAll', + text : 'Close All' + }, + { + fnId : 'dire-collapseAll', + text : 'Close All' + }, + { + fnId : 'leaf-createAlias', + text : 'Create/Edit Alias' + }, + { + fnId : 'leaf-createDerivedParam', + text : 'Create Derived Parameter' + }, + { + fnId : 'leaf-plotParam', + text : 'Plot Parameter', + hidden : true + }, + { + fnId : 'leaf-downParam', + text : 'Download Parameter', + hidden : true + } + ]; + + return menuItems; + }, - getAllContextMenuItems: function() - { - // TODO use 'isAddable' attribute - if (this.get('isAddable')) - return Ext.Array.push(this.allMenuItems(), - { fnId : 'dire-addData', - text : 'Add Run'}); - else if (this.get('isDeletable')) - return Ext.Array.push(this.allMenuItems(), - { fnId : 'dire-deleteNode', - text : 'Delete Run'}); - - return this.allMenuItems(); - - }, - - onMenuItemClick : function(menu, item, event) { - - if (item) { - switch (item.fnId) { - - case 'root-collapseAll': - case 'dire-collapseAll': - if(this && !this.isLeaf()) { - this.collapse(true); - } - break; - case 'leaf-createDerivedParam': - this.createLeaf(this); - break; - case 'leaf-createAlias': - this.createAlias(this); - break; - case 'dire-deleteNode' : - this.deleteData(); - break; - case 'dire-addData': - case 'root-addData': - this.addData(); - break; - default: - break; - } - } - }, + getAllContextMenuItems: function() + { + // TODO use 'isAddable' attribute + if (this.get('isAddable')) + return Ext.Array.push(this.allMenuItems(), + { fnId : 'dire-addData', + text : 'Add Run'}); + else if (this.get('isDeletable')) + return Ext.Array.push(this.allMenuItems(), + { fnId : 'dire-deleteNode', + text : 'Delete Run'}); + + return this.allMenuItems(); + }, + + onMenuItemClick : function(menu, item, event) + { + if (item) + { + switch (item.fnId) + { + case 'root-collapseAll': + case 'dire-collapseAll': + if(this && !this.isLeaf()) { + this.collapse(true); + } + break; + case 'leaf-createDerivedParam': + this.createLeaf(this); + break; + case 'leaf-createAlias': + this.createAlias(this); + break; + case 'dire-deleteNode' : + this.deleteData(); + break; + case 'dire-addData': + case 'root-addData': + this.addData(); + break; + case 'leaf-plotParam': + case 'para-plotParam': + this.createPlot(this); + break; + case 'leaf-downParam': + case 'para-downParam': + this.createDownload(this); + break; + default: + break; + } + } + }, - deleteData : function() { - var parent = this.parentNode; - AmdaAction.deleteFromTree({nodeType: this.get('nodeType'), id : this.get('id')}, function(res,e){ - //TODO if () not error ?? - this.remove(); - this.destroy(); - },this); - }, + deleteData : function() + { + var parent = this.parentNode; + AmdaAction.deleteFromTree({nodeType: this.get('nodeType'), id : this.get('id')}, function(res,e){ + //TODO if () not error ?? + this.remove(); + this.destroy(); + },this); + }, - addData : function() { - - if (this.get('disable')) return; - - var win = myDesktopApp.desktop.getWindow('impex-win'); - if(!win) - { - var win = myDesktopApp.desktop.createWindow( - { - border: false, - id : 'impex-win', - title : 'Find the most relevant run(s)', - width : 600, - height : 600, - layout : 'border', - //autoScroll: true, - overflowY: 'scroll', - maximizable : false, - items : - [{ - xtype : 'interop_impex', - region : 'center', - margins : - { - top: 0, - right: 5, - bottom: 5, - left: 5 - } - }], - listeners: { - scope : this, - show : function( ) { - win.items.getAt(0).setLinkedNode(this); - } - } - }); - } - else - { - - } - win.show(); - } - + addData : function() + { + if (this.get('disable')) return; + var win = myDesktopApp.desktop.getWindow('impex-win'); + + if(!win) + { + var win = myDesktopApp.desktop.createWindow( + { + border: false, + id : 'impex-win', + title : 'Find the most relevant run(s)', + width : 600, + height : 600, + layout : 'border', + //autoScroll: true, + overflowY: 'scroll', + maximizable : false, + items : + [{ + xtype : 'interop_impex', + region : 'center', + margins : + { + top: 0, + right: 5, + bottom: 5, + left: 5 + } + }], + listeners: { + scope : this, + show : function( ) { + win.items.getAt(0).setLinkedNode(this); + } + } + }); + } + else + { + + } + win.show(); + } }); diff --git a/php/classes/BuildVOTable.php b/php/classes/BuildVOTable.php deleted file mode 100644 index 8819470..0000000 --- a/php/classes/BuildVOTable.php +++ /dev/null @@ -1,633 +0,0 @@ -<?php -/** - * @class BuildVOTable - * @version $Id: BuildVOTable.php 2795 2015-02-27 15:42:55Z elena $ - * - * - */ - -class BuildVOTable -{ - function __construct() - { - - } - - private function WriteDescription($f,$description) - { - //$description = str_replace('<', '<', $description); - //$description = str_replace('>', '>', $description); - fputs($f,"<DESCRIPTION>"); - fputs($f,htmlentities($description)); - fputs($f,"</DESCRIPTION>\n"); - } - - private function WriteField($f,$field,$refgroupid) - { -if (!strstr($field['id'], 'xyz')){ - $str = "<FIELD datatype='".$field['data_type']."'"; - $str .= " ID='".$field['id']."'"; - $str .= " name='".$field['name']."'"; - if (isset($field['xtype']) && ($field['xtype'] != '')) - $str .= " xtype='".$field['xtype']."'"; - if (isset($field['array_size']) && ($field['array_size'] != '')) - $str .= " arraysize='".$field['array_size']."'"; - if (isset($field['unit']) && ($field['unit'] != '')) - $str .= " unit='".$field['unit']."'"; - $str .= " ucd='".$field['ucd']."'"; - if (isset($refgroupid)) - $str .= " ref='".$refgroupid."'"; - $str .= ">\n"; - fputs($f,$str); - $this->WriteDescription($f,$field['field_des']); - fputs($f,"<VALUES null='".$field['fill_val']."'/>\n"); - fputs($f,"</FIELD>\n"); -} -//TODO delete else after integration by LATMOS vecteurs in VOtable -else { - if ($field['comps_label'] == "X;Y;Z") - $attributes = explode(';', $field['comps_label']); - else - $attributes = preg_split ("/\s+/", $field['comps_label']); - $a = 1; - foreach($attributes as $attr){ - $str = "<FIELD datatype='".$field['data_type']."'"; - $str .= " ID='".strtoupper($attr)."'"; - $str .= " name='".strtoupper($attr)."'"; - if (isset($field['xtype']) && ($field['xtype'] != '')) - $str .= " xtype='".$field['xtype']."'"; -// if (isset($field['array_size']) && ($field['array_size'] != '')) -// $str .= " arraysize='".$field['array_size']."'"; - if (isset($field['unit']) && ($field['unit'] != '')) - $str .= " unit='".$field['unit']."'"; - if (strstr($attr,'x_')) - $attr = 'x'; - elseif (strstr($attr,'y_')) - $attr = 'y'; - elseif (strstr($attr,'z_')) - $attr = 'z'; - $str .= " ucd='pos.cartesian.".$attr."'"; - $str .= " utype='stc:AstroCoords.Position3D.Value3.C".$a."'"; -// if (isset($refgroupid)) -// $str .= " ref='".$refgroupid."'"; - $str .= ">\n"; - fputs($f,$str); - $this->WriteDescription($f,$field['field_des']); - fputs($f,"<VALUES null='".$field['fill_val']."'/>\n"); - fputs($f,"</FIELD>\n"); - $a++; - } -} - } - - private function WriteInfoGroup($f,$field) - { - if (!isset($field['array_size'])) - return NULL; - if (($field['array_size'] == '') || ($field['array_size'] == '*')) - return NULL; - $array_size = intval($field['array_size']); - if ($array_size < 2) - return NULL; -// TODO delete after VOTable group implementation by LATMOS and Co - if (strstr($field['id'], 'xyz')) - return NULL; -// end delete - $group_id = "info_".$field['id']; - - $str = "<GROUP ID='".$group_id."'>\n"; - - //"param_".$field['id']."_"info - - $str .= "<PARAM name='components_".$field['name']."'"; - $str .= " ID='components_".$field['id']."'"; - $str .= " datatype='char' arraysize='*'"; - $str .= " value='".$field['comps_label']."'"; - $str .= "/>\n"; - $str .= "</GROUP>\n"; - - fputs($f,$str); - return $group_id; - } - - private function getTimeValue($line,$timeFormat,$milli) - { - $iso = ""; - $srclen = 0; - if (strcmp($timeFormat,'YYYY MM DD hh mm ss') === 0) - { - if ($milli == '1') - { - sscanf($line,"%04d %02d %02d %02d %02d %02d %03d",$y,$mo,$d,$h,$mi,$s,$ml); - $iso = sprintf("%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",$y,$mo,$d,$h,$mi,$s,$ml); - $srclen = 23; - } - else - { - sscanf($line,"%04d %02d %02d %02d %02d %02d",$y,$mo,$d,$h,$mi,$s); - $iso = sprintf("%04d-%02d-%02dT%02d:%02d:%02d.000Z",$y,$mo,$d,$h,$mi,$s); - $srclen = 19; - } - } - else if (strcmp($timeFormat,'DD MM YYYY hh mm ss') === 0) - { - if ($milli == '1') - { - sscanf($line,"%02d %02d %04d %02d %02d %02d %03d",$d,$mo,$y,$h,$mi,$s,$ml); - $iso = sprintf("%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",$y,$mo,$d,$h,$mi,$s,$ml); - $srclen = 23; - } - else - { - sscanf($line,"%02d %02d %04d %02d %02d %02d",$d,$mo,$y,$h,$mi,$s); - $iso = sprintf("%04d-%02d-%02dT%02d:%02d:%02d.000Z",$y,$mo,$d,$h,$mi,$s); - $srclen = 19; - } - } - else if (strcmp($timeFormat,'YYYY DDD hh mm ss') === 0) - { - if ($milli == '1') - { - sscanf($line,"%04d %03d %02d %02d %02d %03d",$y,$nday,$h,$mi,$s,$ms); - $offset = ($nday-1) * 86400; - $str = date('Y-m-d', strtotime('Jan 1, '. $y) + $offset); - $iso = sprintf("%sT%02d:%02d:%02d.%03dZ",$str,$h,$mi,$s,$ms); - $srclen = 21; - } - else - { - sscanf($line,"%04d %03d %02d %02d %02d",$y,$nday,$h,$mi,$s); - $offset = ($nday-1) * 86400; - $str = date('Y-m-d', strtotime('Jan 1, '. $y) + $offset); - $iso = sprintf("%sT%02d:%02d:%02d.000Z",$str,$h,$mi,$s); - $srclen = 17; - } - } - else if (strcmp($timeFormat,'YYYY-MM-DDThh:mm:ss') === 0) - { - if ($milli == '1') - { - sscanf($line,"%04d-%02d-%02dT%02d:%02d:%02d.%03d",$y,$mo,$d,$h,$mi,$s,$ms); - $iso = sprintf("%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",$y,$mo,$d,$h,$mi,$s,$ms); - $srclen = 23; - } - else - { - sscanf($line,"%04d-%02d-%02dT%02d:%02d:%02d",$y,$mo,$d,$h,$mi,$s); - $iso = sprintf("%04d-%02d-%02dT%02d:%02d:%02d.000Z",$y,$mo,$d,$h,$mi,$s); - $srclen = 19; - } - } - - return array("iso" => $iso, "srclen" => $srclen); - } - - private function WriteDataFromASCII($f,$data_file,$timeFormat,$milli,$fields) - { - fputs($f,"<DATA><TABLEDATA>\n"); - - $in = fopen($data_file['path'],"r"); - - if (!$in) - return array('success' => false, 'message' => $data_file['path']);//"Cannot load input file"); - - while ($line = fgets($in)) - { - $l = trim($line); - if ((strlen($l) <= 0) || $l[0] == '#') - continue; - fputs($f,"<TR>"); - $time = $this->getTimeValue($line,$timeFormat,$milli); - if ($time['iso'] == '') - continue; //cannot load time - fputs($f,"<TD>".$time['iso']."</TD>"); - $l = substr($l,$time['srclen'],strlen($l)-$time['srclen']); - - foreach($fields as $field) - { - if (isset($field['xtype']) && (strcmp($field['xtype'],'dateTime') == 0) && - isset($field['ucd']) && (strcmp($field['ucd'],'time.epoch') == 0)) - continue; //skip time field - if (!isset($field['array_size'])) - $size = 1; - else - $size = $field['array_size']; - fputs($f,"<TD>"); - for ($i = 0; $i < $size; $i++) - { - $l = trim($l); - if ($l == '') - { - // - $l = fgets($in); - $l = trim($l); - } - sscanf($l,"%s",$str_value); - if ($i > 0) -if (!strstr($field['id'], 'xyz')) - fputs($f," "); -else { - fputs($f,"</TD><TD>"); -// $str_value = floatval($str_value) * 3393.00; -} fputs($f,$str_value); - $l = substr($l,strlen($str_value),strlen($l)-strlen($str_value)); - } - fputs($f,"</TD>"); - } - fputs($f,"</TR>\n"); - } - - fclose($in); - - fputs($f,"</TABLEDATA></DATA>\n"); - - return array('success' => true); - } - - - private function WriteTable($f,$input_params) - { - fputs($f,"<TABLE name='".$input_params['table_name']."'>\n"); - - foreach($input_params['fields'] as $field) - { - $refgroupid = $this->WriteInfoGroup($f,$field); - $this->WriteField($f,$field,$refgroupid); - } - - $res = $this->WriteDataFromASCII($f,$input_params['data_file'],$input_params['time_format'],$input_params['time_milli'],$input_params['fields']); - - fputs($f,"</TABLE>\n"); - - return $res; - } - - - private function WriteResource($f,$input_params) - { - fputs($f,"<RESOURCE>\n"); - $this->WriteDescription($f,$input_params['ressource_des']); - $res = $this->WriteTable($f,$input_params); - fputs($f,"</RESOURCE>\n"); - return $res; - } - - - function WriteVOTable($input_params,$output_file) - { - $out = fopen($output_file,"w"); - chmod ($output_file, 0664); - - if (!$out) - return array('success' => false, 'message' => "Cannot create output file"); - - fputs($out,"<?xml version='1.0'?>\n"); - fputs($out,"<VOTABLE version='1.2'"); - fputs($out," xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"); - fputs($out," xsi:schemaLocation='http://www.ivoa.net/xml/VOTable/v1.1 http://www.ivoa.net/xml/VOTable/v1.2'"); - fputs($out," xmlns='http://www.ivoa.net/xml/VOTable/v1.2'>\n"); - - $this->WriteDescription($out,$input_params['general_des']); - $res = $this->WriteResource($out,$input_params); - - fputs($out,"</VOTABLE>\n"); - - fclose($out); - - return $res; - } - - function pushParamFields(&$fields, $param) - { - - $infoMgr = new ParamsInfoMgr(); - - $infos = $infoMgr->GetParamInfo($param); - - if (!$infos['success']) - return $infos; - - switch ($infos['type']) - { - case 'derived' : - array_push($fields, array( - 'field_des' => $infos['infos']['buildchain'], - 'data_type' => 'float', - 'name' => $infos['infos']['name'], - 'id' => $param, - 'ucd' => "", - 'fill_val' => "NaN", - 'unit' => $infos['infos']['units'] - )); - break; - case 'local' : - { - if (!$infos['withcode']) - { - if ($infos['codeinfos']['valuetype']) - switch($infos['valuetype']) - { - case 'FLOAT' : - $valueType = 'float'; - break; - case 'INT' : - $valueType = 'int'; - break; - default : - $valueType = 'float'; - } - - $ucd = $infos['ddinfos']['parameter']['ucd']; - if ($infos['ddinfos']['parameter']['size'] != '') - $size = $infos['ddinfos']['parameter']['size']; - else - $size = $infos['codeinfos']['size']; - - $isarray = ($size > 1); - - if ($infos['ddinfos']['parameter']['name'] != '') - $name = $infos['ddinfos']['parameter']['name']; - else - $name = $infos['codeinfos']['title']; - - if ($isarray) - if ($infos['ddinfos']['parameter']['comps_label'] != '') - $comps_label = $infos['ddinfos']['parameter']['comps_label']; - else $comps_label = $infos['codeinfos']['legend']; - - $desc = $infoMgr->ParamInfosToString($infos); - $fillval = $infos['codeinfos']['fillvalue']; - if ($infos['ddinfos']['parameter']['id'] != '') - $id = $infos['ddinfos']['parameter']['id']; - else - $id = $param; - } - else - { - $valueType = 'float'; - $ucd = $infos['ddinfos']['parameter']['ucd']; - if ($infos['ddinfos']['parameter']['size'] != '') - $size = $infos['ddinfos']['parameter']['size']; - else - $size = $infos['codeinfos']['size']; - - $isarray = ($size > 1); - if ($infos['ddinfos']['parameter']['name'] != '') - $name = $infos['ddinfos']['parameter']['name']; - else - $name = $infos['codeinfos']['title']; - - $comps_label = ''; - if ($isarray) - { - for ($i = 0; $i < $size; $i++) - { - if ($i != 0) - $comps_label .= ' '; - $comps_label .= $name.'_'.$i; - } - } - $desc = $infoMgr->ParamInfosToString($infos); - $fillval = 'NaN'; - $id = $param; - } - if ($infos['ddinfos']['parameter']['units'] != '') - $units = $infos['ddinfos']['parameter']['units']; - else - $units = $infos['codeinfos']['units']; - // $units = $infos['ddinfos']['parameter']['units']; - - if ($isarray) - { - array_push($fields, array( - 'field_des' => $desc, - 'data_type' => $valueType, - 'array_size'=> $size, - 'name' => $name, - 'id' => $param, - 'ucd' => $ucd, - 'fill_val' => $fillval, - 'unit' => $units, - 'comps_label' => $comps_label - )); - } - else - { - array_push($fields, array( - 'field_des' => $desc, - 'data_type' => $valueType, - 'name' => $name, - 'id' => $id, - 'ucd' => $ucd, - 'fill_val' => $fillval, - 'unit' => $units - )); - } - break; - } - case 'mydata' : - { - $valueType = $infos['type']; - $size = $infos['size']; - $name = $infos['name']; - $units = $infos['units']; - $fillval = $infos['fillvalue']; - $id = $infos['realvar']; - $ucd = $infos['mask']; - array_push($fields, array( - 'field_des' => $valueType, - 'data_type' => $valueType, - 'name' => $name, - 'id' => $id, - 'ucd' => $ucd, - 'fill_val' => $fillval, - 'unit' => $units - )); - break; - } - default : - return array('success' => false, 'message' => 'Unknown parameter type : '.$infos['type']); - } - - return array('success' => true); - } - - function getTimeField() - { - return array( - 'param_name' => "Time", - 'field_des' => "Time", - 'data_type' => "char", - 'name' => "Time", - 'id' => "Time", - 'ucd' => "time.epoch", - 'xtype' => "dateTime", - 'fill_val' => "NaN", - 'array_size' => "*" - ); - } - - function downloadResultToVOTable($id,$newName,$opts,$inputCompressed = true,$canBeAlreadyVOTable = false) - { - $dir = USERWORKINGDIR.$id.'_/'; - - if ($inputCompressed) - { - //test if the archive file exist - if (strncmp($opts['compression'],'zip',3) === 0) - $downFile = $dir.$newName.".zip"; - else - $downFile = $dir.$newName.".tar.gz"; - - if (!file_exists($downFile)) - return array('success' => false, 'message' => "Download file ".$downId." doesn't exist"); - } - - // - $params = explode(' ',$opts['params']); - - $files = array(); - $isVOT = $canBeAlreadyVOTable && (strcmp($opts['fileformat'],'vot') === 0); - - switch ($opts['structure']) - { - case '0' : //All In One File - case '1' : //One File Per Time Interval - //get information about fileds (field in VOTable = parameter in AMDA) - $fields = array(); - - //push time field (the first field is the time field) - array_push($fields, $this->getTimeField()); - - //push parameters fields - foreach($params as $param) - { - $res = $this->pushParamFields($fields, $param); - - if (!$res['success']) - return $res; - } - - //extract the archive - chdir($dir); - - if ($isVOT) - $allfile = $newName.".xml"; - else - $allfile = "ALL.txt"; - - if ($inputCompressed) - { - if (strncmp($opts['compression'],'zip',3) === 0) - exec("unzip ".$downFile." ".$allfile); - else - exec("tar -xvzf ".$downFile." ".$allfile); - } - - if (!file_exists($allfile)) - return array('success' => false, 'message' => "Error to extract data (".$allfile.")"); - - //write VO Table - $data_file = array( - 'path' => $allfile); - - $input_params = array('general_des' => "Generated by CDPP/AMDA", - 'ressource_des' => $id, - 'table_name' => $id, - 'fields' => $fields, - 'data_file' => $data_file, - 'time_format' => $opts['timeformat'], - 'time_milli' => $opts['milli']); - - if (!$isVOT) - { - $res = $this->WriteVOTable($input_params,$dir.$newName.'.xml'); - unlink($allfile); - } - else - $res = array('success' => true); - - if (!$res['success']) - return $res; - - array_push($files,USERWORKINGDIR.$id.'_/'.$newName.'.xml'); - break; - case '2' : //One File Per Param/Interval - chdir($dir); - foreach($params as $param) - { - //get information about fileds - $fields = array(); - - //push time field - array_push($fields, $this->getTimeField()); - - $res = $this->pushParamFields($fields, $param); - - if (!$res['success']) - return $res; - - //extract the archive - chdir($dir); - - if ($isVOT) - $filename = $newName."_".$param.'.xml'; - else - $filename = strtoupper($param).".txt"; - - if ($inputCompressed) - { - if (strncmp($opts['compression'],'zip',3) === 0) - exec('unzip '.$downFile.' "'.$filename.'"'); - else - exec('tar -xvzf '.$downFile.' "'.$filename.'"'); - } - - if (!file_exists($filename)) - return array('success' => false, 'message' => "Error to extract data (".$filename.")"); - - //write VO Table - $data_file = array( - 'path' => $filename); - - $input_params = array('general_des' => "Imported from AMDA", - 'ressource_des' => $id."_".$param, - 'table_name' => $id."_".$param, - 'fields' => $fields, - 'data_file' => $data_file, - 'time_format' => $opts['timeformat'], - 'time_milli' => $opts['milli']); - - - if (!$isVOT) - { - $res = $this->WriteVOTable($input_params,$dir.$newName."_".$param.'.xml'); - unlink($filename); - } - else - $res = array('success' => true); - - if (!$res['success']) - return $res; - - - /*$votableMgr = new VOTableMgr(); - $votableMgr->load($dir.$newName."_".$param.'.xml'); - $votableMgr->isValidSchema();*/ - - array_push($files,USERWORKINGDIR.$id.'_/'.$newName."_".$param.'.xml'); - } - break; -// case '3' : // Argument by argument -// -// break; - default : - return array('success' => false, 'message' => "Request type unknown"); - } - - return array('success' => true, 'files' => $files); - } - -} - -?> \ No newline at end of file diff --git a/php/classes/PostProcessing.php b/php/classes/PostProcessing.php deleted file mode 100755 index 5c9e485..0000000 --- a/php/classes/PostProcessing.php +++ /dev/null @@ -1,213 +0,0 @@ -<?php -/** - * @class PostProcessing - * @version $Id: PostProcessing.php 2806 2015-03-02 15:31:05Z natacha $ - * - * - */ - - class PostProcessing { - - private $myParamsInfoMgr, $contentDom; - protected $xmlName, $rootTag = 'orbitesList', $objTagName = 'orbites'; - protected $attributes = array('name' => '', 'type' => '', 'mission' => '', - 'units' => '','time_resolution' => '', 'fillval' => '', - 'coordinate_system' => '', 'label' => ''); - - function __construct() { - - $this->myParamsInfoMgr = new ParamsInfoMgr(); - $this->xmlName = orbitesXml; - if (file_exists($this->xmlName)) unlink($this->xmlName); - $this->contentDom = new DomDocument("1.0"); - $this->contentDom->preserveWhiteSpace = false; - $this->contentDom->formatOutput = true; - $this->createDom(); - $this->xp = new domxpath($this->contentDom); - - } - - protected function createDom() { - $rootElement = $this->contentDom->createElement('orbitesList'); - $this->contentDom->appendChild($rootElement); - $this->contentDom->save($this->xmlName); - } - -/* -* Add Orbites in Orbites.xml -*/ - protected function addOrbites($obj) { - - $objList = $this->contentDom->documentElement; - $newObj = $this->contentDom->createElement($this->objTagName); - $newObj->setAttribute('xml:id',$this->id); - $obj_arr = (array)$obj; - foreach ($obj_arr as $key => $value) { - if ($key != 'xml:id') $newObj->setAttribute($key, $value); - } - $objList -> appendChild($newObj); - - $this->contentDom->save($this->xmlName); - } - - /***************************************************************** - * PUBLIC FUNCTIONS -*****************************************************************/ - - public function createOrbites() { - - $parametresXml = new DomDocument(); - - if (file_exists(paramXml)) { - $parametresXml -> load(paramXml); - $xpath = new DOMXpath($parametresXml); - - $parametres = $xpath->query("//PARAM[@type='orbit']"); - - if (!is_null($parametres)) { - foreach ($parametres as $parametre) { - - $paramInfo = $this->myParamsInfoMgr->GetDDInfoFromParameterID($parametre->getAttribute('xml:id')); - $mission = $paramInfo['submission']['id']; - if ($mission == '') $mission = $paramInfo['mission_id']; - - echo $parametre->getAttribute('xml:id')." was generated....".$mission.PHP_EOL; - - if ($mission != '') { - $obj = (object)array( - "param" => $parametre->getAttribute('xml:id'), - "name" => $parametre->getAttribute('name'), - "type" => $parametre->getAttribute('type'), - "mission" => strtoupper($mission), - "units" => $parametre->getElementsByTagName('UNITS')->item(0)->nodeValue, - "time_resolution" => $parametre->getElementsByTagName('TIME_RESOLUTION')->item(0)->nodeValue, - "fillval" => $parametre->getElementsByTagName('FILLVAL')->item(0)->nodeValue, - "coordinate_system" => $parametre->getElementsByTagName('COORDINATE_SYSTEM')->item(0)->nodeValue, - "label" => $parametre->getElementsByTagName('LABEL_I')->item(0)->nodeValue - ); - $this->id = $obj->param; - $this -> addOrbites($obj); - } - } - - } - else { - return array('success' => false, 'message' => "Local param file is empty"); - } - } - else { - echo "Local param file doesn't exist ".paramXml.PHP_EOL; - return array('success' => false, 'message' => "Local param file doesn't exist"); - } - } - - public function createOrbitesInfoFiles($locBases){ - - $domTargets = new DomDocument(); - if (!$domTargets->load(targetsSimu)) { - $msg = "Cannot load file ".targetsSimu.PHP_EOL; - if (!$this->updateOnly) error_log($msg,1,email); - continue; - } - - $targets = $domTargets->getElementsByTagName('target'); - - foreach ($targets as $target) { - $help = "<h2> ".$target->nodeValue." </b></a></h2><UL><br/><br/><li><b>Orbits of satellites :</b><br/><br/>"; - foreach ($locBases as $locBase) - { - if (strpos($locBase->getAttribute('targets'),$target->nodeValue) !== FALSE){ - $sat = $locBase->nodeValue; -echo "Loc Base is $sat & target is ".$target->nodeValue.PHP_EOL; - $domName = LocalData."DD_".$sat.".xml"; - $domParamName = LocalDataParam.$sat.".xml"; - $help = $help."<p><b>$sat: </b> <br/>"; - $dom = new DomDocument(); - if (!$dom->load($domName)) { - $msg = "Cannot load file ".$domName.PHP_EOL; - print_r($msg); - if (!$this->updateOnly) error_log($msg,1,email); - continue; - } - $domParam = new DomDocument(); - if (!$domParam->load($domParamName)) { - $msg = "Cannot load file ".$domParamName.PHP_EOL; - print_r($msg); - if (!$this->updateOnly) error_log($msg,1,email); - continue; - } - $domOrbites = new DomDocument(); - if (!$domOrbites->load(orbitesXml)) { - $msg = "Cannot load file ".orbitesXml.PHP_EOL; - print_r($msg); - if (!$this->updateOnly) error_log($msg,1,email); - continue; - } - $xp = new domxpath($dom); - $xpParam = new domxpath($domParam); - $xpOrb = new domxpath($domOrbites); - - $body = explode('.',$target->nodeValue); - $query = "//dataset"; - $datasets = $xp->query($query); - if ($datasets->length > 0){ - foreach ($datasets as $dataset){ - $vi = $dataset->getAttribute('xml:id'); - $query = "//PARAM[@vi='$vi']"; - $param = $xpParam->query($query); - if($param->length > 0){ - $paramID = $param->item(0)->getAttribute('xml:id'); - $query = "//orbites[@xml:id='$paramID']"; - - $orbites = $xpOrb->query($query); - - if ($orbites->length > 0) { // && $dataset->getElementsByTagName('target')->item(0)->nodeValue == $body[0]){ - - if ($dataset->getElementsByTagName('target')->item(0)->nodeValue == $body[0] ){ -// $help = $help."<p><b>$sat: </b> "; - $title = $dataset->getElementsByTagName('title')->item(0)->nodeValue; - $start = $dataset->getElementsByTagName('dataStart')->item(0)->nodeValue; - $stop = $dataset->getElementsByTagName('dataStop')->item(0)->nodeValue; - - $help = $help."$title: $start - $stop</p>"; - if ($target->nodeValue == 'Ganymede') $help = $help."<p>You can find the Ganymede flyby TimeTable in the <b>Shared Time Tables/OTHER/ganymede_flyby</b> - </p><br/>1996-06-27T06:07:08 - 1996-06-27T06:52:37 45.48 min <br/> -1996-09-06T18:32:44 - 1996-09-06T19:28:22 - 55.63 min <br/> -1997-04-05T06:44:41 - 1997-04-05T07:40:19 - 55.63 min <br/> -1997-05-07T15:36:54 - 1997-05-07T16:22:24 - 45.50 min <br/> -1997-06-26T16:50:00 - 1997-06-26T17:49:56 - 59.93 min <br/> -1997-12-15T09:30:23 - 1997-12-15T10:30:00 - 59.62 min <br/> -2000-05-20T09:40:04 - 2000-05-20T10:40:41 - 60.62 min <br/> -2000-12-28T07:54:41 - 2000-12-28T08:55:21 - 60.67 min <br/>"; - } - elseif ($dataset->getElementsByTagName('title')->item(0)->nodeValue == 'ToDo' || - $dataset->getAttribute('name') == 'orbit'){ -// $help = $help."<p><b>$sat: </b> "; - $start = $dataset->getElementsByTagName('dataStart')->item(0)->nodeValue; - $stop = $dataset->getElementsByTagName('dataStop')->item(0)->nodeValue; - $help = $help.$orbites->item(0)->getAttribute('mission')." $start - $stop</p>"; - } - elseif ($dataset->getElementsByTagName('title')->item(0)->nodeValue == 'CLUSTER1' || - $dataset->getElementsByTagName('title')->item(0)->nodeValue == 'CLUSTER2' || - $dataset->getElementsByTagName('title')->item(0)->nodeValue == 'CLUSTER3' || - $dataset->getElementsByTagName('title')->item(0)->nodeValue == 'CLUSTER4'){ -// $help = $help."<p><b>$sat: </b> "; - $start = $dataset->getElementsByTagName('dataStart')->item(0)->nodeValue; - $stop = $dataset->getElementsByTagName('dataStop')->item(0)->nodeValue; - $help = $help.$orbites->item(0)->getAttribute('param')." $start - $stop</p>"; - } - - } - } - } - } - } - } - $help = $help."</UL>"; - $fileName = HELPPATH."simu/simu".$target->nodeValue; - file_put_contents($fileName, $help); - } - return true; - - } - } \ No newline at end of file diff --git a/php/classes/SimuArgsMgr.php b/php/classes/SimuArgsMgr.php deleted file mode 100644 index 5805ca4..0000000 --- a/php/classes/SimuArgsMgr.php +++ /dev/null @@ -1,144 +0,0 @@ -<?php -/** - * @class SimuArgsMgr - * @version - * - */ - - - class SimuArgsMgr { - - protected $paramID; - protected $dataProducteur; - protected $dom; - protected $simulatedRegion; - - function __construct() { - - } - -/***************************************************************** -* PUBLIC FUNCTIONS -*****************************************************************/ - public function init($paramID){ - - $this->paramID = $paramID; - if ((strncmp($this->paramID, "impex___", 8) === 0) || (strncmp($this->paramID, "spase___", 8) === 0)){ - $this->getDataProducteur(); - $this->dom = new DomDocument("1.0"); - $this->dom->load(USERWSDIR.'RemoteParams.xml'); - if ($this->dataProducteur == 'FMI_GUMICS') - $this->simulatedRegion = 'Earth.Magnetosphere'; - else - $this->getSimulatedRegion(); - } - } - - protected function getDataProducteur(){ - if (strncmp($this->paramID, "impex___", 8) === 0) - $par = str_replace ("impex___", "", $this->paramID); - elseif (strncmp($this->paramID, "spase___", 8) === 0) - $par = str_replace ("spase___IMPEX_NumericalOutput_", "", $this->paramID); - // TODO tests - $tmp = explode( '_', $par); - - if ($tmp[0] == 'FMI') - $this->dataProducteur = $tmp[0].'_'.$tmp[1]; - else - $this->dataProducteur = $tmp[0]; - } - - protected function getSimulatedRegion(){ - $param = $this->dom->getElementById(trim($this->paramID)); - $parentID = $param->getAttribute('parentID'); - $dataSet = $this->dom->getElementById($parentID); - $this->simulatedRegion = $dataSet->getAttribute('SimulatedRegion'); - - } - - protected function getMissionsBySimuRegion(){ - $missions = simplexml_load_file(missionXml); - $missionsVal = array(); - foreach($missions->Local->MissionID as $mission){ - if (stripos ($mission['targets'], trim($this->simulatedRegion)) !== false ){ - if ( !isset($mission['group']) || (isset($mission['group']) && $mission['group'] != 'TEST')) { - $multypMissions = array(); - if ($mission['missions'] != '') - $multypMissions = explode(';',$mission['missions']); - else - $multypMissions[0] = (string)$mission; - - $missionsVal = array_merge($missionsVal,$multypMissions); - } - } - } - sort($missionsVal); - return $missionsVal; - } - - public function makeSimuArgs(){ - if ($this->dataProducteur != 'CCMC'){ - $missions = $this->getMissionsBySimuRegion(); - - if (count($missions) == 1) - $grp[] = array("group" => "Satellite", "args" => array("value" => $missions[0])); - elseif (count($missions) > 1){ - foreach ($missions as $mission){ - $miss[] = array ("arg" => $mission, "value" => $mission); - } - $grp[] = array("group" => "Satellite", "args" => $miss); - } - - - switch ($this->dataProducteur){ - case 'LATMOS': - $grp[] = array("group" => "ClockAngle", "args" => array("value" => "0")); - - break; - case 'SINP': - if ($this->simulatedRegion == 'Mercury.Magnetosphere'){ - $grp[] = array("group" => "BD", "args" => array("value" => "-196.0")); - $grp[] = array("group" => "Flux", "args" => array("value" => "4.0")); - $grp[] = array("group" => "Rss", "args" => array("value" => "1.35")); - $grp[] = array("group" => "R2", "args" => array("value" => "1.32")); - $grp[] = array("group" => "DZ", "args" => array("value" => "0.0")); - $grp[] = array("group" => "IMF_Bx", "args" => array("value" => "0.0")); - $grp[] = array("group" => "IMF_By", "args" => array("value" => "0.0")); - $grp[] = array("group" => "IMF_Bz", "args" => array("value" => "0.0")); - } - elseif ($this->simulatedRegion == 'Saturn.Magnetosphere'){ - $grp[] = array("group" => "BDC", "args" => array("value" => "3.0")); - $grp[] = array("group" => "BT", "args" => array("value" => "7.0")); - $grp[] = array("group" => "Rss", "args" => array("value" => "22.0")); - $grp[] = array("group" => "RD1", "args" => array("value" => "15.0")); - $grp[] = array("group" => "RD2", "args" => array("value" => "6.5")); - $grp[] = array("group" => "R2", "args" => array("value" => "18.0")); - $grp[] = array("group" => "IMF_Bx", "args" => array("value" => "0.0")); - $grp[] = array("group" => "IMF_By", "args" => array("value" => "0.0")); - $grp[] = array("group" => "IMF_Bz", "args" => array("value" => "0.0")); - } - elseif ($this->simulatedRegion == 'Jupiter.Magnetosphere'){ - $grp[] = array("group" => "BDC", "args" => array("value" => "3.0")); - $grp[] = array("group" => "BT", "args" => array("value" => "7.0")); - $grp[] = array("group" => "Rss", "args" => array("value" => "22.0")); - $grp[] = array("group" => "RD1", "args" => array("value" => "15.0")); - $grp[] = array("group" => "RD2", "args" => array("value" => "6.5")); - $grp[] = array("group" => "R2", "args" => array("value" => "18.0")); - $grp[] = array("group" => "IMF_Bx", "args" => array("value" => "0.0")); - $grp[] = array("group" => "IMF_By", "args" => array("value" => "0.0")); - $grp[] = array("group" => "IMF_Bz", "args" => array("value" => "0.0")); - } - break; - case 'LESIA': - break; - } - - return $grp; - } - return; - } - - - } - -?> diff --git a/php/classes/SimuParamMgr.php b/php/classes/SimuParamMgr.php deleted file mode 100755 index 4c42095..0000000 --- a/php/classes/SimuParamMgr.php +++ /dev/null @@ -1,384 +0,0 @@ -<?php -/** -* @class SimuParamMgr.php -* @brief Simations parameters Manager (Simulations db client) -* -* @version $Id: SimuParamMgr.php 2914 2015-05-19 10:31:38Z elena $ -*/ - class SimuParamMgr - { -// input parameters - protected $extraParam, $sampling,$paramAtribute; - protected $dataProducteur; - protected $orbitsURL; - protected $parameterID, $resourceID; - protected $isArgument, $isVector; - protected $mission; - protected $soapMethode; - public $startTime, $stopTime; - function __construct() { - ini_set("soap.wsdl_cache_enabled", "0"); - } - - public function setParams($paramID, $startDate, $stopDate, $paramsAtribute){ - $this->parameterID= $paramID; - $this->startTime= $startDate; - $this->stopTime= $stopDate; - $this->paramAtribute= $paramsAtribute; - $this->mission= $this->paramAtribute[$this->parameterID]['Satellite']; - $this->isArgument = false; - $this->isVector = false; - $this->dataProducteur = $this->getDataProducteur(); - } - - public function updateInterval($start, $stop){ - $this->startTime = gmdate("Y-m-d\TH:i:s\Z", $start); - $this->stopTime = gmdate("Y-m-d\TH:i:s\Z", $stop); - } - - private function getOrbitsURL(){ - try { - $client = new SoapClient(wsdl_AMDA, - array( - 'wsdl_cache' => 0, - 'trace' => 1, - 'soap_version'=>SOAP_1_2 - )); - } - catch (SoapFault $exception) { - error_log("Problem with WSDL".PHP_EOL.$exception->getMessage().PHP_EOL.$exception->getTraceAsString().PHP_EOL."File = ".$exception->getFile(),1,email); - return false; - } - - $params = array('spacecraft'=> strtoupper($this->mission), - 'startTime'=> $this->startTime, - 'stopTime'=> $this->stopTime, - 'coordinateSystem'=> $this->getCoordinateSystem(), - 'units'=> $this->getDomainUnits(), - 'outputFormat' => 'VOTable'); - - if ( strtoupper($this->mission) == "MESSENGER") $params['sampling'] = 60; - if ( strtoupper($this->mission) == "GALILEO") $params['sampling'] = 60; - - try { - $file = $client->__soapCall("getOrbites", array($params)); - } - catch (SoapFault $exception) { - error_log("Problem with query".PHP_EOL.$exception->getMessage().PHP_EOL.$exception->getTraceAsString().PHP_EOL."File = ".$exception->getFile(),1,email); - return false; - } - - $orbitURL = $file->dataFileURLs; - - return $orbitURL; - } - - private function makeRequest(){ - - $this->setResourceID(); - - if ($this->productor == 'LESIA'){ - $params = array('ResourceID'=> $this->resourceID, - 'Spacecraft_name'=> $this->mission, - 'StartTime'=> $this->startTime, - 'StopTime'=> $this->stopTime, - 'Sampling'=> $this->sampling, - 'extraParams'=> $this->extraParam); - - } - elseif ($this->productor == 'LATMOS') { - $clockAngle = $this->paramAtribute[$this->parameterID]['ClockAngle']; - $var = $this->getVariable($this->parameterID); - - if (!$this->isVector) { - $params = array('ResourceID'=> $this->resourceID, - 'url_XYZ'=> $this->getOrbitsURL(), - 'extraParams'=> $this->extraParam, - 'IMFClockAngle'=> $clockAngle, - 'Variable'=> $var); - } - else { - $params = array('ResourceID'=> $this->resourceID, - 'url_XYZ'=> $this->getOrbitsURL(), - 'extraParams'=> $this->extraParam, - 'IMFClockAngle'=> $clockAngle); - } - } - else { - $params = array('ResourceID'=> $this->resourceID, - 'url_XYZ'=> $this->getOrbitsURL(), - 'extraParams'=> $this->extraParam); - // 'Variable'=> $this->getVariable($this->parameterID)); - } - return $params; - } - - private function getDataProducteurWSDL(){ - // TODO tests - - switch ($this->dataProducteur){ - case 'LATMOS': - $wsdl = wsdl_LATMOS; - $this->productor = 'LATMOS'; - $this->soapMethode = 'getDataPointValue'; - break; - case 'FMI_HYB': - $wsdl = wsdl_FMI; - $this->productor = 'FMI_HYBRID'; - // $this->extraParam= array('InterpolationMethod' => $options[3]); - $outputFileType = array('OutputFileType'=>'VOTable'); - $this->soapMethode = 'getDataPointValue'; - $this->extraParam= $outputFileType; - break; - case 'FMI_GUMICS': - $wsdl = wsdl_FMI; - $this->productor = 'FMI_GUMICS'; - // $this->extraParam= array('InterpolationMethod' => $options[3]); - $outputFileType = array('OutputFileType'=>'VOTable'); - $this->soapMethode = 'getDataPointValue'; - $this->extraParam= $outputFileType; - break; - case 'SINP': - $wsdl = wsdl_SINP; - $this->productor = 'SINP'; - // $extraParam = array(); - $imf_b = array(); - $this->extraParam['OutputFileType']= 'VOTable'; - if (strpos($this->parameterID,'Earth') !== FALSE) - $this->soapMethode = 'calculateDataPointValue'; - elseif ((strpos($this->parameterID,'Mercury') !== FALSE)||(strpos($this->parameterID,'Saturn') !== FALSE) ||(strpos($this->parameterID,'Jupiter') !== FALSE)){ - if (strpos($this->parameterID,'Mercury') !== FALSE) - $this->soapMethode = 'calculateDataPointValueMercury'; - elseif (strpos($this->parameterID,'Saturn') !== FALSE) - $this->soapMethode = 'calculateDataPointValueSaturn'; - elseif (strpos($this->parameterID,'Jupiter') !== FALSE) - $this->soapMethode = 'calculateDataPointValueJupiter'; - foreach($this->paramAtribute[$this->parameterID] as $key => $value){ - if ($key != 'Satellite'){ - if ($key != 'IMF_Bx' && $key != 'IMF_By' && $key != 'IMF_Bz') - $this->extraParam[$key]= $value; - else { - switch ($key){ - case 'IMF_Bx': - $imf_b['x'] = $value; - break; - case 'IMF_By': - $imf_b['y'] = $value; - break; - case 'IMF_Bz': - $imf_b['z'] = $value; - break; - } - } - } - } - $this->extraParam['IMF_B']= $imf_b; - } - - break; - case 'LESIA': - $wsdl = wsdl_LESIA; - $this->productor = 'LESIA'; - $this->soapMethode = 'calculateDataPointValue_Spacecraft'; - $this->extraParam= array('OutputFileType'=>'VOTable', - 'InternalModel'=>$this->paramAtribute[$this->parameterID]['InternalModel'], - 'CurrentSheet'=>$this->paramAtribute[$this->parameterID]['CurrentSheet'], - 'CoordinateSystem'=>$this->paramAtribute[$this->parameterID]['CoordinateSystem'] - ); - $this->sampling = $this->paramAtribute[$this->parameterID]['sampling']; - break; - } - return $wsdl; - } - - private function setResourceID(){ - - $this->resourceID = $this->dom->getElementById($this->parameterID)->getAttribute('parentID'); - - if (($this->dom->getElementById($this->parameterID)->nodeName)=='component') $this->isArgument = true; - else { - $this->isArgument = false; - if ($this->dom->getElementById($this->parameterID)->getAttribute('size') == 3) - { - $this->isVector = true; - } - } - // return $this->resourceID; - } - - private function getDomainUnits(){ - $units = $this->dom->getElementById($this->resourceID)->getAttribute('domainUnits'); - if ($units == 'm') $units='km'; - return $units; - } - - private function getCoordinateSystem(){ - return $this->dom->getElementById($this->resourceID)->getAttribute('coordinateSystem'); - } - - private function addFile($fileName){ - - $myBaseManager = new BaseManager(); - $start = strtotime($this->startTime); - $stop = strtotime($this->stopTime); - $mask = $myBaseManager->addWsFile($fileName, $start, $stop); - if ($mask != null) { - $startstop = $myBaseManager->getStartStop($myBaseManager->getVi($mask)); - } - return array( 'success' => true, 'file' => $fileName); - } - - private function getVariable($paramID){ - $tmp = explode( '_', $paramID); - $n = count($tmp)-1; - $var = $tmp[$n]; - - return $var; - } - - private function getVectorName($paramID){ - $tmp = explode( '_', $paramID); - $n = count($tmp)-1; - $var = $tmp[$n-2].'_'.$tmp[$n-1].'_'.$tmp[$n]; - - return $var; - } - - private function getDataProducteur(){ - - if (strncmp($this->parameterID, "impex___", 8) === 0) - $par = str_replace ("impex___", "", $this->parameterID); - elseif (strncmp($this->parameterID, "spase___IMPEX_NumericalOutput_", 30) === 0) - $par = str_replace ("spase___IMPEX_NumericalOutput_", "", $this->parameterID); - elseif (strncmp($this->parameterID, "spase___IMPEX_SimulationRun_", 28) === 0) - $par = str_replace ("spase___IMPEX_SimulationRun_", "", $this->parameterID); - - // TODO tests - $tmp = explode( '_', $par); - if ($tmp[0]== 'FMI') - return $tmp[0].'_'.$tmp[1]; - else - return $tmp[0]; - - } - - public function getFileName(){ - - $paramID = $this->parameterID; - $paramAtribute = $this->paramAtribute[$this->parameterID]; - foreach ($paramAtribute as $k => $v) - $args = $args.$v.'_'; - $fileName = $paramID.'_'.$args.strtotime($this->startTime).'_'.strtotime($this->stopTime).'.xml'; - return $fileName; - } - - public function getMask(){ - $paramID = $this->parameterID; - - $paramAtribute = $this->paramAtribute[$this->parameterID]; - foreach ($paramAtribute as $k => $v) - $args = $args.$v.'_'; - $mask = $paramID.'_'.$args.'*.xml'; - return $mask; - } - - public function isVector(){ - - return $this->isVector; - } - - - public function getSimuData() - { - $simuFilenames = array(); - - if ((strncmp($this->parameterID, "impex___", 8) === 0) || (strncmp($this->parameterID, "spase___", 8) === 0)) - { - $paramID = $this->parameterID; - $fileName = $this->getFileName(); - $newfile = getenv('USER_DATA_PATH').$fileName; - - if (!file_exists ($newfile)) - { - if ($this->dataProducteur != 'CCMC') - { - try { - $client = new SoapClient($this->getDataProducteurWSDL(), - array( - 'wsdl_cache' => 0, - 'trace' => 1, - 'soap_version'=>SOAP_1_2 - )); - } - catch (SoapFault $exception) { - error_log("Problem with WSDL".PHP_EOL.$exception->getMessage().PHP_EOL.$exception->getTraceAsString().PHP_EOL."File = ".$exception->getFile(),1,email); - return false; - } - - if ($this->productor != 'FMI_GUMICS') - $xml = RemoteData.$this->productor."/base.xml"; - else - $xml = getenv('USER_WS_PATH').'RemoteParams.xml'; - - $this->dom = new DOMDocument('1.0', 'utf-8'); - $this->dom->load($xml); - $params = $this->makeRequest($this->parameterID); - - - try { - $file = $client->__soapCall($this->soapMethode, array($params)); - } - catch (SoapFault $exception) { - error_log($exception->getMessage().PHP_EOL.$exception->getTraceAsString(),1,email); - return false; - } - - if (!copy($file, $newfile)) { - error_log('Can\'t copy '.$file,1,email); - return false; - } - else { - if ($this->isVector){ - $vectorName = $this->getVectorName($paramID); - $myVOTableMgr = new VOTableMgr(); - $myVOTableMgr->args2vector($newfile, $vectorName); - } - $this->addFile($fileName); - $simuFilenames[$paramID] = $fileName; - } - } // end if $this->dataProducteur != 'CCMC' - else { - $docBase = new DOMDocument(); - $docBase->load(RemoteData.'CCMC/base.xml'); - $elementParam = $docBase->getElementById($this->parameterID); - - if ($elementParam->tagName == 'component') - $accessURL = $elementParam->parentNode->parentNode->getAttribute('AccessURL'); - elseif ($elementParam->tagName == 'parameter'){ - $accessURL = $elementParam->parentNode->getAttribute('AccessURL'); - if ($elementParam->getAttribute('size') == 3) $this->isVector = true; - } - else {} - - $doc = new DOMDocument(); - $doc->load($accessURL); - $doc->save($newfile); - - if ($this->isVector){ - $vectorName = $this->getVectorName($this->parameterID); - $myVOTableMgr = new VOTableMgr(); - $myVOTableMgr->args2vector($newfile, $vectorName); - } - - $this->addFile($fileName); - $simuFilenames[$paramID] = $fileName; - } - } // if (!file_exists ($newfile)) - } // if ((strncmp($this->parameterID, "impex___", 8) === 0) | - - return $simuFilenames; - } - - } -?> - diff --git a/php/old_amda/getFileNames.php b/php/old_amda/getFileNames.php deleted file mode 100644 index 2fdba67..0000000 --- a/php/old_amda/getFileNames.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - $id = $argv[1]; - $st = (int)$argv[2]; - $dt = (int)$argv[3]; - $dom = new DomDocument("1.0"); - $dom->load(getenv('USER_DATA_PATH').'base.xml'); - $vi = $dom->getElementById($id); - $files = $vi->getElementsByTagName("file"); - if ($files->length > 0) - foreach ($files as $file) { - if ($file->getAttribute("stop") < $st) { - continue; - } - if ($file->getAttribute("start") >= $st + $dt){ - break; - } -//error_log($file->getAttribute("name"),3,'mylog'); - echo $file->getAttribute("name").","; - } - exit(); -?> diff --git a/php/old_amda/getViStart.php b/php/old_amda/getViStart.php deleted file mode 100644 index 8973f5d..0000000 --- a/php/old_amda/getViStart.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - /** - * $Id: getViStart.php 2534 2014-10-02 16:17:30Z elena $ -*/ - $dom = new DomDocument("1.0"); - - $dom->load(getenv('USER_DATA_PATH').'base.xml'); - $vi = $dom->getElementById($argv[1]); - echo $vi->getAttribute("start"); - exit(); -?> \ No newline at end of file diff --git a/php/old_amda/getViStop.php b/php/old_amda/getViStop.php deleted file mode 100644 index 93dc8e3..0000000 --- a/php/old_amda/getViStop.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - /** - * $Id: getViStop.php 2534 2014-10-02 16:17:30Z elena $ -*/ - $dom = new DomDocument("1.0"); - $dom->load(getenv('USER_DATA_PATH').'base.xml'); - $vi = $dom->getElementById($argv[1]); - echo $vi->getAttribute("stop"); - exit(); -?> \ No newline at end of file diff --git a/php/old_amda/getVotVar.php b/php/old_amda/getVotVar.php deleted file mode 100644 index fd9cff5..0000000 --- a/php/old_amda/getVotVar.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php - -//putenv("USER_DATA_PATH=/home/benjamin/workspace/AMDA-NG4/data/renard/DATA/"); -//putenv("PHP_CLASSES_PATH=/home/benjamin/workspace/AMDA-NG4/php/classes/"); - -date_default_timezone_set('UTC'); - -require getenv('PHP_CLASSES_PATH').'VOTableMgr.php'; - -$files = $argv[1]; -$paramId = $argv[2]; -$dims = $argv[3]; -$startDouble = $argv[4]; -$intDouble = $argv[5]; - -$mgr = new VOTableMgr(); - -$files_arr = explode(",",$files); - -foreach ($files_arr as $file) -{ - $fileName = getenv('USER_DATA_PATH').$file; - - $mgr->load($fileName); - - $timeIndex = $mgr->getTimeFieldIndex(); - if ($timeIndex < 0) - continue; - - $paramIndex= $mgr->getFieldIndexByID($paramId); - if ($paramIndex < 0) - continue; - - $paramInfo = $mgr->getFieldInfoByID($paramId); - if (isset($paramInfo["error"])) - continue; - - $tr = $mgr->getFirstTR(); - - $crtTime = $startDouble; - - while ($tr) - { - $time = strtotime($mgr->getTDValueByFieldIndex($tr,$timeIndex)); - - if ($time > $crtTime) - { - if ($time <= $startDouble + $intDouble) - { - $val = $mgr->getTDValueByFieldIndex($tr,$paramIndex); - - echo $time." ".$val."\n"; - - $crtTime = $time; - } - else - break; - } - - $tr = $mgr->getNextTR($tr); - } -} - -exit(); - -?> \ No newline at end of file diff --git a/php/old_amda/moreData.php b/php/old_amda/moreData.php deleted file mode 100644 index 3b6101c..0000000 --- a/php/old_amda/moreData.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php - /** - * $Id: moreData.php 2913 2015-05-19 10:30:52Z elena $ -*/ - require_once ("../../../../php/config.php"); - - - $dom = new DomDocument("1.0"); - $dom->load(getenv('USER_DATA_PATH').'base.xml'); - $vi = $dom->getElementById($argv[1]); - - $requestStart = (int)$argv[2]; - $requestStop = (int)$argv[3]; - - $argumentsByParam = array(); - - if ($vi->getAttribute("moreData")) { - - $masks = $vi->getElementsByTagName('mask'); - $mask = $masks->item(0)->nodeValue; - - $isSimu = strncmp($mask, "impex___", 8) === 0 || strncmp($mask, "spase___", 8) === 0; - $isClWeb = strncmp($mask, "CLWEB_", 6) === 0; - - if ($isSimu) $myParamMgr = new SimuParamMgr(); - else if ($isClWeb) $myParamMgr = new WsrParamMgr(); - else exit(); - - $paramBuilder = new ParamBuilder(); - - $paramDom = new DomDocument("1.0"); - $paramDom->load(getenv('USER_WS_PATH').'WsParams.xml'); - $xpdSimu = new domxpath($paramDom); - - $paramsSimu = $xpdSimu->query("//*[@mask='".$mask."']"); - $simuID = $paramsSimu->item(0)->getAttribute('xml:id'); - - $files = $vi->getElementsByTagName('file'); - $param = $vi->getElementsByTagName('param')->item(0)->nodeValue; - $args = $vi->getElementsByTagName('arguments'); - - if ($args->item(0)){ - if ($args->item(0)->hasChildNodes()){ - $arguments = array(); - foreach ($args->item(0)->childNodes as $child){ - if ($child instanceof DOMElement){ - $arguments[$child->nodeName] = $child->nodeValue; - } - } - $argumentsByParam[$param] = $arguments; - } - } - $myBaseManager = new BaseManager(); - $intervalsToGet = $myBaseManager->intervalsToGet($requestStart, $requestStop, $mask); - $start = $intervalsToGet['start']; - $stop = $intervalsToGet['stop']; - // Data to get - if (count($start) > 0) { - for ($i = 0; $i < count($start); $i++) { - - $startD = gmdate("Y-m-d\TH:i:s\Z",$start[$i]); - $stopD = gmdate("Y-m-d\TH:i:s\Z",$stop[$i]); - if ($isClWeb) { - $data['paramID'] = $param; - $data['startDate'] = $startD; - $data['stopDate'] = $stopD; - $myParamMgr->setParams($data); - $wsrFileNames = $myParamMgr->getData(); - } - else { - $myParamMgr->setParams($param, $startD, $stopD, $argumentsByParam); - $simuFileNames = $myParamMgr->getSimuData(); - } - } - $paramBuilder->makeWsdParam($simuID); - } - } - exit(); -?> \ No newline at end of file -- libgit2 0.21.2