Commit 3e80c9689064d5f888a0edac6ef25fecfd208bb0
1 parent
3ab0bee9
Exists in
master
and in
111 other branches
plt, download in RemoteSimu menu
Showing
10 changed files
with
139 additions
and
1678 deletions
Show diff stats
js/app/models/RemoteSimuParamNode.js
... | ... | @@ -58,124 +58,146 @@ Ext.define('amdaModel.RemoteSimuParamNode', { |
58 | 58 | }, |
59 | 59 | |
60 | 60 | |
61 | - allMenuItems : function() { | |
62 | - var menuItems = | |
63 | - [ { | |
64 | - fnId : 'root-collapseAll', | |
65 | - text : 'Close All' | |
66 | - }, { | |
67 | - fnId : 'dire-collapseAll', | |
68 | - text : 'Close All' | |
69 | - },{ | |
70 | - fnId : 'leaf-createAlias', | |
71 | - text : 'Create/Edit Alias' | |
72 | - }, { | |
73 | - fnId : 'leaf-createDerivedParam', | |
74 | - text : 'Create Derived Parameter' | |
75 | - } | |
76 | - ]; | |
77 | - | |
78 | - return menuItems; | |
79 | - }, | |
61 | + allMenuItems : function() | |
62 | + { | |
63 | + var menuItems = | |
64 | + [ { | |
65 | + fnId : 'root-collapseAll', | |
66 | + text : 'Close All' | |
67 | + }, | |
68 | + { | |
69 | + fnId : 'dire-collapseAll', | |
70 | + text : 'Close All' | |
71 | + }, | |
72 | + { | |
73 | + fnId : 'leaf-createAlias', | |
74 | + text : 'Create/Edit Alias' | |
75 | + }, | |
76 | + { | |
77 | + fnId : 'leaf-createDerivedParam', | |
78 | + text : 'Create Derived Parameter' | |
79 | + }, | |
80 | + { | |
81 | + fnId : 'leaf-plotParam', | |
82 | + text : 'Plot Parameter', | |
83 | + hidden : true | |
84 | + }, | |
85 | + { | |
86 | + fnId : 'leaf-downParam', | |
87 | + text : 'Download Parameter', | |
88 | + hidden : true | |
89 | + } | |
90 | + ]; | |
91 | + | |
92 | + return menuItems; | |
93 | + }, | |
80 | 94 | |
81 | - getAllContextMenuItems: function() | |
82 | - { | |
83 | - // TODO use 'isAddable' attribute | |
84 | - if (this.get('isAddable')) | |
85 | - return Ext.Array.push(this.allMenuItems(), | |
86 | - { fnId : 'dire-addData', | |
87 | - text : 'Add Run'}); | |
88 | - else if (this.get('isDeletable')) | |
89 | - return Ext.Array.push(this.allMenuItems(), | |
90 | - { fnId : 'dire-deleteNode', | |
91 | - text : 'Delete Run'}); | |
92 | - | |
93 | - return this.allMenuItems(); | |
94 | - | |
95 | - }, | |
96 | - | |
97 | - onMenuItemClick : function(menu, item, event) { | |
98 | - | |
99 | - if (item) { | |
100 | - switch (item.fnId) { | |
101 | - | |
102 | - case 'root-collapseAll': | |
103 | - case 'dire-collapseAll': | |
104 | - if(this && !this.isLeaf()) { | |
105 | - this.collapse(true); | |
106 | - } | |
107 | - break; | |
108 | - case 'leaf-createDerivedParam': | |
109 | - this.createLeaf(this); | |
110 | - break; | |
111 | - case 'leaf-createAlias': | |
112 | - this.createAlias(this); | |
113 | - break; | |
114 | - case 'dire-deleteNode' : | |
115 | - this.deleteData(); | |
116 | - break; | |
117 | - case 'dire-addData': | |
118 | - case 'root-addData': | |
119 | - this.addData(); | |
120 | - break; | |
121 | - default: | |
122 | - break; | |
123 | - } | |
124 | - } | |
125 | - }, | |
95 | + getAllContextMenuItems: function() | |
96 | + { | |
97 | + // TODO use 'isAddable' attribute | |
98 | + if (this.get('isAddable')) | |
99 | + return Ext.Array.push(this.allMenuItems(), | |
100 | + { fnId : 'dire-addData', | |
101 | + text : 'Add Run'}); | |
102 | + else if (this.get('isDeletable')) | |
103 | + return Ext.Array.push(this.allMenuItems(), | |
104 | + { fnId : 'dire-deleteNode', | |
105 | + text : 'Delete Run'}); | |
106 | + | |
107 | + return this.allMenuItems(); | |
108 | + }, | |
109 | + | |
110 | + onMenuItemClick : function(menu, item, event) | |
111 | + { | |
112 | + if (item) | |
113 | + { | |
114 | + switch (item.fnId) | |
115 | + { | |
116 | + case 'root-collapseAll': | |
117 | + case 'dire-collapseAll': | |
118 | + if(this && !this.isLeaf()) { | |
119 | + this.collapse(true); | |
120 | + } | |
121 | + break; | |
122 | + case 'leaf-createDerivedParam': | |
123 | + this.createLeaf(this); | |
124 | + break; | |
125 | + case 'leaf-createAlias': | |
126 | + this.createAlias(this); | |
127 | + break; | |
128 | + case 'dire-deleteNode' : | |
129 | + this.deleteData(); | |
130 | + break; | |
131 | + case 'dire-addData': | |
132 | + case 'root-addData': | |
133 | + this.addData(); | |
134 | + break; | |
135 | + case 'leaf-plotParam': | |
136 | + case 'para-plotParam': | |
137 | + this.createPlot(this); | |
138 | + break; | |
139 | + case 'leaf-downParam': | |
140 | + case 'para-downParam': | |
141 | + this.createDownload(this); | |
142 | + break; | |
143 | + default: | |
144 | + break; | |
145 | + } | |
146 | + } | |
147 | + }, | |
126 | 148 | |
127 | - deleteData : function() { | |
128 | - var parent = this.parentNode; | |
129 | - AmdaAction.deleteFromTree({nodeType: this.get('nodeType'), id : this.get('id')}, function(res,e){ | |
130 | - //TODO if () not error ?? | |
131 | - this.remove(); | |
132 | - this.destroy(); | |
133 | - },this); | |
134 | - }, | |
149 | + deleteData : function() | |
150 | + { | |
151 | + var parent = this.parentNode; | |
152 | + AmdaAction.deleteFromTree({nodeType: this.get('nodeType'), id : this.get('id')}, function(res,e){ | |
153 | + //TODO if () not error ?? | |
154 | + this.remove(); | |
155 | + this.destroy(); | |
156 | + },this); | |
157 | + }, | |
135 | 158 | |
136 | - addData : function() { | |
137 | - | |
138 | - if (this.get('disable')) return; | |
139 | - | |
140 | - var win = myDesktopApp.desktop.getWindow('impex-win'); | |
141 | - if(!win) | |
142 | - { | |
143 | - var win = myDesktopApp.desktop.createWindow( | |
144 | - { | |
145 | - border: false, | |
146 | - id : 'impex-win', | |
147 | - title : 'Find the most relevant run(s)', | |
148 | - width : 600, | |
149 | - height : 600, | |
150 | - layout : 'border', | |
151 | - //autoScroll: true, | |
152 | - overflowY: 'scroll', | |
153 | - maximizable : false, | |
154 | - items : | |
155 | - [{ | |
156 | - xtype : 'interop_impex', | |
157 | - region : 'center', | |
158 | - margins : | |
159 | - { | |
160 | - top: 0, | |
161 | - right: 5, | |
162 | - bottom: 5, | |
163 | - left: 5 | |
164 | - } | |
165 | - }], | |
166 | - listeners: { | |
167 | - scope : this, | |
168 | - show : function( ) { | |
169 | - win.items.getAt(0).setLinkedNode(this); | |
170 | - } | |
171 | - } | |
172 | - }); | |
173 | - } | |
174 | - else | |
175 | - { | |
176 | - | |
177 | - } | |
178 | - win.show(); | |
179 | - } | |
180 | - | |
159 | + addData : function() | |
160 | + { | |
161 | + if (this.get('disable')) return; | |
162 | + var win = myDesktopApp.desktop.getWindow('impex-win'); | |
163 | + | |
164 | + if(!win) | |
165 | + { | |
166 | + var win = myDesktopApp.desktop.createWindow( | |
167 | + { | |
168 | + border: false, | |
169 | + id : 'impex-win', | |
170 | + title : 'Find the most relevant run(s)', | |
171 | + width : 600, | |
172 | + height : 600, | |
173 | + layout : 'border', | |
174 | + //autoScroll: true, | |
175 | + overflowY: 'scroll', | |
176 | + maximizable : false, | |
177 | + items : | |
178 | + [{ | |
179 | + xtype : 'interop_impex', | |
180 | + region : 'center', | |
181 | + margins : | |
182 | + { | |
183 | + top: 0, | |
184 | + right: 5, | |
185 | + bottom: 5, | |
186 | + left: 5 | |
187 | + } | |
188 | + }], | |
189 | + listeners: { | |
190 | + scope : this, | |
191 | + show : function( ) { | |
192 | + win.items.getAt(0).setLinkedNode(this); | |
193 | + } | |
194 | + } | |
195 | + }); | |
196 | + } | |
197 | + else | |
198 | + { | |
199 | + | |
200 | + } | |
201 | + win.show(); | |
202 | + } | |
181 | 203 | }); |
... | ... |
php/classes/BuildVOTable.php deleted
... | ... | @@ -1,633 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * @class BuildVOTable | |
4 | - * @version $Id: BuildVOTable.php 2795 2015-02-27 15:42:55Z elena $ | |
5 | - * | |
6 | - * | |
7 | - */ | |
8 | - | |
9 | -class BuildVOTable | |
10 | -{ | |
11 | - function __construct() | |
12 | - { | |
13 | - | |
14 | - } | |
15 | - | |
16 | - private function WriteDescription($f,$description) | |
17 | - { | |
18 | - //$description = str_replace('<', '<', $description); | |
19 | - //$description = str_replace('>', '>', $description); | |
20 | - fputs($f,"<DESCRIPTION>"); | |
21 | - fputs($f,htmlentities($description)); | |
22 | - fputs($f,"</DESCRIPTION>\n"); | |
23 | - } | |
24 | - | |
25 | - private function WriteField($f,$field,$refgroupid) | |
26 | - { | |
27 | -if (!strstr($field['id'], 'xyz')){ | |
28 | - $str = "<FIELD datatype='".$field['data_type']."'"; | |
29 | - $str .= " ID='".$field['id']."'"; | |
30 | - $str .= " name='".$field['name']."'"; | |
31 | - if (isset($field['xtype']) && ($field['xtype'] != '')) | |
32 | - $str .= " xtype='".$field['xtype']."'"; | |
33 | - if (isset($field['array_size']) && ($field['array_size'] != '')) | |
34 | - $str .= " arraysize='".$field['array_size']."'"; | |
35 | - if (isset($field['unit']) && ($field['unit'] != '')) | |
36 | - $str .= " unit='".$field['unit']."'"; | |
37 | - $str .= " ucd='".$field['ucd']."'"; | |
38 | - if (isset($refgroupid)) | |
39 | - $str .= " ref='".$refgroupid."'"; | |
40 | - $str .= ">\n"; | |
41 | - fputs($f,$str); | |
42 | - $this->WriteDescription($f,$field['field_des']); | |
43 | - fputs($f,"<VALUES null='".$field['fill_val']."'/>\n"); | |
44 | - fputs($f,"</FIELD>\n"); | |
45 | -} | |
46 | -//TODO delete else after integration by LATMOS vecteurs in VOtable | |
47 | -else { | |
48 | - if ($field['comps_label'] == "X;Y;Z") | |
49 | - $attributes = explode(';', $field['comps_label']); | |
50 | - else | |
51 | - $attributes = preg_split ("/\s+/", $field['comps_label']); | |
52 | - $a = 1; | |
53 | - foreach($attributes as $attr){ | |
54 | - $str = "<FIELD datatype='".$field['data_type']."'"; | |
55 | - $str .= " ID='".strtoupper($attr)."'"; | |
56 | - $str .= " name='".strtoupper($attr)."'"; | |
57 | - if (isset($field['xtype']) && ($field['xtype'] != '')) | |
58 | - $str .= " xtype='".$field['xtype']."'"; | |
59 | -// if (isset($field['array_size']) && ($field['array_size'] != '')) | |
60 | -// $str .= " arraysize='".$field['array_size']."'"; | |
61 | - if (isset($field['unit']) && ($field['unit'] != '')) | |
62 | - $str .= " unit='".$field['unit']."'"; | |
63 | - if (strstr($attr,'x_')) | |
64 | - $attr = 'x'; | |
65 | - elseif (strstr($attr,'y_')) | |
66 | - $attr = 'y'; | |
67 | - elseif (strstr($attr,'z_')) | |
68 | - $attr = 'z'; | |
69 | - $str .= " ucd='pos.cartesian.".$attr."'"; | |
70 | - $str .= " utype='stc:AstroCoords.Position3D.Value3.C".$a."'"; | |
71 | -// if (isset($refgroupid)) | |
72 | -// $str .= " ref='".$refgroupid."'"; | |
73 | - $str .= ">\n"; | |
74 | - fputs($f,$str); | |
75 | - $this->WriteDescription($f,$field['field_des']); | |
76 | - fputs($f,"<VALUES null='".$field['fill_val']."'/>\n"); | |
77 | - fputs($f,"</FIELD>\n"); | |
78 | - $a++; | |
79 | - } | |
80 | -} | |
81 | - } | |
82 | - | |
83 | - private function WriteInfoGroup($f,$field) | |
84 | - { | |
85 | - if (!isset($field['array_size'])) | |
86 | - return NULL; | |
87 | - if (($field['array_size'] == '') || ($field['array_size'] == '*')) | |
88 | - return NULL; | |
89 | - $array_size = intval($field['array_size']); | |
90 | - if ($array_size < 2) | |
91 | - return NULL; | |
92 | -// TODO delete after VOTable group implementation by LATMOS and Co | |
93 | - if (strstr($field['id'], 'xyz')) | |
94 | - return NULL; | |
95 | -// end delete | |
96 | - $group_id = "info_".$field['id']; | |
97 | - | |
98 | - $str = "<GROUP ID='".$group_id."'>\n"; | |
99 | - | |
100 | - //"param_".$field['id']."_"info | |
101 | - | |
102 | - $str .= "<PARAM name='components_".$field['name']."'"; | |
103 | - $str .= " ID='components_".$field['id']."'"; | |
104 | - $str .= " datatype='char' arraysize='*'"; | |
105 | - $str .= " value='".$field['comps_label']."'"; | |
106 | - $str .= "/>\n"; | |
107 | - $str .= "</GROUP>\n"; | |
108 | - | |
109 | - fputs($f,$str); | |
110 | - return $group_id; | |
111 | - } | |
112 | - | |
113 | - private function getTimeValue($line,$timeFormat,$milli) | |
114 | - { | |
115 | - $iso = ""; | |
116 | - $srclen = 0; | |
117 | - if (strcmp($timeFormat,'YYYY MM DD hh mm ss') === 0) | |
118 | - { | |
119 | - if ($milli == '1') | |
120 | - { | |
121 | - sscanf($line,"%04d %02d %02d %02d %02d %02d %03d",$y,$mo,$d,$h,$mi,$s,$ml); | |
122 | - $iso = sprintf("%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",$y,$mo,$d,$h,$mi,$s,$ml); | |
123 | - $srclen = 23; | |
124 | - } | |
125 | - else | |
126 | - { | |
127 | - sscanf($line,"%04d %02d %02d %02d %02d %02d",$y,$mo,$d,$h,$mi,$s); | |
128 | - $iso = sprintf("%04d-%02d-%02dT%02d:%02d:%02d.000Z",$y,$mo,$d,$h,$mi,$s); | |
129 | - $srclen = 19; | |
130 | - } | |
131 | - } | |
132 | - else if (strcmp($timeFormat,'DD MM YYYY hh mm ss') === 0) | |
133 | - { | |
134 | - if ($milli == '1') | |
135 | - { | |
136 | - sscanf($line,"%02d %02d %04d %02d %02d %02d %03d",$d,$mo,$y,$h,$mi,$s,$ml); | |
137 | - $iso = sprintf("%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",$y,$mo,$d,$h,$mi,$s,$ml); | |
138 | - $srclen = 23; | |
139 | - } | |
140 | - else | |
141 | - { | |
142 | - sscanf($line,"%02d %02d %04d %02d %02d %02d",$d,$mo,$y,$h,$mi,$s); | |
143 | - $iso = sprintf("%04d-%02d-%02dT%02d:%02d:%02d.000Z",$y,$mo,$d,$h,$mi,$s); | |
144 | - $srclen = 19; | |
145 | - } | |
146 | - } | |
147 | - else if (strcmp($timeFormat,'YYYY DDD hh mm ss') === 0) | |
148 | - { | |
149 | - if ($milli == '1') | |
150 | - { | |
151 | - sscanf($line,"%04d %03d %02d %02d %02d %03d",$y,$nday,$h,$mi,$s,$ms); | |
152 | - $offset = ($nday-1) * 86400; | |
153 | - $str = date('Y-m-d', strtotime('Jan 1, '. $y) + $offset); | |
154 | - $iso = sprintf("%sT%02d:%02d:%02d.%03dZ",$str,$h,$mi,$s,$ms); | |
155 | - $srclen = 21; | |
156 | - } | |
157 | - else | |
158 | - { | |
159 | - sscanf($line,"%04d %03d %02d %02d %02d",$y,$nday,$h,$mi,$s); | |
160 | - $offset = ($nday-1) * 86400; | |
161 | - $str = date('Y-m-d', strtotime('Jan 1, '. $y) + $offset); | |
162 | - $iso = sprintf("%sT%02d:%02d:%02d.000Z",$str,$h,$mi,$s); | |
163 | - $srclen = 17; | |
164 | - } | |
165 | - } | |
166 | - else if (strcmp($timeFormat,'YYYY-MM-DDThh:mm:ss') === 0) | |
167 | - { | |
168 | - if ($milli == '1') | |
169 | - { | |
170 | - sscanf($line,"%04d-%02d-%02dT%02d:%02d:%02d.%03d",$y,$mo,$d,$h,$mi,$s,$ms); | |
171 | - $iso = sprintf("%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",$y,$mo,$d,$h,$mi,$s,$ms); | |
172 | - $srclen = 23; | |
173 | - } | |
174 | - else | |
175 | - { | |
176 | - sscanf($line,"%04d-%02d-%02dT%02d:%02d:%02d",$y,$mo,$d,$h,$mi,$s); | |
177 | - $iso = sprintf("%04d-%02d-%02dT%02d:%02d:%02d.000Z",$y,$mo,$d,$h,$mi,$s); | |
178 | - $srclen = 19; | |
179 | - } | |
180 | - } | |
181 | - | |
182 | - return array("iso" => $iso, "srclen" => $srclen); | |
183 | - } | |
184 | - | |
185 | - private function WriteDataFromASCII($f,$data_file,$timeFormat,$milli,$fields) | |
186 | - { | |
187 | - fputs($f,"<DATA><TABLEDATA>\n"); | |
188 | - | |
189 | - $in = fopen($data_file['path'],"r"); | |
190 | - | |
191 | - if (!$in) | |
192 | - return array('success' => false, 'message' => $data_file['path']);//"Cannot load input file"); | |
193 | - | |
194 | - while ($line = fgets($in)) | |
195 | - { | |
196 | - $l = trim($line); | |
197 | - if ((strlen($l) <= 0) || $l[0] == '#') | |
198 | - continue; | |
199 | - fputs($f,"<TR>"); | |
200 | - $time = $this->getTimeValue($line,$timeFormat,$milli); | |
201 | - if ($time['iso'] == '') | |
202 | - continue; //cannot load time | |
203 | - fputs($f,"<TD>".$time['iso']."</TD>"); | |
204 | - $l = substr($l,$time['srclen'],strlen($l)-$time['srclen']); | |
205 | - | |
206 | - foreach($fields as $field) | |
207 | - { | |
208 | - if (isset($field['xtype']) && (strcmp($field['xtype'],'dateTime') == 0) && | |
209 | - isset($field['ucd']) && (strcmp($field['ucd'],'time.epoch') == 0)) | |
210 | - continue; //skip time field | |
211 | - if (!isset($field['array_size'])) | |
212 | - $size = 1; | |
213 | - else | |
214 | - $size = $field['array_size']; | |
215 | - fputs($f,"<TD>"); | |
216 | - for ($i = 0; $i < $size; $i++) | |
217 | - { | |
218 | - $l = trim($l); | |
219 | - if ($l == '') | |
220 | - { | |
221 | - // | |
222 | - $l = fgets($in); | |
223 | - $l = trim($l); | |
224 | - } | |
225 | - sscanf($l,"%s",$str_value); | |
226 | - if ($i > 0) | |
227 | -if (!strstr($field['id'], 'xyz')) | |
228 | - fputs($f," "); | |
229 | -else { | |
230 | - fputs($f,"</TD><TD>"); | |
231 | -// $str_value = floatval($str_value) * 3393.00; | |
232 | -} fputs($f,$str_value); | |
233 | - $l = substr($l,strlen($str_value),strlen($l)-strlen($str_value)); | |
234 | - } | |
235 | - fputs($f,"</TD>"); | |
236 | - } | |
237 | - fputs($f,"</TR>\n"); | |
238 | - } | |
239 | - | |
240 | - fclose($in); | |
241 | - | |
242 | - fputs($f,"</TABLEDATA></DATA>\n"); | |
243 | - | |
244 | - return array('success' => true); | |
245 | - } | |
246 | - | |
247 | - | |
248 | - private function WriteTable($f,$input_params) | |
249 | - { | |
250 | - fputs($f,"<TABLE name='".$input_params['table_name']."'>\n"); | |
251 | - | |
252 | - foreach($input_params['fields'] as $field) | |
253 | - { | |
254 | - $refgroupid = $this->WriteInfoGroup($f,$field); | |
255 | - $this->WriteField($f,$field,$refgroupid); | |
256 | - } | |
257 | - | |
258 | - $res = $this->WriteDataFromASCII($f,$input_params['data_file'],$input_params['time_format'],$input_params['time_milli'],$input_params['fields']); | |
259 | - | |
260 | - fputs($f,"</TABLE>\n"); | |
261 | - | |
262 | - return $res; | |
263 | - } | |
264 | - | |
265 | - | |
266 | - private function WriteResource($f,$input_params) | |
267 | - { | |
268 | - fputs($f,"<RESOURCE>\n"); | |
269 | - $this->WriteDescription($f,$input_params['ressource_des']); | |
270 | - $res = $this->WriteTable($f,$input_params); | |
271 | - fputs($f,"</RESOURCE>\n"); | |
272 | - return $res; | |
273 | - } | |
274 | - | |
275 | - | |
276 | - function WriteVOTable($input_params,$output_file) | |
277 | - { | |
278 | - $out = fopen($output_file,"w"); | |
279 | - chmod ($output_file, 0664); | |
280 | - | |
281 | - if (!$out) | |
282 | - return array('success' => false, 'message' => "Cannot create output file"); | |
283 | - | |
284 | - fputs($out,"<?xml version='1.0'?>\n"); | |
285 | - fputs($out,"<VOTABLE version='1.2'"); | |
286 | - fputs($out," xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"); | |
287 | - fputs($out," xsi:schemaLocation='http://www.ivoa.net/xml/VOTable/v1.1 http://www.ivoa.net/xml/VOTable/v1.2'"); | |
288 | - fputs($out," xmlns='http://www.ivoa.net/xml/VOTable/v1.2'>\n"); | |
289 | - | |
290 | - $this->WriteDescription($out,$input_params['general_des']); | |
291 | - $res = $this->WriteResource($out,$input_params); | |
292 | - | |
293 | - fputs($out,"</VOTABLE>\n"); | |
294 | - | |
295 | - fclose($out); | |
296 | - | |
297 | - return $res; | |
298 | - } | |
299 | - | |
300 | - function pushParamFields(&$fields, $param) | |
301 | - { | |
302 | - | |
303 | - $infoMgr = new ParamsInfoMgr(); | |
304 | - | |
305 | - $infos = $infoMgr->GetParamInfo($param); | |
306 | - | |
307 | - if (!$infos['success']) | |
308 | - return $infos; | |
309 | - | |
310 | - switch ($infos['type']) | |
311 | - { | |
312 | - case 'derived' : | |
313 | - array_push($fields, array( | |
314 | - 'field_des' => $infos['infos']['buildchain'], | |
315 | - 'data_type' => 'float', | |
316 | - 'name' => $infos['infos']['name'], | |
317 | - 'id' => $param, | |
318 | - 'ucd' => "", | |
319 | - 'fill_val' => "NaN", | |
320 | - 'unit' => $infos['infos']['units'] | |
321 | - )); | |
322 | - break; | |
323 | - case 'local' : | |
324 | - { | |
325 | - if (!$infos['withcode']) | |
326 | - { | |
327 | - if ($infos['codeinfos']['valuetype']) | |
328 | - switch($infos['valuetype']) | |
329 | - { | |
330 | - case 'FLOAT' : | |
331 | - $valueType = 'float'; | |
332 | - break; | |
333 | - case 'INT' : | |
334 | - $valueType = 'int'; | |
335 | - break; | |
336 | - default : | |
337 | - $valueType = 'float'; | |
338 | - } | |
339 | - | |
340 | - $ucd = $infos['ddinfos']['parameter']['ucd']; | |
341 | - if ($infos['ddinfos']['parameter']['size'] != '') | |
342 | - $size = $infos['ddinfos']['parameter']['size']; | |
343 | - else | |
344 | - $size = $infos['codeinfos']['size']; | |
345 | - | |
346 | - $isarray = ($size > 1); | |
347 | - | |
348 | - if ($infos['ddinfos']['parameter']['name'] != '') | |
349 | - $name = $infos['ddinfos']['parameter']['name']; | |
350 | - else | |
351 | - $name = $infos['codeinfos']['title']; | |
352 | - | |
353 | - if ($isarray) | |
354 | - if ($infos['ddinfos']['parameter']['comps_label'] != '') | |
355 | - $comps_label = $infos['ddinfos']['parameter']['comps_label']; | |
356 | - else $comps_label = $infos['codeinfos']['legend']; | |
357 | - | |
358 | - $desc = $infoMgr->ParamInfosToString($infos); | |
359 | - $fillval = $infos['codeinfos']['fillvalue']; | |
360 | - if ($infos['ddinfos']['parameter']['id'] != '') | |
361 | - $id = $infos['ddinfos']['parameter']['id']; | |
362 | - else | |
363 | - $id = $param; | |
364 | - } | |
365 | - else | |
366 | - { | |
367 | - $valueType = 'float'; | |
368 | - $ucd = $infos['ddinfos']['parameter']['ucd']; | |
369 | - if ($infos['ddinfos']['parameter']['size'] != '') | |
370 | - $size = $infos['ddinfos']['parameter']['size']; | |
371 | - else | |
372 | - $size = $infos['codeinfos']['size']; | |
373 | - | |
374 | - $isarray = ($size > 1); | |
375 | - if ($infos['ddinfos']['parameter']['name'] != '') | |
376 | - $name = $infos['ddinfos']['parameter']['name']; | |
377 | - else | |
378 | - $name = $infos['codeinfos']['title']; | |
379 | - | |
380 | - $comps_label = ''; | |
381 | - if ($isarray) | |
382 | - { | |
383 | - for ($i = 0; $i < $size; $i++) | |
384 | - { | |
385 | - if ($i != 0) | |
386 | - $comps_label .= ' '; | |
387 | - $comps_label .= $name.'_'.$i; | |
388 | - } | |
389 | - } | |
390 | - $desc = $infoMgr->ParamInfosToString($infos); | |
391 | - $fillval = 'NaN'; | |
392 | - $id = $param; | |
393 | - } | |
394 | - if ($infos['ddinfos']['parameter']['units'] != '') | |
395 | - $units = $infos['ddinfos']['parameter']['units']; | |
396 | - else | |
397 | - $units = $infos['codeinfos']['units']; | |
398 | - // $units = $infos['ddinfos']['parameter']['units']; | |
399 | - | |
400 | - if ($isarray) | |
401 | - { | |
402 | - array_push($fields, array( | |
403 | - 'field_des' => $desc, | |
404 | - 'data_type' => $valueType, | |
405 | - 'array_size'=> $size, | |
406 | - 'name' => $name, | |
407 | - 'id' => $param, | |
408 | - 'ucd' => $ucd, | |
409 | - 'fill_val' => $fillval, | |
410 | - 'unit' => $units, | |
411 | - 'comps_label' => $comps_label | |
412 | - )); | |
413 | - } | |
414 | - else | |
415 | - { | |
416 | - array_push($fields, array( | |
417 | - 'field_des' => $desc, | |
418 | - 'data_type' => $valueType, | |
419 | - 'name' => $name, | |
420 | - 'id' => $id, | |
421 | - 'ucd' => $ucd, | |
422 | - 'fill_val' => $fillval, | |
423 | - 'unit' => $units | |
424 | - )); | |
425 | - } | |
426 | - break; | |
427 | - } | |
428 | - case 'mydata' : | |
429 | - { | |
430 | - $valueType = $infos['type']; | |
431 | - $size = $infos['size']; | |
432 | - $name = $infos['name']; | |
433 | - $units = $infos['units']; | |
434 | - $fillval = $infos['fillvalue']; | |
435 | - $id = $infos['realvar']; | |
436 | - $ucd = $infos['mask']; | |
437 | - array_push($fields, array( | |
438 | - 'field_des' => $valueType, | |
439 | - 'data_type' => $valueType, | |
440 | - 'name' => $name, | |
441 | - 'id' => $id, | |
442 | - 'ucd' => $ucd, | |
443 | - 'fill_val' => $fillval, | |
444 | - 'unit' => $units | |
445 | - )); | |
446 | - break; | |
447 | - } | |
448 | - default : | |
449 | - return array('success' => false, 'message' => 'Unknown parameter type : '.$infos['type']); | |
450 | - } | |
451 | - | |
452 | - return array('success' => true); | |
453 | - } | |
454 | - | |
455 | - function getTimeField() | |
456 | - { | |
457 | - return array( | |
458 | - 'param_name' => "Time", | |
459 | - 'field_des' => "Time", | |
460 | - 'data_type' => "char", | |
461 | - 'name' => "Time", | |
462 | - 'id' => "Time", | |
463 | - 'ucd' => "time.epoch", | |
464 | - 'xtype' => "dateTime", | |
465 | - 'fill_val' => "NaN", | |
466 | - 'array_size' => "*" | |
467 | - ); | |
468 | - } | |
469 | - | |
470 | - function downloadResultToVOTable($id,$newName,$opts,$inputCompressed = true,$canBeAlreadyVOTable = false) | |
471 | - { | |
472 | - $dir = USERWORKINGDIR.$id.'_/'; | |
473 | - | |
474 | - if ($inputCompressed) | |
475 | - { | |
476 | - //test if the archive file exist | |
477 | - if (strncmp($opts['compression'],'zip',3) === 0) | |
478 | - $downFile = $dir.$newName.".zip"; | |
479 | - else | |
480 | - $downFile = $dir.$newName.".tar.gz"; | |
481 | - | |
482 | - if (!file_exists($downFile)) | |
483 | - return array('success' => false, 'message' => "Download file ".$downId." doesn't exist"); | |
484 | - } | |
485 | - | |
486 | - // | |
487 | - $params = explode(' ',$opts['params']); | |
488 | - | |
489 | - $files = array(); | |
490 | - $isVOT = $canBeAlreadyVOTable && (strcmp($opts['fileformat'],'vot') === 0); | |
491 | - | |
492 | - switch ($opts['structure']) | |
493 | - { | |
494 | - case '0' : //All In One File | |
495 | - case '1' : //One File Per Time Interval | |
496 | - //get information about fileds (field in VOTable = parameter in AMDA) | |
497 | - $fields = array(); | |
498 | - | |
499 | - //push time field (the first field is the time field) | |
500 | - array_push($fields, $this->getTimeField()); | |
501 | - | |
502 | - //push parameters fields | |
503 | - foreach($params as $param) | |
504 | - { | |
505 | - $res = $this->pushParamFields($fields, $param); | |
506 | - | |
507 | - if (!$res['success']) | |
508 | - return $res; | |
509 | - } | |
510 | - | |
511 | - //extract the archive | |
512 | - chdir($dir); | |
513 | - | |
514 | - if ($isVOT) | |
515 | - $allfile = $newName.".xml"; | |
516 | - else | |
517 | - $allfile = "ALL.txt"; | |
518 | - | |
519 | - if ($inputCompressed) | |
520 | - { | |
521 | - if (strncmp($opts['compression'],'zip',3) === 0) | |
522 | - exec("unzip ".$downFile." ".$allfile); | |
523 | - else | |
524 | - exec("tar -xvzf ".$downFile." ".$allfile); | |
525 | - } | |
526 | - | |
527 | - if (!file_exists($allfile)) | |
528 | - return array('success' => false, 'message' => "Error to extract data (".$allfile.")"); | |
529 | - | |
530 | - //write VO Table | |
531 | - $data_file = array( | |
532 | - 'path' => $allfile); | |
533 | - | |
534 | - $input_params = array('general_des' => "Generated by CDPP/AMDA", | |
535 | - 'ressource_des' => $id, | |
536 | - 'table_name' => $id, | |
537 | - 'fields' => $fields, | |
538 | - 'data_file' => $data_file, | |
539 | - 'time_format' => $opts['timeformat'], | |
540 | - 'time_milli' => $opts['milli']); | |
541 | - | |
542 | - if (!$isVOT) | |
543 | - { | |
544 | - $res = $this->WriteVOTable($input_params,$dir.$newName.'.xml'); | |
545 | - unlink($allfile); | |
546 | - } | |
547 | - else | |
548 | - $res = array('success' => true); | |
549 | - | |
550 | - if (!$res['success']) | |
551 | - return $res; | |
552 | - | |
553 | - array_push($files,USERWORKINGDIR.$id.'_/'.$newName.'.xml'); | |
554 | - break; | |
555 | - case '2' : //One File Per Param/Interval | |
556 | - chdir($dir); | |
557 | - foreach($params as $param) | |
558 | - { | |
559 | - //get information about fileds | |
560 | - $fields = array(); | |
561 | - | |
562 | - //push time field | |
563 | - array_push($fields, $this->getTimeField()); | |
564 | - | |
565 | - $res = $this->pushParamFields($fields, $param); | |
566 | - | |
567 | - if (!$res['success']) | |
568 | - return $res; | |
569 | - | |
570 | - //extract the archive | |
571 | - chdir($dir); | |
572 | - | |
573 | - if ($isVOT) | |
574 | - $filename = $newName."_".$param.'.xml'; | |
575 | - else | |
576 | - $filename = strtoupper($param).".txt"; | |
577 | - | |
578 | - if ($inputCompressed) | |
579 | - { | |
580 | - if (strncmp($opts['compression'],'zip',3) === 0) | |
581 | - exec('unzip '.$downFile.' "'.$filename.'"'); | |
582 | - else | |
583 | - exec('tar -xvzf '.$downFile.' "'.$filename.'"'); | |
584 | - } | |
585 | - | |
586 | - if (!file_exists($filename)) | |
587 | - return array('success' => false, 'message' => "Error to extract data (".$filename.")"); | |
588 | - | |
589 | - //write VO Table | |
590 | - $data_file = array( | |
591 | - 'path' => $filename); | |
592 | - | |
593 | - $input_params = array('general_des' => "Imported from AMDA", | |
594 | - 'ressource_des' => $id."_".$param, | |
595 | - 'table_name' => $id."_".$param, | |
596 | - 'fields' => $fields, | |
597 | - 'data_file' => $data_file, | |
598 | - 'time_format' => $opts['timeformat'], | |
599 | - 'time_milli' => $opts['milli']); | |
600 | - | |
601 | - | |
602 | - if (!$isVOT) | |
603 | - { | |
604 | - $res = $this->WriteVOTable($input_params,$dir.$newName."_".$param.'.xml'); | |
605 | - unlink($filename); | |
606 | - } | |
607 | - else | |
608 | - $res = array('success' => true); | |
609 | - | |
610 | - if (!$res['success']) | |
611 | - return $res; | |
612 | - | |
613 | - | |
614 | - /*$votableMgr = new VOTableMgr(); | |
615 | - $votableMgr->load($dir.$newName."_".$param.'.xml'); | |
616 | - $votableMgr->isValidSchema();*/ | |
617 | - | |
618 | - array_push($files,USERWORKINGDIR.$id.'_/'.$newName."_".$param.'.xml'); | |
619 | - } | |
620 | - break; | |
621 | -// case '3' : // Argument by argument | |
622 | -// | |
623 | -// break; | |
624 | - default : | |
625 | - return array('success' => false, 'message' => "Request type unknown"); | |
626 | - } | |
627 | - | |
628 | - return array('success' => true, 'files' => $files); | |
629 | - } | |
630 | - | |
631 | -} | |
632 | - | |
633 | -?> | |
634 | 0 | \ No newline at end of file |
php/classes/PostProcessing.php deleted
... | ... | @@ -1,213 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * @class PostProcessing | |
4 | - * @version $Id: PostProcessing.php 2806 2015-03-02 15:31:05Z natacha $ | |
5 | - * | |
6 | - * | |
7 | - */ | |
8 | - | |
9 | - class PostProcessing { | |
10 | - | |
11 | - private $myParamsInfoMgr, $contentDom; | |
12 | - protected $xmlName, $rootTag = 'orbitesList', $objTagName = 'orbites'; | |
13 | - protected $attributes = array('name' => '', 'type' => '', 'mission' => '', | |
14 | - 'units' => '','time_resolution' => '', 'fillval' => '', | |
15 | - 'coordinate_system' => '', 'label' => ''); | |
16 | - | |
17 | - function __construct() { | |
18 | - | |
19 | - $this->myParamsInfoMgr = new ParamsInfoMgr(); | |
20 | - $this->xmlName = orbitesXml; | |
21 | - if (file_exists($this->xmlName)) unlink($this->xmlName); | |
22 | - $this->contentDom = new DomDocument("1.0"); | |
23 | - $this->contentDom->preserveWhiteSpace = false; | |
24 | - $this->contentDom->formatOutput = true; | |
25 | - $this->createDom(); | |
26 | - $this->xp = new domxpath($this->contentDom); | |
27 | - | |
28 | - } | |
29 | - | |
30 | - protected function createDom() { | |
31 | - $rootElement = $this->contentDom->createElement('orbitesList'); | |
32 | - $this->contentDom->appendChild($rootElement); | |
33 | - $this->contentDom->save($this->xmlName); | |
34 | - } | |
35 | - | |
36 | -/* | |
37 | -* Add Orbites in Orbites.xml | |
38 | -*/ | |
39 | - protected function addOrbites($obj) { | |
40 | - | |
41 | - $objList = $this->contentDom->documentElement; | |
42 | - $newObj = $this->contentDom->createElement($this->objTagName); | |
43 | - $newObj->setAttribute('xml:id',$this->id); | |
44 | - $obj_arr = (array)$obj; | |
45 | - foreach ($obj_arr as $key => $value) { | |
46 | - if ($key != 'xml:id') $newObj->setAttribute($key, $value); | |
47 | - } | |
48 | - $objList -> appendChild($newObj); | |
49 | - | |
50 | - $this->contentDom->save($this->xmlName); | |
51 | - } | |
52 | - | |
53 | - /***************************************************************** | |
54 | - * PUBLIC FUNCTIONS | |
55 | -*****************************************************************/ | |
56 | - | |
57 | - public function createOrbites() { | |
58 | - | |
59 | - $parametresXml = new DomDocument(); | |
60 | - | |
61 | - if (file_exists(paramXml)) { | |
62 | - $parametresXml -> load(paramXml); | |
63 | - $xpath = new DOMXpath($parametresXml); | |
64 | - | |
65 | - $parametres = $xpath->query("//PARAM[@type='orbit']"); | |
66 | - | |
67 | - if (!is_null($parametres)) { | |
68 | - foreach ($parametres as $parametre) { | |
69 | - | |
70 | - $paramInfo = $this->myParamsInfoMgr->GetDDInfoFromParameterID($parametre->getAttribute('xml:id')); | |
71 | - $mission = $paramInfo['submission']['id']; | |
72 | - if ($mission == '') $mission = $paramInfo['mission_id']; | |
73 | - | |
74 | - echo $parametre->getAttribute('xml:id')." was generated....".$mission.PHP_EOL; | |
75 | - | |
76 | - if ($mission != '') { | |
77 | - $obj = (object)array( | |
78 | - "param" => $parametre->getAttribute('xml:id'), | |
79 | - "name" => $parametre->getAttribute('name'), | |
80 | - "type" => $parametre->getAttribute('type'), | |
81 | - "mission" => strtoupper($mission), | |
82 | - "units" => $parametre->getElementsByTagName('UNITS')->item(0)->nodeValue, | |
83 | - "time_resolution" => $parametre->getElementsByTagName('TIME_RESOLUTION')->item(0)->nodeValue, | |
84 | - "fillval" => $parametre->getElementsByTagName('FILLVAL')->item(0)->nodeValue, | |
85 | - "coordinate_system" => $parametre->getElementsByTagName('COORDINATE_SYSTEM')->item(0)->nodeValue, | |
86 | - "label" => $parametre->getElementsByTagName('LABEL_I')->item(0)->nodeValue | |
87 | - ); | |
88 | - $this->id = $obj->param; | |
89 | - $this -> addOrbites($obj); | |
90 | - } | |
91 | - } | |
92 | - | |
93 | - } | |
94 | - else { | |
95 | - return array('success' => false, 'message' => "Local param file is empty"); | |
96 | - } | |
97 | - } | |
98 | - else { | |
99 | - echo "Local param file doesn't exist ".paramXml.PHP_EOL; | |
100 | - return array('success' => false, 'message' => "Local param file doesn't exist"); | |
101 | - } | |
102 | - } | |
103 | - | |
104 | - public function createOrbitesInfoFiles($locBases){ | |
105 | - | |
106 | - $domTargets = new DomDocument(); | |
107 | - if (!$domTargets->load(targetsSimu)) { | |
108 | - $msg = "Cannot load file ".targetsSimu.PHP_EOL; | |
109 | - if (!$this->updateOnly) error_log($msg,1,email); | |
110 | - continue; | |
111 | - } | |
112 | - | |
113 | - $targets = $domTargets->getElementsByTagName('target'); | |
114 | - | |
115 | - foreach ($targets as $target) { | |
116 | - $help = "<h2> ".$target->nodeValue." </b></a></h2><UL><br/><br/><li><b>Orbits of satellites :</b><br/><br/>"; | |
117 | - foreach ($locBases as $locBase) | |
118 | - { | |
119 | - if (strpos($locBase->getAttribute('targets'),$target->nodeValue) !== FALSE){ | |
120 | - $sat = $locBase->nodeValue; | |
121 | -echo "Loc Base is $sat & target is ".$target->nodeValue.PHP_EOL; | |
122 | - $domName = LocalData."DD_".$sat.".xml"; | |
123 | - $domParamName = LocalDataParam.$sat.".xml"; | |
124 | - $help = $help."<p><b>$sat: </b> <br/>"; | |
125 | - $dom = new DomDocument(); | |
126 | - if (!$dom->load($domName)) { | |
127 | - $msg = "Cannot load file ".$domName.PHP_EOL; | |
128 | - print_r($msg); | |
129 | - if (!$this->updateOnly) error_log($msg,1,email); | |
130 | - continue; | |
131 | - } | |
132 | - $domParam = new DomDocument(); | |
133 | - if (!$domParam->load($domParamName)) { | |
134 | - $msg = "Cannot load file ".$domParamName.PHP_EOL; | |
135 | - print_r($msg); | |
136 | - if (!$this->updateOnly) error_log($msg,1,email); | |
137 | - continue; | |
138 | - } | |
139 | - $domOrbites = new DomDocument(); | |
140 | - if (!$domOrbites->load(orbitesXml)) { | |
141 | - $msg = "Cannot load file ".orbitesXml.PHP_EOL; | |
142 | - print_r($msg); | |
143 | - if (!$this->updateOnly) error_log($msg,1,email); | |
144 | - continue; | |
145 | - } | |
146 | - $xp = new domxpath($dom); | |
147 | - $xpParam = new domxpath($domParam); | |
148 | - $xpOrb = new domxpath($domOrbites); | |
149 | - | |
150 | - $body = explode('.',$target->nodeValue); | |
151 | - $query = "//dataset"; | |
152 | - $datasets = $xp->query($query); | |
153 | - if ($datasets->length > 0){ | |
154 | - foreach ($datasets as $dataset){ | |
155 | - $vi = $dataset->getAttribute('xml:id'); | |
156 | - $query = "//PARAM[@vi='$vi']"; | |
157 | - $param = $xpParam->query($query); | |
158 | - if($param->length > 0){ | |
159 | - $paramID = $param->item(0)->getAttribute('xml:id'); | |
160 | - $query = "//orbites[@xml:id='$paramID']"; | |
161 | - | |
162 | - $orbites = $xpOrb->query($query); | |
163 | - | |
164 | - if ($orbites->length > 0) { // && $dataset->getElementsByTagName('target')->item(0)->nodeValue == $body[0]){ | |
165 | - | |
166 | - if ($dataset->getElementsByTagName('target')->item(0)->nodeValue == $body[0] ){ | |
167 | -// $help = $help."<p><b>$sat: </b> "; | |
168 | - $title = $dataset->getElementsByTagName('title')->item(0)->nodeValue; | |
169 | - $start = $dataset->getElementsByTagName('dataStart')->item(0)->nodeValue; | |
170 | - $stop = $dataset->getElementsByTagName('dataStop')->item(0)->nodeValue; | |
171 | - | |
172 | - $help = $help."$title: $start - $stop</p>"; | |
173 | - if ($target->nodeValue == 'Ganymede') $help = $help."<p>You can find the Ganymede flyby TimeTable in the <b>Shared Time Tables/OTHER/ganymede_flyby</b> | |
174 | - </p><br/>1996-06-27T06:07:08 - 1996-06-27T06:52:37 45.48 min <br/> | |
175 | -1996-09-06T18:32:44 - 1996-09-06T19:28:22 - 55.63 min <br/> | |
176 | -1997-04-05T06:44:41 - 1997-04-05T07:40:19 - 55.63 min <br/> | |
177 | -1997-05-07T15:36:54 - 1997-05-07T16:22:24 - 45.50 min <br/> | |
178 | -1997-06-26T16:50:00 - 1997-06-26T17:49:56 - 59.93 min <br/> | |
179 | -1997-12-15T09:30:23 - 1997-12-15T10:30:00 - 59.62 min <br/> | |
180 | -2000-05-20T09:40:04 - 2000-05-20T10:40:41 - 60.62 min <br/> | |
181 | -2000-12-28T07:54:41 - 2000-12-28T08:55:21 - 60.67 min <br/>"; | |
182 | - } | |
183 | - elseif ($dataset->getElementsByTagName('title')->item(0)->nodeValue == 'ToDo' || | |
184 | - $dataset->getAttribute('name') == 'orbit'){ | |
185 | -// $help = $help."<p><b>$sat: </b> "; | |
186 | - $start = $dataset->getElementsByTagName('dataStart')->item(0)->nodeValue; | |
187 | - $stop = $dataset->getElementsByTagName('dataStop')->item(0)->nodeValue; | |
188 | - $help = $help.$orbites->item(0)->getAttribute('mission')." $start - $stop</p>"; | |
189 | - } | |
190 | - elseif ($dataset->getElementsByTagName('title')->item(0)->nodeValue == 'CLUSTER1' || | |
191 | - $dataset->getElementsByTagName('title')->item(0)->nodeValue == 'CLUSTER2' || | |
192 | - $dataset->getElementsByTagName('title')->item(0)->nodeValue == 'CLUSTER3' || | |
193 | - $dataset->getElementsByTagName('title')->item(0)->nodeValue == 'CLUSTER4'){ | |
194 | -// $help = $help."<p><b>$sat: </b> "; | |
195 | - $start = $dataset->getElementsByTagName('dataStart')->item(0)->nodeValue; | |
196 | - $stop = $dataset->getElementsByTagName('dataStop')->item(0)->nodeValue; | |
197 | - $help = $help.$orbites->item(0)->getAttribute('param')." $start - $stop</p>"; | |
198 | - } | |
199 | - | |
200 | - } | |
201 | - } | |
202 | - } | |
203 | - } | |
204 | - } | |
205 | - } | |
206 | - $help = $help."</UL>"; | |
207 | - $fileName = HELPPATH."simu/simu".$target->nodeValue; | |
208 | - file_put_contents($fileName, $help); | |
209 | - } | |
210 | - return true; | |
211 | - | |
212 | - } | |
213 | - } | |
214 | 0 | \ No newline at end of file |
php/classes/SimuArgsMgr.php deleted
... | ... | @@ -1,144 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | - * @class SimuArgsMgr | |
4 | - * @version | |
5 | - * | |
6 | - */ | |
7 | - | |
8 | - | |
9 | - class SimuArgsMgr { | |
10 | - | |
11 | - protected $paramID; | |
12 | - protected $dataProducteur; | |
13 | - protected $dom; | |
14 | - protected $simulatedRegion; | |
15 | - | |
16 | - function __construct() { | |
17 | - | |
18 | - } | |
19 | - | |
20 | -/***************************************************************** | |
21 | -* PUBLIC FUNCTIONS | |
22 | -*****************************************************************/ | |
23 | - public function init($paramID){ | |
24 | - | |
25 | - $this->paramID = $paramID; | |
26 | - if ((strncmp($this->paramID, "impex___", 8) === 0) || (strncmp($this->paramID, "spase___", 8) === 0)){ | |
27 | - $this->getDataProducteur(); | |
28 | - $this->dom = new DomDocument("1.0"); | |
29 | - $this->dom->load(USERWSDIR.'RemoteParams.xml'); | |
30 | - if ($this->dataProducteur == 'FMI_GUMICS') | |
31 | - $this->simulatedRegion = 'Earth.Magnetosphere'; | |
32 | - else | |
33 | - $this->getSimulatedRegion(); | |
34 | - } | |
35 | - } | |
36 | - | |
37 | - protected function getDataProducteur(){ | |
38 | - if (strncmp($this->paramID, "impex___", 8) === 0) | |
39 | - $par = str_replace ("impex___", "", $this->paramID); | |
40 | - elseif (strncmp($this->paramID, "spase___", 8) === 0) | |
41 | - $par = str_replace ("spase___IMPEX_NumericalOutput_", "", $this->paramID); | |
42 | - // TODO tests | |
43 | - $tmp = explode( '_', $par); | |
44 | - | |
45 | - if ($tmp[0] == 'FMI') | |
46 | - $this->dataProducteur = $tmp[0].'_'.$tmp[1]; | |
47 | - else | |
48 | - $this->dataProducteur = $tmp[0]; | |
49 | - } | |
50 | - | |
51 | - protected function getSimulatedRegion(){ | |
52 | - $param = $this->dom->getElementById(trim($this->paramID)); | |
53 | - $parentID = $param->getAttribute('parentID'); | |
54 | - $dataSet = $this->dom->getElementById($parentID); | |
55 | - $this->simulatedRegion = $dataSet->getAttribute('SimulatedRegion'); | |
56 | - | |
57 | - } | |
58 | - | |
59 | - protected function getMissionsBySimuRegion(){ | |
60 | - $missions = simplexml_load_file(missionXml); | |
61 | - $missionsVal = array(); | |
62 | - foreach($missions->Local->MissionID as $mission){ | |
63 | - if (stripos ($mission['targets'], trim($this->simulatedRegion)) !== false ){ | |
64 | - if ( !isset($mission['group']) || (isset($mission['group']) && $mission['group'] != 'TEST')) { | |
65 | - $multypMissions = array(); | |
66 | - if ($mission['missions'] != '') | |
67 | - $multypMissions = explode(';',$mission['missions']); | |
68 | - else | |
69 | - $multypMissions[0] = (string)$mission; | |
70 | - | |
71 | - $missionsVal = array_merge($missionsVal,$multypMissions); | |
72 | - } | |
73 | - } | |
74 | - } | |
75 | - sort($missionsVal); | |
76 | - return $missionsVal; | |
77 | - } | |
78 | - | |
79 | - public function makeSimuArgs(){ | |
80 | - if ($this->dataProducteur != 'CCMC'){ | |
81 | - $missions = $this->getMissionsBySimuRegion(); | |
82 | - | |
83 | - if (count($missions) == 1) | |
84 | - $grp[] = array("group" => "Satellite", "args" => array("value" => $missions[0])); | |
85 | - elseif (count($missions) > 1){ | |
86 | - foreach ($missions as $mission){ | |
87 | - $miss[] = array ("arg" => $mission, "value" => $mission); | |
88 | - } | |
89 | - $grp[] = array("group" => "Satellite", "args" => $miss); | |
90 | - } | |
91 | - | |
92 | - | |
93 | - switch ($this->dataProducteur){ | |
94 | - case 'LATMOS': | |
95 | - $grp[] = array("group" => "ClockAngle", "args" => array("value" => "0")); | |
96 | - | |
97 | - break; | |
98 | - case 'SINP': | |
99 | - if ($this->simulatedRegion == 'Mercury.Magnetosphere'){ | |
100 | - $grp[] = array("group" => "BD", "args" => array("value" => "-196.0")); | |
101 | - $grp[] = array("group" => "Flux", "args" => array("value" => "4.0")); | |
102 | - $grp[] = array("group" => "Rss", "args" => array("value" => "1.35")); | |
103 | - $grp[] = array("group" => "R2", "args" => array("value" => "1.32")); | |
104 | - $grp[] = array("group" => "DZ", "args" => array("value" => "0.0")); | |
105 | - $grp[] = array("group" => "IMF_Bx", "args" => array("value" => "0.0")); | |
106 | - $grp[] = array("group" => "IMF_By", "args" => array("value" => "0.0")); | |
107 | - $grp[] = array("group" => "IMF_Bz", "args" => array("value" => "0.0")); | |
108 | - } | |
109 | - elseif ($this->simulatedRegion == 'Saturn.Magnetosphere'){ | |
110 | - $grp[] = array("group" => "BDC", "args" => array("value" => "3.0")); | |
111 | - $grp[] = array("group" => "BT", "args" => array("value" => "7.0")); | |
112 | - $grp[] = array("group" => "Rss", "args" => array("value" => "22.0")); | |
113 | - $grp[] = array("group" => "RD1", "args" => array("value" => "15.0")); | |
114 | - $grp[] = array("group" => "RD2", "args" => array("value" => "6.5")); | |
115 | - $grp[] = array("group" => "R2", "args" => array("value" => "18.0")); | |
116 | - $grp[] = array("group" => "IMF_Bx", "args" => array("value" => "0.0")); | |
117 | - $grp[] = array("group" => "IMF_By", "args" => array("value" => "0.0")); | |
118 | - $grp[] = array("group" => "IMF_Bz", "args" => array("value" => "0.0")); | |
119 | - } | |
120 | - elseif ($this->simulatedRegion == 'Jupiter.Magnetosphere'){ | |
121 | - $grp[] = array("group" => "BDC", "args" => array("value" => "3.0")); | |
122 | - $grp[] = array("group" => "BT", "args" => array("value" => "7.0")); | |
123 | - $grp[] = array("group" => "Rss", "args" => array("value" => "22.0")); | |
124 | - $grp[] = array("group" => "RD1", "args" => array("value" => "15.0")); | |
125 | - $grp[] = array("group" => "RD2", "args" => array("value" => "6.5")); | |
126 | - $grp[] = array("group" => "R2", "args" => array("value" => "18.0")); | |
127 | - $grp[] = array("group" => "IMF_Bx", "args" => array("value" => "0.0")); | |
128 | - $grp[] = array("group" => "IMF_By", "args" => array("value" => "0.0")); | |
129 | - $grp[] = array("group" => "IMF_Bz", "args" => array("value" => "0.0")); | |
130 | - } | |
131 | - break; | |
132 | - case 'LESIA': | |
133 | - break; | |
134 | - } | |
135 | - | |
136 | - return $grp; | |
137 | - } | |
138 | - return; | |
139 | - } | |
140 | - | |
141 | - | |
142 | - } | |
143 | - | |
144 | -?> |
php/classes/SimuParamMgr.php deleted
... | ... | @@ -1,384 +0,0 @@ |
1 | -<?php | |
2 | -/** | |
3 | -* @class SimuParamMgr.php | |
4 | -* @brief Simations parameters Manager (Simulations db client) | |
5 | -* | |
6 | -* @version $Id: SimuParamMgr.php 2914 2015-05-19 10:31:38Z elena $ | |
7 | -*/ | |
8 | - class SimuParamMgr | |
9 | - { | |
10 | -// input parameters | |
11 | - protected $extraParam, $sampling,$paramAtribute; | |
12 | - protected $dataProducteur; | |
13 | - protected $orbitsURL; | |
14 | - protected $parameterID, $resourceID; | |
15 | - protected $isArgument, $isVector; | |
16 | - protected $mission; | |
17 | - protected $soapMethode; | |
18 | - public $startTime, $stopTime; | |
19 | - function __construct() { | |
20 | - ini_set("soap.wsdl_cache_enabled", "0"); | |
21 | - } | |
22 | - | |
23 | - public function setParams($paramID, $startDate, $stopDate, $paramsAtribute){ | |
24 | - $this->parameterID= $paramID; | |
25 | - $this->startTime= $startDate; | |
26 | - $this->stopTime= $stopDate; | |
27 | - $this->paramAtribute= $paramsAtribute; | |
28 | - $this->mission= $this->paramAtribute[$this->parameterID]['Satellite']; | |
29 | - $this->isArgument = false; | |
30 | - $this->isVector = false; | |
31 | - $this->dataProducteur = $this->getDataProducteur(); | |
32 | - } | |
33 | - | |
34 | - public function updateInterval($start, $stop){ | |
35 | - $this->startTime = gmdate("Y-m-d\TH:i:s\Z", $start); | |
36 | - $this->stopTime = gmdate("Y-m-d\TH:i:s\Z", $stop); | |
37 | - } | |
38 | - | |
39 | - private function getOrbitsURL(){ | |
40 | - try { | |
41 | - $client = new SoapClient(wsdl_AMDA, | |
42 | - array( | |
43 | - 'wsdl_cache' => 0, | |
44 | - 'trace' => 1, | |
45 | - 'soap_version'=>SOAP_1_2 | |
46 | - )); | |
47 | - } | |
48 | - catch (SoapFault $exception) { | |
49 | - error_log("Problem with WSDL".PHP_EOL.$exception->getMessage().PHP_EOL.$exception->getTraceAsString().PHP_EOL."File = ".$exception->getFile(),1,email); | |
50 | - return false; | |
51 | - } | |
52 | - | |
53 | - $params = array('spacecraft'=> strtoupper($this->mission), | |
54 | - 'startTime'=> $this->startTime, | |
55 | - 'stopTime'=> $this->stopTime, | |
56 | - 'coordinateSystem'=> $this->getCoordinateSystem(), | |
57 | - 'units'=> $this->getDomainUnits(), | |
58 | - 'outputFormat' => 'VOTable'); | |
59 | - | |
60 | - if ( strtoupper($this->mission) == "MESSENGER") $params['sampling'] = 60; | |
61 | - if ( strtoupper($this->mission) == "GALILEO") $params['sampling'] = 60; | |
62 | - | |
63 | - try { | |
64 | - $file = $client->__soapCall("getOrbites", array($params)); | |
65 | - } | |
66 | - catch (SoapFault $exception) { | |
67 | - error_log("Problem with query".PHP_EOL.$exception->getMessage().PHP_EOL.$exception->getTraceAsString().PHP_EOL."File = ".$exception->getFile(),1,email); | |
68 | - return false; | |
69 | - } | |
70 | - | |
71 | - $orbitURL = $file->dataFileURLs; | |
72 | - | |
73 | - return $orbitURL; | |
74 | - } | |
75 | - | |
76 | - private function makeRequest(){ | |
77 | - | |
78 | - $this->setResourceID(); | |
79 | - | |
80 | - if ($this->productor == 'LESIA'){ | |
81 | - $params = array('ResourceID'=> $this->resourceID, | |
82 | - 'Spacecraft_name'=> $this->mission, | |
83 | - 'StartTime'=> $this->startTime, | |
84 | - 'StopTime'=> $this->stopTime, | |
85 | - 'Sampling'=> $this->sampling, | |
86 | - 'extraParams'=> $this->extraParam); | |
87 | - | |
88 | - } | |
89 | - elseif ($this->productor == 'LATMOS') { | |
90 | - $clockAngle = $this->paramAtribute[$this->parameterID]['ClockAngle']; | |
91 | - $var = $this->getVariable($this->parameterID); | |
92 | - | |
93 | - if (!$this->isVector) { | |
94 | - $params = array('ResourceID'=> $this->resourceID, | |
95 | - 'url_XYZ'=> $this->getOrbitsURL(), | |
96 | - 'extraParams'=> $this->extraParam, | |
97 | - 'IMFClockAngle'=> $clockAngle, | |
98 | - 'Variable'=> $var); | |
99 | - } | |
100 | - else { | |
101 | - $params = array('ResourceID'=> $this->resourceID, | |
102 | - 'url_XYZ'=> $this->getOrbitsURL(), | |
103 | - 'extraParams'=> $this->extraParam, | |
104 | - 'IMFClockAngle'=> $clockAngle); | |
105 | - } | |
106 | - } | |
107 | - else { | |
108 | - $params = array('ResourceID'=> $this->resourceID, | |
109 | - 'url_XYZ'=> $this->getOrbitsURL(), | |
110 | - 'extraParams'=> $this->extraParam); | |
111 | - // 'Variable'=> $this->getVariable($this->parameterID)); | |
112 | - } | |
113 | - return $params; | |
114 | - } | |
115 | - | |
116 | - private function getDataProducteurWSDL(){ | |
117 | - // TODO tests | |
118 | - | |
119 | - switch ($this->dataProducteur){ | |
120 | - case 'LATMOS': | |
121 | - $wsdl = wsdl_LATMOS; | |
122 | - $this->productor = 'LATMOS'; | |
123 | - $this->soapMethode = 'getDataPointValue'; | |
124 | - break; | |
125 | - case 'FMI_HYB': | |
126 | - $wsdl = wsdl_FMI; | |
127 | - $this->productor = 'FMI_HYBRID'; | |
128 | - // $this->extraParam= array('InterpolationMethod' => $options[3]); | |
129 | - $outputFileType = array('OutputFileType'=>'VOTable'); | |
130 | - $this->soapMethode = 'getDataPointValue'; | |
131 | - $this->extraParam= $outputFileType; | |
132 | - break; | |
133 | - case 'FMI_GUMICS': | |
134 | - $wsdl = wsdl_FMI; | |
135 | - $this->productor = 'FMI_GUMICS'; | |
136 | - // $this->extraParam= array('InterpolationMethod' => $options[3]); | |
137 | - $outputFileType = array('OutputFileType'=>'VOTable'); | |
138 | - $this->soapMethode = 'getDataPointValue'; | |
139 | - $this->extraParam= $outputFileType; | |
140 | - break; | |
141 | - case 'SINP': | |
142 | - $wsdl = wsdl_SINP; | |
143 | - $this->productor = 'SINP'; | |
144 | - // $extraParam = array(); | |
145 | - $imf_b = array(); | |
146 | - $this->extraParam['OutputFileType']= 'VOTable'; | |
147 | - if (strpos($this->parameterID,'Earth') !== FALSE) | |
148 | - $this->soapMethode = 'calculateDataPointValue'; | |
149 | - elseif ((strpos($this->parameterID,'Mercury') !== FALSE)||(strpos($this->parameterID,'Saturn') !== FALSE) ||(strpos($this->parameterID,'Jupiter') !== FALSE)){ | |
150 | - if (strpos($this->parameterID,'Mercury') !== FALSE) | |
151 | - $this->soapMethode = 'calculateDataPointValueMercury'; | |
152 | - elseif (strpos($this->parameterID,'Saturn') !== FALSE) | |
153 | - $this->soapMethode = 'calculateDataPointValueSaturn'; | |
154 | - elseif (strpos($this->parameterID,'Jupiter') !== FALSE) | |
155 | - $this->soapMethode = 'calculateDataPointValueJupiter'; | |
156 | - foreach($this->paramAtribute[$this->parameterID] as $key => $value){ | |
157 | - if ($key != 'Satellite'){ | |
158 | - if ($key != 'IMF_Bx' && $key != 'IMF_By' && $key != 'IMF_Bz') | |
159 | - $this->extraParam[$key]= $value; | |
160 | - else { | |
161 | - switch ($key){ | |
162 | - case 'IMF_Bx': | |
163 | - $imf_b['x'] = $value; | |
164 | - break; | |
165 | - case 'IMF_By': | |
166 | - $imf_b['y'] = $value; | |
167 | - break; | |
168 | - case 'IMF_Bz': | |
169 | - $imf_b['z'] = $value; | |
170 | - break; | |
171 | - } | |
172 | - } | |
173 | - } | |
174 | - } | |
175 | - $this->extraParam['IMF_B']= $imf_b; | |
176 | - } | |
177 | - | |
178 | - break; | |
179 | - case 'LESIA': | |
180 | - $wsdl = wsdl_LESIA; | |
181 | - $this->productor = 'LESIA'; | |
182 | - $this->soapMethode = 'calculateDataPointValue_Spacecraft'; | |
183 | - $this->extraParam= array('OutputFileType'=>'VOTable', | |
184 | - 'InternalModel'=>$this->paramAtribute[$this->parameterID]['InternalModel'], | |
185 | - 'CurrentSheet'=>$this->paramAtribute[$this->parameterID]['CurrentSheet'], | |
186 | - 'CoordinateSystem'=>$this->paramAtribute[$this->parameterID]['CoordinateSystem'] | |
187 | - ); | |
188 | - $this->sampling = $this->paramAtribute[$this->parameterID]['sampling']; | |
189 | - break; | |
190 | - } | |
191 | - return $wsdl; | |
192 | - } | |
193 | - | |
194 | - private function setResourceID(){ | |
195 | - | |
196 | - $this->resourceID = $this->dom->getElementById($this->parameterID)->getAttribute('parentID'); | |
197 | - | |
198 | - if (($this->dom->getElementById($this->parameterID)->nodeName)=='component') $this->isArgument = true; | |
199 | - else { | |
200 | - $this->isArgument = false; | |
201 | - if ($this->dom->getElementById($this->parameterID)->getAttribute('size') == 3) | |
202 | - { | |
203 | - $this->isVector = true; | |
204 | - } | |
205 | - } | |
206 | - // return $this->resourceID; | |
207 | - } | |
208 | - | |
209 | - private function getDomainUnits(){ | |
210 | - $units = $this->dom->getElementById($this->resourceID)->getAttribute('domainUnits'); | |
211 | - if ($units == 'm') $units='km'; | |
212 | - return $units; | |
213 | - } | |
214 | - | |
215 | - private function getCoordinateSystem(){ | |
216 | - return $this->dom->getElementById($this->resourceID)->getAttribute('coordinateSystem'); | |
217 | - } | |
218 | - | |
219 | - private function addFile($fileName){ | |
220 | - | |
221 | - $myBaseManager = new BaseManager(); | |
222 | - $start = strtotime($this->startTime); | |
223 | - $stop = strtotime($this->stopTime); | |
224 | - $mask = $myBaseManager->addWsFile($fileName, $start, $stop); | |
225 | - if ($mask != null) { | |
226 | - $startstop = $myBaseManager->getStartStop($myBaseManager->getVi($mask)); | |
227 | - } | |
228 | - return array( 'success' => true, 'file' => $fileName); | |
229 | - } | |
230 | - | |
231 | - private function getVariable($paramID){ | |
232 | - $tmp = explode( '_', $paramID); | |
233 | - $n = count($tmp)-1; | |
234 | - $var = $tmp[$n]; | |
235 | - | |
236 | - return $var; | |
237 | - } | |
238 | - | |
239 | - private function getVectorName($paramID){ | |
240 | - $tmp = explode( '_', $paramID); | |
241 | - $n = count($tmp)-1; | |
242 | - $var = $tmp[$n-2].'_'.$tmp[$n-1].'_'.$tmp[$n]; | |
243 | - | |
244 | - return $var; | |
245 | - } | |
246 | - | |
247 | - private function getDataProducteur(){ | |
248 | - | |
249 | - if (strncmp($this->parameterID, "impex___", 8) === 0) | |
250 | - $par = str_replace ("impex___", "", $this->parameterID); | |
251 | - elseif (strncmp($this->parameterID, "spase___IMPEX_NumericalOutput_", 30) === 0) | |
252 | - $par = str_replace ("spase___IMPEX_NumericalOutput_", "", $this->parameterID); | |
253 | - elseif (strncmp($this->parameterID, "spase___IMPEX_SimulationRun_", 28) === 0) | |
254 | - $par = str_replace ("spase___IMPEX_SimulationRun_", "", $this->parameterID); | |
255 | - | |
256 | - // TODO tests | |
257 | - $tmp = explode( '_', $par); | |
258 | - if ($tmp[0]== 'FMI') | |
259 | - return $tmp[0].'_'.$tmp[1]; | |
260 | - else | |
261 | - return $tmp[0]; | |
262 | - | |
263 | - } | |
264 | - | |
265 | - public function getFileName(){ | |
266 | - | |
267 | - $paramID = $this->parameterID; | |
268 | - $paramAtribute = $this->paramAtribute[$this->parameterID]; | |
269 | - foreach ($paramAtribute as $k => $v) | |
270 | - $args = $args.$v.'_'; | |
271 | - $fileName = $paramID.'_'.$args.strtotime($this->startTime).'_'.strtotime($this->stopTime).'.xml'; | |
272 | - return $fileName; | |
273 | - } | |
274 | - | |
275 | - public function getMask(){ | |
276 | - $paramID = $this->parameterID; | |
277 | - | |
278 | - $paramAtribute = $this->paramAtribute[$this->parameterID]; | |
279 | - foreach ($paramAtribute as $k => $v) | |
280 | - $args = $args.$v.'_'; | |
281 | - $mask = $paramID.'_'.$args.'*.xml'; | |
282 | - return $mask; | |
283 | - } | |
284 | - | |
285 | - public function isVector(){ | |
286 | - | |
287 | - return $this->isVector; | |
288 | - } | |
289 | - | |
290 | - | |
291 | - public function getSimuData() | |
292 | - { | |
293 | - $simuFilenames = array(); | |
294 | - | |
295 | - if ((strncmp($this->parameterID, "impex___", 8) === 0) || (strncmp($this->parameterID, "spase___", 8) === 0)) | |
296 | - { | |
297 | - $paramID = $this->parameterID; | |
298 | - $fileName = $this->getFileName(); | |
299 | - $newfile = getenv('USER_DATA_PATH').$fileName; | |
300 | - | |
301 | - if (!file_exists ($newfile)) | |
302 | - { | |
303 | - if ($this->dataProducteur != 'CCMC') | |
304 | - { | |
305 | - try { | |
306 | - $client = new SoapClient($this->getDataProducteurWSDL(), | |
307 | - array( | |
308 | - 'wsdl_cache' => 0, | |
309 | - 'trace' => 1, | |
310 | - 'soap_version'=>SOAP_1_2 | |
311 | - )); | |
312 | - } | |
313 | - catch (SoapFault $exception) { | |
314 | - error_log("Problem with WSDL".PHP_EOL.$exception->getMessage().PHP_EOL.$exception->getTraceAsString().PHP_EOL."File = ".$exception->getFile(),1,email); | |
315 | - return false; | |
316 | - } | |
317 | - | |
318 | - if ($this->productor != 'FMI_GUMICS') | |
319 | - $xml = RemoteData.$this->productor."/base.xml"; | |
320 | - else | |
321 | - $xml = getenv('USER_WS_PATH').'RemoteParams.xml'; | |
322 | - | |
323 | - $this->dom = new DOMDocument('1.0', 'utf-8'); | |
324 | - $this->dom->load($xml); | |
325 | - $params = $this->makeRequest($this->parameterID); | |
326 | - | |
327 | - | |
328 | - try { | |
329 | - $file = $client->__soapCall($this->soapMethode, array($params)); | |
330 | - } | |
331 | - catch (SoapFault $exception) { | |
332 | - error_log($exception->getMessage().PHP_EOL.$exception->getTraceAsString(),1,email); | |
333 | - return false; | |
334 | - } | |
335 | - | |
336 | - if (!copy($file, $newfile)) { | |
337 | - error_log('Can\'t copy '.$file,1,email); | |
338 | - return false; | |
339 | - } | |
340 | - else { | |
341 | - if ($this->isVector){ | |
342 | - $vectorName = $this->getVectorName($paramID); | |
343 | - $myVOTableMgr = new VOTableMgr(); | |
344 | - $myVOTableMgr->args2vector($newfile, $vectorName); | |
345 | - } | |
346 | - $this->addFile($fileName); | |
347 | - $simuFilenames[$paramID] = $fileName; | |
348 | - } | |
349 | - } // end if $this->dataProducteur != 'CCMC' | |
350 | - else { | |
351 | - $docBase = new DOMDocument(); | |
352 | - $docBase->load(RemoteData.'CCMC/base.xml'); | |
353 | - $elementParam = $docBase->getElementById($this->parameterID); | |
354 | - | |
355 | - if ($elementParam->tagName == 'component') | |
356 | - $accessURL = $elementParam->parentNode->parentNode->getAttribute('AccessURL'); | |
357 | - elseif ($elementParam->tagName == 'parameter'){ | |
358 | - $accessURL = $elementParam->parentNode->getAttribute('AccessURL'); | |
359 | - if ($elementParam->getAttribute('size') == 3) $this->isVector = true; | |
360 | - } | |
361 | - else {} | |
362 | - | |
363 | - $doc = new DOMDocument(); | |
364 | - $doc->load($accessURL); | |
365 | - $doc->save($newfile); | |
366 | - | |
367 | - if ($this->isVector){ | |
368 | - $vectorName = $this->getVectorName($this->parameterID); | |
369 | - $myVOTableMgr = new VOTableMgr(); | |
370 | - $myVOTableMgr->args2vector($newfile, $vectorName); | |
371 | - } | |
372 | - | |
373 | - $this->addFile($fileName); | |
374 | - $simuFilenames[$paramID] = $fileName; | |
375 | - } | |
376 | - } // if (!file_exists ($newfile)) | |
377 | - } // if ((strncmp($this->parameterID, "impex___", 8) === 0) | | |
378 | - | |
379 | - return $simuFilenames; | |
380 | - } | |
381 | - | |
382 | - } | |
383 | -?> | |
384 | - |
php/old_amda/getFileNames.php deleted
... | ... | @@ -1,21 +0,0 @@ |
1 | -<?php | |
2 | - $id = $argv[1]; | |
3 | - $st = (int)$argv[2]; | |
4 | - $dt = (int)$argv[3]; | |
5 | - $dom = new DomDocument("1.0"); | |
6 | - $dom->load(getenv('USER_DATA_PATH').'base.xml'); | |
7 | - $vi = $dom->getElementById($id); | |
8 | - $files = $vi->getElementsByTagName("file"); | |
9 | - if ($files->length > 0) | |
10 | - foreach ($files as $file) { | |
11 | - if ($file->getAttribute("stop") < $st) { | |
12 | - continue; | |
13 | - } | |
14 | - if ($file->getAttribute("start") >= $st + $dt){ | |
15 | - break; | |
16 | - } | |
17 | -//error_log($file->getAttribute("name"),3,'mylog'); | |
18 | - echo $file->getAttribute("name").","; | |
19 | - } | |
20 | - exit(); | |
21 | -?> |
php/old_amda/getViStart.php deleted
... | ... | @@ -1,11 +0,0 @@ |
1 | -<?php | |
2 | - /** | |
3 | - * $Id: getViStart.php 2534 2014-10-02 16:17:30Z elena $ | |
4 | -*/ | |
5 | - $dom = new DomDocument("1.0"); | |
6 | - | |
7 | - $dom->load(getenv('USER_DATA_PATH').'base.xml'); | |
8 | - $vi = $dom->getElementById($argv[1]); | |
9 | - echo $vi->getAttribute("start"); | |
10 | - exit(); | |
11 | -?> | |
12 | 0 | \ No newline at end of file |
php/old_amda/getViStop.php deleted
... | ... | @@ -1,10 +0,0 @@ |
1 | -<?php | |
2 | - /** | |
3 | - * $Id: getViStop.php 2534 2014-10-02 16:17:30Z elena $ | |
4 | -*/ | |
5 | - $dom = new DomDocument("1.0"); | |
6 | - $dom->load(getenv('USER_DATA_PATH').'base.xml'); | |
7 | - $vi = $dom->getElementById($argv[1]); | |
8 | - echo $vi->getAttribute("stop"); | |
9 | - exit(); | |
10 | -?> | |
11 | 0 | \ No newline at end of file |
php/old_amda/getVotVar.php deleted
... | ... | @@ -1,66 +0,0 @@ |
1 | -<?php | |
2 | - | |
3 | -//putenv("USER_DATA_PATH=/home/benjamin/workspace/AMDA-NG4/data/renard/DATA/"); | |
4 | -//putenv("PHP_CLASSES_PATH=/home/benjamin/workspace/AMDA-NG4/php/classes/"); | |
5 | - | |
6 | -date_default_timezone_set('UTC'); | |
7 | - | |
8 | -require getenv('PHP_CLASSES_PATH').'VOTableMgr.php'; | |
9 | - | |
10 | -$files = $argv[1]; | |
11 | -$paramId = $argv[2]; | |
12 | -$dims = $argv[3]; | |
13 | -$startDouble = $argv[4]; | |
14 | -$intDouble = $argv[5]; | |
15 | - | |
16 | -$mgr = new VOTableMgr(); | |
17 | - | |
18 | -$files_arr = explode(",",$files); | |
19 | - | |
20 | -foreach ($files_arr as $file) | |
21 | -{ | |
22 | - $fileName = getenv('USER_DATA_PATH').$file; | |
23 | - | |
24 | - $mgr->load($fileName); | |
25 | - | |
26 | - $timeIndex = $mgr->getTimeFieldIndex(); | |
27 | - if ($timeIndex < 0) | |
28 | - continue; | |
29 | - | |
30 | - $paramIndex= $mgr->getFieldIndexByID($paramId); | |
31 | - if ($paramIndex < 0) | |
32 | - continue; | |
33 | - | |
34 | - $paramInfo = $mgr->getFieldInfoByID($paramId); | |
35 | - if (isset($paramInfo["error"])) | |
36 | - continue; | |
37 | - | |
38 | - $tr = $mgr->getFirstTR(); | |
39 | - | |
40 | - $crtTime = $startDouble; | |
41 | - | |
42 | - while ($tr) | |
43 | - { | |
44 | - $time = strtotime($mgr->getTDValueByFieldIndex($tr,$timeIndex)); | |
45 | - | |
46 | - if ($time > $crtTime) | |
47 | - { | |
48 | - if ($time <= $startDouble + $intDouble) | |
49 | - { | |
50 | - $val = $mgr->getTDValueByFieldIndex($tr,$paramIndex); | |
51 | - | |
52 | - echo $time." ".$val."\n"; | |
53 | - | |
54 | - $crtTime = $time; | |
55 | - } | |
56 | - else | |
57 | - break; | |
58 | - } | |
59 | - | |
60 | - $tr = $mgr->getNextTR($tr); | |
61 | - } | |
62 | -} | |
63 | - | |
64 | -exit(); | |
65 | - | |
66 | -?> | |
67 | 0 | \ No newline at end of file |
php/old_amda/moreData.php deleted
... | ... | @@ -1,79 +0,0 @@ |
1 | -<?php | |
2 | - /** | |
3 | - * $Id: moreData.php 2913 2015-05-19 10:30:52Z elena $ | |
4 | -*/ | |
5 | - require_once ("../../../../php/config.php"); | |
6 | - | |
7 | - | |
8 | - $dom = new DomDocument("1.0"); | |
9 | - $dom->load(getenv('USER_DATA_PATH').'base.xml'); | |
10 | - $vi = $dom->getElementById($argv[1]); | |
11 | - | |
12 | - $requestStart = (int)$argv[2]; | |
13 | - $requestStop = (int)$argv[3]; | |
14 | - | |
15 | - $argumentsByParam = array(); | |
16 | - | |
17 | - if ($vi->getAttribute("moreData")) { | |
18 | - | |
19 | - $masks = $vi->getElementsByTagName('mask'); | |
20 | - $mask = $masks->item(0)->nodeValue; | |
21 | - | |
22 | - $isSimu = strncmp($mask, "impex___", 8) === 0 || strncmp($mask, "spase___", 8) === 0; | |
23 | - $isClWeb = strncmp($mask, "CLWEB_", 6) === 0; | |
24 | - | |
25 | - if ($isSimu) $myParamMgr = new SimuParamMgr(); | |
26 | - else if ($isClWeb) $myParamMgr = new WsrParamMgr(); | |
27 | - else exit(); | |
28 | - | |
29 | - $paramBuilder = new ParamBuilder(); | |
30 | - | |
31 | - $paramDom = new DomDocument("1.0"); | |
32 | - $paramDom->load(getenv('USER_WS_PATH').'WsParams.xml'); | |
33 | - $xpdSimu = new domxpath($paramDom); | |
34 | - | |
35 | - $paramsSimu = $xpdSimu->query("//*[@mask='".$mask."']"); | |
36 | - $simuID = $paramsSimu->item(0)->getAttribute('xml:id'); | |
37 | - | |
38 | - $files = $vi->getElementsByTagName('file'); | |
39 | - $param = $vi->getElementsByTagName('param')->item(0)->nodeValue; | |
40 | - $args = $vi->getElementsByTagName('arguments'); | |
41 | - | |
42 | - if ($args->item(0)){ | |
43 | - if ($args->item(0)->hasChildNodes()){ | |
44 | - $arguments = array(); | |
45 | - foreach ($args->item(0)->childNodes as $child){ | |
46 | - if ($child instanceof DOMElement){ | |
47 | - $arguments[$child->nodeName] = $child->nodeValue; | |
48 | - } | |
49 | - } | |
50 | - $argumentsByParam[$param] = $arguments; | |
51 | - } | |
52 | - } | |
53 | - $myBaseManager = new BaseManager(); | |
54 | - $intervalsToGet = $myBaseManager->intervalsToGet($requestStart, $requestStop, $mask); | |
55 | - $start = $intervalsToGet['start']; | |
56 | - $stop = $intervalsToGet['stop']; | |
57 | - // Data to get | |
58 | - if (count($start) > 0) { | |
59 | - for ($i = 0; $i < count($start); $i++) { | |
60 | - | |
61 | - $startD = gmdate("Y-m-d\TH:i:s\Z",$start[$i]); | |
62 | - $stopD = gmdate("Y-m-d\TH:i:s\Z",$stop[$i]); | |
63 | - if ($isClWeb) { | |
64 | - $data['paramID'] = $param; | |
65 | - $data['startDate'] = $startD; | |
66 | - $data['stopDate'] = $stopD; | |
67 | - $myParamMgr->setParams($data); | |
68 | - $wsrFileNames = $myParamMgr->getData(); | |
69 | - } | |
70 | - else { | |
71 | - $myParamMgr->setParams($param, $startD, $stopD, $argumentsByParam); | |
72 | - $simuFileNames = $myParamMgr->getSimuData(); | |
73 | - } | |
74 | - } | |
75 | - $paramBuilder->makeWsdParam($simuID); | |
76 | - } | |
77 | - } | |
78 | - exit(); | |
79 | -?> | |
80 | 0 | \ No newline at end of file |