Commit fd01845baa10c5c32e17748c04a20f874849da3e

Authored by Benjamin Renard
2 parents 5a531f9f b2b3cdea
Exists in cu2022

Merge branch 'epn-tap' into cu2022

generic_data/EPN-TAP/.gitignore 0 → 100644
... ... @@ -0,0 +1 @@
  1 +*.csv
... ...
js/app/AmdaApp.js
... ... @@ -198,6 +198,9 @@ Ext.define('amdaApp.AmdaApp', {
198 198  
199 199 // TT duration management
200 200 Ext.state.Manager.getProvider().set('tt_duration', 3);
  201 +
  202 + // Cat duration management
  203 + Ext.state.Manager.getProvider().set('cat_duration', 3);
201 204  
202 205 // now ready...
203 206 //override createWindow method of desktop
... ...
js/app/controllers/InteractiveModule.js
... ... @@ -254,9 +254,9 @@ Ext.define('amdaDesktop.InteractiveModule', {
254 254 * @param {String} objectName The name of sent object
255 255 * @param {String} isLeaf boolean true if it's a leaf parameter
256 256 */
257   - addParam : function(objectName, isLeaf, needsArgs, components, predefined_args) {
  257 + addParam : function(objectName, isLeaf, needsArgs, components, predefined_args, info) {
258 258 var uiContent = this.getUiContent();
259   - uiContent.addParam(objectName, isLeaf, needsArgs, components, predefined_args);
  259 + uiContent.addParam(objectName, isLeaf, needsArgs, components, predefined_args, info);
260 260 },
261 261  
262 262 parseTemplatedParam: function(templatedParamId, onParamParsed) {
... ...
js/app/controllers/PlotModule.js
... ... @@ -9,126 +9,126 @@
9 9 */
10 10  
11 11 Ext.define('amdaDesktop.PlotModule', {
12   - extend: 'amdaDesktop.InteractiveModule',
13   -
14   - requires: [
15   - 'amdaUI.PlotUI',
16   - 'amdaPlotObj.MultiplotRequestObject',
17   - 'amdaModel.MultiplotNode',
18   - 'amdaUI.PlotTabResultUI',
19   - 'amdaPlotComp.PlotPreviewUI',
20   - 'amdaUI.MultiPlotUI'
21   - ],
22   -
23   - contentId : 'plotUI',
24   - linkedNode : null,
25   - panelResultInstance:null,
26   -
  12 + extend: 'amdaDesktop.InteractiveModule',
  13 +
  14 + requires: [
  15 + 'amdaUI.PlotUI',
  16 + 'amdaPlotObj.MultiplotRequestObject',
  17 + 'amdaModel.MultiplotNode',
  18 + 'amdaUI.PlotTabResultUI',
  19 + 'amdaPlotComp.PlotPreviewUI',
  20 + 'amdaUI.MultiPlotUI'
  21 + ],
  22 +
  23 + contentId: 'plotUI',
  24 + linkedNode: null,
  25 + panelResultInstance: null,
  26 +
27 27 /**
28 28 * @cfg {String} data models
29 29 * @required
30 30 */
31   - nodeDataModel : 'amdaModel.MultiplotNode',
32   -
  31 + nodeDataModel: 'amdaModel.MultiplotNode',
  32 +
33 33 /**
34 34 * @cfg {String} window definitions
35 35 * @required
36 36 */
37   - width: 650,
  37 + width: 650,
38 38 height: 670,
39   - uiType : 'newPanelPlot',
40   - helpTitle : 'Help on Plot Module',
41   - helpFile : 'plotHelp',
42   -
43   - plotResultWindowsManager : new Ext.AbstractManager(),
44   -
  39 + uiType: 'newPanelPlot',
  40 + helpTitle: 'Help on Plot Module',
  41 + helpFile: 'plotHelp',
  42 +
  43 + plotResultWindowsManager: new Ext.AbstractManager(),
  44 +
45 45 multiPlotWin: null,
46   -
47   - computeResultWindowSize : function(panelResult) {
  46 +
  47 + computeResultWindowSize: function (panelResult) {
48 48 var size = panelResult.getImageSize();
49   - size.width += 30;
  49 + size.width += 30;
50 50 size.height += 95;
51 51 return size;
52 52 },
53   -
54   - computePreviewWindowSize : function(previewContent) {
  53 +
  54 + computePreviewWindowSize: function (previewContent) {
55 55 var size = previewContent.getImageSize();
56   - size.width += 30;
  56 + size.width += 30;
57 57 size.height += 100;
58 58 return size;
59 59 },
60   -
61   - updateInteractiveSession : function(session, newplot, panelId_, time_) {
  60 +
  61 + updateInteractiveSession: function (session, newplot, panelId_, time_) {
62 62 var me = this;
63 63  
64 64  
65 65 Ext.each(session.result, function (tabResult, index) {
66 66 if (logExecTime && tabResult.exectime) {
67   - console.log("CMD EXEC TIME FOR "+tabResult.plot+" = "+tabResult.exectime+"ms");
  67 + console.log("CMD EXEC TIME FOR " + tabResult.plot + " = " + tabResult.exectime + "ms");
68 68 }
69 69  
70 70 if (tabResult.preview) {
71 71 var plotPreviewConfig = {
72   - folder : session.folder,
73   - plotFile : tabResult.plot,
74   - context : tabResult.context,
75   - time : time_,
76   - panelId : panelId_,
77   - interactiveId : tabResult.id
  72 + folder: session.folder,
  73 + plotFile: tabResult.plot,
  74 + context: tabResult.context,
  75 + time: time_,
  76 + panelId: panelId_,
  77 + interactiveId: tabResult.id
78 78 };
79 79 me.updatePreview(plotPreviewConfig);
80 80 return;
81 81 }
82 82  
83   - var winResultId = tabResult.id+"-win";
84   -
  83 + var winResultId = tabResult.id + "-win";
  84 +
85 85 var winResult = me.getWindowResult(winResultId);
86   -
  86 +
87 87 var plotTabConfig = {
88   - folder : session.folder,
89   - plotFile : tabResult.plot,
90   - context : tabResult.context,
91   - interactiveId : tabResult.id,
  88 + folder: session.folder,
  89 + plotFile: tabResult.plot,
  90 + context: tabResult.context,
  91 + interactiveId: tabResult.id,
92 92 isInterval: tabResult.isInterval,
93   - ttName : tabResult.ttName,
94   - ttIndex : tabResult.ttIndex,
95   - ttNbIntervals : tabResult.ttNbIntervals,
96   - ttFileIndex : tabResult.ttFileIndex,
  93 + ttName: tabResult.ttName,
  94 + ttIndex: tabResult.ttIndex,
  95 + ttNbIntervals: tabResult.ttNbIntervals,
  96 + ttFileIndex: tabResult.ttFileIndex,
97 97 multiplot: tabResult.multiplot
98 98 };
99   -
  99 +
100 100 if (winResult == null) {
101 101 var x = 50 + tabResult.index * 50;
102 102 var y = 100 + tabResult.index * 20;
103 103 //create new result win
104 104 var panelResult = new amdaUI.PlotTabResultUI(plotTabConfig);
105   - me.panelResultInstance =panelResult;
  105 + me.panelResultInstance = panelResult;
106 106 var size = me.computeResultWindowSize(panelResult);
107 107  
108 108 var win = myDesktopApp.getDesktop().createWindow({
109   - id : tabResult.id+"-win",
110   - title : tabResult.title,
111   - width : size.width,
  109 + id: tabResult.id + "-win",
  110 + title: tabResult.title,
  111 + width: size.width,
112 112 height: size.height,
113   - x : x,
114   - y : y,
  113 + x: x,
  114 + y: y,
115 115 layout: 'fit',
116   - items : [
117   - panelResult
  116 + items: [
  117 + panelResult
118 118 ],
119 119 listeners: {
120   - scope: me,
121   - beforeclose: function(win,opt) {
  120 + scope: me,
  121 + beforeclose: function (win, opt) {
122 122 me.plotResultWindowsManager.unregister(win);
123 123 },
124   - afterrender: function(win,opt) {
  124 + afterrender: function (win, opt) {
125 125 win.getPanelResult().updateConfig(tabResult.title, tabResult.multiplot);
126 126 }
127 127 },
128   - getPanelResult: function() {
  128 + getPanelResult: function () {
129 129 return panelResult;
130 130 },
131   - updateTitle: function(multiplot) {
  131 + updateTitle: function (multiplot) {
132 132 win.setTitle(tabResult.title + (multiplot ? ' - Synchronized to multiplot' : ''));
133 133 }
134 134 });
... ... @@ -146,19 +146,19 @@ Ext.define('amdaDesktop.PlotModule', {
146 146 }
147 147 });
148 148 },
149   -
150   - closeInteractiveSession : function() {
  149 +
  150 + closeInteractiveSession: function () {
151 151 var me = this;
152 152 this.plotResultWindowsManager.each(function (key, value, length) {
153 153 value.close();
154 154 });
155   - if (this.multiPlotWin) {
156   - this.multiPlotWin.close();
157   - }
  155 + if (this.multiPlotWin) {
  156 + this.multiPlotWin.close();
  157 + }
158 158 },
159 159  
160   - updatePlotResultTitle: function(tabIndex, title) {
161   - var winResultId = 'plot_'+tabIndex+'-win';
  160 + updatePlotResultTitle: function (tabIndex, title) {
  161 + var winResultId = 'plot_' + tabIndex + '-win';
162 162 var winResult = this.getWindowResult(winResultId);
163 163 if (winResult) {
164 164 winResult.setTitle(title);
... ... @@ -166,11 +166,11 @@ Ext.define('amdaDesktop.PlotModule', {
166 166 if (winResult == item.win) {
167 167 item.setText(title);
168 168 }
169   - });
  169 + });
170 170 }
171 171 },
172 172  
173   - updatePreview : function(plotPreviewConfig) {
  173 + updatePreview: function (plotPreviewConfig) {
174 174 var winPreviewId = "plot-preview-win";
175 175  
176 176 var winPreview = this.getWindowResult(winPreviewId);
... ... @@ -183,21 +183,21 @@ Ext.define('amdaDesktop.PlotModule', {
183 183 var size = this.computePreviewWindowSize(previewContent);
184 184  
185 185 var win = myDesktopApp.getDesktop().createWindow({
186   - id : winPreviewId,
187   - title : 'Plot Preview',
188   - width : size.width,
  186 + id: winPreviewId,
  187 + title: 'Plot Preview',
  188 + width: size.width,
189 189 height: size.height,
190 190 layout: 'fit',
191   - items : [
192   - previewContent
  191 + items: [
  192 + previewContent
193 193 ],
194 194 listeners: {
195   - scope: this,
196   - beforeclose: function(win,opt) {
  195 + scope: this,
  196 + beforeclose: function (win, opt) {
197 197 this.plotResultWindowsManager.unregister(win);
198 198 }
199 199 },
200   - getPreviewContent: function() {
  200 + getPreviewContent: function () {
201 201 return previewContent;
202 202 }
203 203 });
... ... @@ -213,14 +213,14 @@ Ext.define('amdaDesktop.PlotModule', {
213 213 winPreview.toFront();
214 214 }
215 215 },
216   -
217   - getWindowResult: function(winResultId){
218   - if (!this.plotResultWindowsManager.get(winResultId)) return null;
219   - return this.plotResultWindowsManager.get(winResultId);
  216 +
  217 + getWindowResult: function (winResultId) {
  218 + if (!this.plotResultWindowsManager.get(winResultId)) return null;
  219 + return this.plotResultWindowsManager.get(winResultId);
220 220 },
221   -
222   - setTimeInterval : function(timeObj){
223   - var me = this;
  221 +
  222 + setTimeInterval: function (timeObj) {
  223 + var me = this;
224 224 var desktop = this.app.getDesktop();
225 225 var win = desktop.getWindow(this.id);
226 226 if (win) {
... ... @@ -234,7 +234,7 @@ Ext.define('amdaDesktop.PlotModule', {
234 234 }
235 235 },
236 236  
237   - addParameter : function(paramNode) {
  237 + addParameter: function (paramNode) {
238 238 var me = this;
239 239 var desktop = this.app.getDesktop();
240 240 var win = desktop.getWindow(this.id);
... ... @@ -248,7 +248,7 @@ Ext.define('amdaDesktop.PlotModule', {
248 248 });
249 249 }
250 250 },
251   - editPlot : function(plotNode) {
  251 + editPlot: function (plotNode) {
252 252 var me = this;
253 253 var desktop = this.app.getDesktop();
254 254 var win = desktop.getWindow(this.id);
... ... @@ -260,7 +260,7 @@ Ext.define('amdaDesktop.PlotModule', {
260 260 }
261 261 else {
262 262 // Plot UI is closed
263   - this.createWindow(null, function() {
  263 + this.createWindow(null, function () {
264 264 //This is the onAfterCreateObject callback
265 265 //Add plot node to the multiplot object
266 266 me.linkedNode.get('object').plots().removeAll();
... ... @@ -269,7 +269,7 @@ Ext.define('amdaDesktop.PlotModule', {
269 269 }
270 270 },
271 271  
272   - syncAfterRename: function(renamedNode) {
  272 + syncAfterRename: function (renamedNode) {
273 273 var me = this;
274 274 var desktop = this.app.getDesktop();
275 275 var win = desktop.getWindow(this.id);
... ... @@ -279,8 +279,8 @@ Ext.define('amdaDesktop.PlotModule', {
279 279 }
280 280 },
281 281  
282   - showMultiplotWin: function() {
283   - var me = this;
  282 + showMultiplotWin: function () {
  283 + var me = this;
284 284 var desktop = this.app.getDesktop();
285 285 var win = desktop.getWindow(this.id);
286 286  
... ... @@ -288,52 +288,52 @@ Ext.define('amdaDesktop.PlotModule', {
288 288 return;
289 289 }
290 290  
291   - if (!this.multiPlotWin) {
292   - var multiPlotPanel = Ext.create('amdaUI.MultiPlotUI',
293   - {
294   - plotWin: me.getUiContent()
295   - }
296   - );
297   - this.multiPlotWin = myDesktopApp.getDesktop().createWindow({
298   - id : "multiplot-win",
299   - title : "Multi Plot Manager",
300   - width : 320,
301   - height: 320,
302   - minHeight: 300,
303   - minWidth: 320,
304   - layout: 'fit',
305   - items : [
306   - multiPlotPanel
307   - ],
308   - listeners: {
309   - beforeclose: function(win,opt) {
310   - me.multiPlotWin = null;
311   - me.getUiContent().enableSinglePlot(true);
312   - me.plotResultWindowsManager.each(function (key, value, length) {
313   - value.getPanelResult().updateConfig(value.getPanelResult().plotName, false);
314   - });
315   - }
316   - }
317   - });
318   - }
  291 + if (!this.multiPlotWin) {
  292 + var multiPlotPanel = Ext.create('amdaUI.MultiPlotUI',
  293 + {
  294 + plotWin: me.getUiContent()
  295 + }
  296 + );
  297 + this.multiPlotWin = myDesktopApp.getDesktop().createWindow({
  298 + id: "multiplot-win",
  299 + title: "Multi Plot Manager",
  300 + width: 320,
  301 + height: 320,
  302 + minHeight: 300,
  303 + minWidth: 320,
  304 + layout: 'fit',
  305 + items: [
  306 + multiPlotPanel
  307 + ],
  308 + listeners: {
  309 + beforeclose: function (win, opt) {
  310 + me.multiPlotWin = null;
  311 + me.getUiContent().enableSinglePlot(true);
  312 + me.plotResultWindowsManager.each(function (key, value, length) {
  313 + value.getPanelResult().updateConfig(value.getPanelResult().plotName, false);
  314 + });
  315 + }
  316 + }
  317 + });
  318 + }
319 319  
320 320 this.getUiContent().enableSinglePlot(false);
321   - this.multiPlotWin.show();
  321 + this.multiPlotWin.show();
322 322  
323 323 },
324 324  
325   - refreshMultiPlot: function() {
  325 + refreshMultiPlot: function () {
326 326 if (this.multiPlotWin) {
327 327 this.multiPlotWin.items.items[0].refreshMultiPlot();
328 328 }
329 329 this.getUiContent().enableSinglePlot(!this.isMultiPlot());
330 330 },
331 331  
332   - isMultiPlot : function() {
  332 + isMultiPlot: function () {
333 333 return this.multiPlotWin && !this.multiPlotWin.isHidden();
334 334 },
335 335  
336   - editInDownloadModule: function(plotNode) {
  336 + editInDownloadModule: function (plotNode) {
337 337 var plotValues = plotNode.get('object').getJsonValues();
338 338 var downloadValues = new Object();
339 339 downloadValues.timesrc = plotValues.timesrc;
... ...
js/app/models/LocalParamNode.js
... ... @@ -194,7 +194,7 @@ Ext.define('amdaModel.LocalParamNode',
194 194 else
195 195 paramName = node.get('id');
196 196  
197   - module.addParam(paramName,node.get('leaf'),node.get('needsArgs'),components);
  197 + module.addParam(paramName,node.get('leaf'),node.get('needsArgs'),components, null, null);
198 198 });
199 199 },
200 200  
... ...
js/app/models/PlotObjects/PlotPanelObject.js
... ... @@ -31,6 +31,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
31 31  
32 32 fields : [
33 33 {name: 'id', type: 'string'},
  34 + {name: 'info', type: 'string'},
34 35 {name: 'panel-node-state', type: 'int', defaultValue: 2}, //0 : collapsed, 1 : expanded, 2 : not set
35 36 {name: 'axes-node-state', type: 'int', defaultValue: 2}, //0 : collapsed, 1 : expanded, 2 : not set
36 37 {name: 'params-node-state', type: 'int', defaultValue: 2}, //0 : collapsed, 1 : expanded, 2 : not set
... ... @@ -192,6 +193,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
192 193 params[index]['dim2-min-value'] = param['dim2-min-range'];
193 194 params[index]['dim2-max-value'] = param['dim2-max-range'];
194 195 params[index]['is-init'] = true;
  196 + params[index]['info'] = param['info'];
195 197 });
196 198 this.params().loadData(params);
197 199 },
... ... @@ -300,6 +302,7 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
300 302 var isVector = (typeof data !== "undefined") && (typeof data.isVector !== "undefined") && data.isVector;
301 303 var components = (typeof data !== "undefined") && (typeof data.components !== "undefined") && data.components ? data.components : null;
302 304 var template_args = (typeof data !== "undefined") && (typeof data.template_args !== "undefined") && data.template_args ? data.template_args : null;
  305 + var info = (typeof data !== "undefined") && (typeof data.info !== "undefined") && data.info ? data.info : null;
303 306  
304 307 this.set('last-param-id', this.get('last-param-id') + 1);
305 308  
... ... @@ -313,6 +316,9 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
313 316 if (template_args) {
314 317 recs[0].set('template_args', template_args);
315 318 }
  319 + if (info){
  320 + recs[0].set('info', info);
  321 + }
316 322  
317 323 if (components != null) {
318 324 if (components['index1']) {
... ...
js/app/models/PlotObjects/PlotTreeNode.js
... ... @@ -67,14 +67,17 @@ Ext.define('amdaPlotObj.PlotTreeNode', {
67 67 this.set('leaf',this.leaf);
68 68 this.set('type',this.type);
69 69 this.set('removable',this.removable);
70   - if (config && config.object)
  70 + if (config && config.object) {
71 71 this.object = config.object;
  72 + this.set('qtip', config.object.get('info'));
  73 + }
72 74 if (this.getNodeState() != 2)
73 75 this.set('expanded',(this.getNodeState() == 1));
74 76 else {
75 77 this.set('expanded',this.expanded);
76 78 this.setNodeState(this.expanded ? 1 : 0);
77 79 }
  80 +
78 81 }
79 82 }, function () {
80 83 Ext.data.NodeInterface.decorate(this);
... ...
js/app/models/RequestParamObject.js
... ... @@ -21,7 +21,8 @@ Ext.define('amdaModel.RequestParamObject', {
21 21 getEmptyObj: function() {
22 22 return {
23 23 'paramid': '',
24   - 'is-init': false,
  24 + 'qtip':'',
  25 + 'is-init': false,
25 26 'type': 0,
26 27 'dim1-index': '*',
27 28 'dim1-sum-type': 0,
... ... @@ -46,6 +47,7 @@ Ext.define('amdaModel.RequestParamObject', {
46 47 {name: 'type', type: 'int'}, /* Parameter type. 0: Scalar, 1: Tab1D, 2: Tab2D */
47 48 {name: 'is-init', type: 'bool', default:false},
48 49 {name: 'paramid', type: 'string'},
  50 + {name: 'qtip', type:'string'},
49 51 /* Fields for dim1 */
50 52 {name: 'dim1-index', type: 'string', defaultValue: '*'},
51 53 {name: 'dim1-sum-type', type: 'int', defaultValue: 0}, /* Sum type. 0: None, 1: sum into values range, 2: sum between indexes */
... ...
js/app/models/SpecialParamNode.js
... ... @@ -106,7 +106,7 @@ Ext.define('amdaModel.SpecialParamNode', {
106 106 }
107 107 var paramName = node.get('id');
108 108 var components = null;
109   - module.addParam(paramName,node.get('leaf'),node.get('needsArgs'),components);
  109 + module.addParam(paramName,node.get('leaf'),node.get('needsArgs'),components, null, null);
110 110 });
111 111 },
112 112  
... ...
js/app/views/CatalogUI.js
... ... @@ -19,7 +19,8 @@ Ext.define('amdaUI.CatalogUI', {
19 19 'Ext.ux.grid.filter.StringFilter',
20 20 'amdaUI.OperationsTT',
21 21 'Ext.grid.plugin.BufferedRenderer',
22   - 'amdaUI.StatisticalPlug'
  22 + 'amdaUI.StatisticalPlug',
  23 ++ 'amdaDesktop.AmdaStateProvider'
23 24 ],
24 25  
25 26 isCatalog: true,
... ... @@ -50,7 +51,7 @@ Ext.define('amdaUI.CatalogUI', {
50 51  
51 52 Ext.Array.each(this.TTGrid.headerCt.getGridColumns(), function (item, index, all) {
52 53 // if item is the default duration column
53   - if (item.id == amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '2') {
  54 + if (item.id == amdaUI.CatalogUI.COL_TO_HIDE_DURATION + Ext.state.Manager.getProvider().get('cat_duration').toString()) {
54 55 // show this column
55 56 item.show();
56 57 }
... ... @@ -362,7 +363,7 @@ Ext.define('amdaUI.CatalogUI', {
362 363 width: 120,
363 364 minWidth: 50,
364 365 menuDisabled: false,
365   - hidden: true,
  366 + hidden: Ext.state.Manager.getProvider().get('cat_duration') != 1 ? true : false,
366 367 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '1',
367 368 renderer: function (value) {
368 369 return this.dateToString(value);
... ... @@ -382,7 +383,7 @@ Ext.define('amdaUI.CatalogUI', {
382 383 width: 120,
383 384 minWidth: 50,
384 385 menuDisabled: false,
385   - hidden: true,
  386 + hidden: Ext.state.Manager.getProvider().get('cat_duration') != 2 ? true : false,
386 387 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '2',
387 388 renderer: function (value) {
388 389 return this.dateToString(value);
... ... @@ -402,7 +403,7 @@ Ext.define('amdaUI.CatalogUI', {
402 403 width: 120,
403 404 minWidth: 50,
404 405 menuDisabled: false,
405   - hidden: false,
  406 + hidden: Ext.state.Manager.getProvider().get('cat_duration') != 3 ? true : false,
406 407 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '3',
407 408 renderer: function (value) {
408 409 return this.dateToString(value);
... ... @@ -422,7 +423,7 @@ Ext.define('amdaUI.CatalogUI', {
422 423 width: 120,
423 424 minWidth: 50,
424 425 menuDisabled: false,
425   - hidden: true,
  426 + hidden: Ext.state.Manager.getProvider().get('cat_duration') != 4 ? true : false,
426 427 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '4',
427 428 renderer: function (value) {
428 429 return Ext.util.Format.number(value, '0.000');
... ... @@ -457,7 +458,10 @@ Ext.define('amdaUI.CatalogUI', {
457 458 xtype: 'gridcolumn',
458 459 width: pramColumnWidth * parseInt(obj.size),
459 460 editor: 'textfield',
460   - filter: {type: 'numeric', menuItemCfgs: {decimalPrecision: 10}}
  461 + filter: {type: 'numeric', menuItemCfgs: {decimalPrecision: 10}},
  462 + renderer :function(value){
  463 + return (value == "NAN") ? "nan": value;
  464 + },
461 465 });
462 466 break;
463 467 case 1: //dateTime
... ... @@ -1191,7 +1195,15 @@ Ext.define('amdaUI.CatalogUI', {
1191 1195 });
1192 1196 }, this);
1193 1197 },
1194   - scope: this
  1198 + scope: this,
  1199 + columnschanged:function(ct,eOpts){ // Takes into count the duration changes
  1200 + Ext.Array.each(ct.getGridColumns(), function (item, index, all) {
  1201 + if (Ext.util.Format.substr(item.id, 0, amdaUI.CatalogUI.COL_TO_HIDE_DURATION.length) == amdaUI.CatalogUI.COL_TO_HIDE_DURATION && !item.isHidden()) {
  1202 + var durationNumber = parseInt(Ext.util.Format.substr(item.id, amdaUI.CatalogUI.COL_TO_HIDE_DURATION.length, amdaUI.CatalogUI.COL_TO_HIDE_DURATION.length+1));
  1203 + Ext.state.Manager.getProvider().set('cat_duration', durationNumber);
  1204 + }
  1205 + });
  1206 + }
1195 1207 },
1196 1208 dockedItems: [{
1197 1209 xtype: 'toolbar',
... ...
js/app/views/DownloadUI.js
... ... @@ -164,7 +164,7 @@ Ext.define('amdaUI.DownloadUI', {
164 164 return false;
165 165 },
166 166  
167   - addParam: function (paramId, isLeaf, needArgs, components, predefined_args) {
  167 + addParam: function (paramId, isLeaf, needArgs, components, predefined_args, info) {
168 168 // adding the parameter to the paramGrid
169 169 var paramObj = amdaModel.RequestParamObject.getEmptyObj();
170 170 paramObj.paramid = paramId;
... ... @@ -184,6 +184,10 @@ Ext.define('amdaUI.DownloadUI', {
184 184 if (predefined_args) {
185 185 paramObj.template_args = predefined_args;
186 186 }
  187 +
  188 + if(info){
  189 + paramObj.qtip= info;
  190 + }
187 191  
188 192 var r = Ext.create('amdaModel.DownloadParam', paramObj);
189 193 var pos = this.paramGrid.store.getCount();
... ... @@ -415,6 +419,8 @@ Ext.define('amdaUI.DownloadUI', {
415 419 var idToSent;
416 420 var components = null;
417 421 var predefinedArgs = record.get('predefinedArgs');
  422 + var info = record.get('info');
  423 +
418 424 switch (record.get('nodeType')) {
419 425 case 'localParam':
420 426 case 'remoteParam':
... ... @@ -488,11 +494,11 @@ Ext.define('amdaUI.DownloadUI', {
488 494 if (downModule) {
489 495 if (predefinedArgs) {
490 496 downModule.parseTemplatedParam(idToSent, function (param_info) {
491   - downModule.addParam(param_info.paramid, record.get('leaf'), record.get('needsArgs'), components, param_info.template_args);
  497 + downModule.addParam(param_info.paramid, record.get('leaf'), record.get('needsArgs'), components, param_info.template_args, info);
492 498 });
493 499 }
494 500 else {
495   - downModule.addParam(idToSent, record.get('leaf'), record.get('needsArgs'), components);
  501 + downModule.addParam(idToSent, record.get('leaf'), record.get('needsArgs'), components, null,info);
496 502 return true;
497 503 }
498 504 }
... ... @@ -540,6 +546,7 @@ Ext.define('amdaUI.DownloadUI', {
540 546 sortable: false,
541 547 menuDisabled: true,
542 548 renderer: function (val, meta, rec) {
  549 + meta.tdAttr = 'data-qtip="' + rec.data.qtip + '"';
543 550 return rec.getParamFullName();
544 551 }
545 552 },
... ...
js/app/views/ParameterUI.js
... ... @@ -371,11 +371,11 @@ Ext.define('amdaUI.ParameterUI',
371 371 if (paramModule) {
372 372 if (data.records[0].get('predefinedArgs')) {
373 373 paramModule.parseTemplatedParam(nameToSent, function (param_info) {
374   - paramModule.addParam(param_info.paramid, data.records[0].get('leaf'), true, components, param_info.template_args);
  374 + paramModule.addParam(param_info.paramid, data.records[0].get('leaf'), true, components, param_info.template_args, null);
375 375 });
376 376 }
377 377 else {
378   - paramModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
  378 + paramModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components,null,null);
379 379 }
380 380 }
381 381 return true;
... ...
js/app/views/PlotComponents/PlotOutputForm.js
... ... @@ -16,7 +16,7 @@ Ext.define('amdaPlotComp.PlotOutputForm', {
16 16 setObject : function(object) {
17 17 this.object = object;
18 18 this.loadRecord(this.object);
19   - this.updateOutputOption(this.object.get('file-format'));
  19 + this.updateOutputOption(this.object.get('file-format'),this.object.get('file-output'));
20 20 this.updateOneFilePerIntOption(this.object.get('file-format'));
21 21 this.updateFilePrefixOption(this.object.get('file-output'));
22 22 },
... ... @@ -35,22 +35,40 @@ Ext.define('amdaPlotComp.PlotOutputForm', {
35 35 prefixField.setDisabled(output == 'INTERACTIVE');
36 36 },
37 37  
38   - updateOutputOption : function(format) {
  38 + updateOutputOption : function(format,output) {
39 39 var outputField = this.getForm().findField('file-output');
40   -
41   - if (format == 'PNG')
42   - {
43   - outputField.getStore().loadData(amdaPlotObj.PlotObjectConfig.availableFileOutputsForPng);
44   - outputField.setValue('INTERACTIVE');
45   - }
46   - else
47   - {
48   - outputField.getStore().loadData(amdaPlotObj.PlotObjectConfig.availableFileOutputsForOtherFormats);
49   - if (outputField.getValue() == 'INTERACTIVE')
50   - outputField.setValue('TGZ');
51   - else
52   - outputField.setValue('TGZ');
53   - }
  40 + var outputValue = outputField.getValue();
  41 +
  42 + if(format == 'PNG')
  43 + {
  44 + outputField.getStore().loadData(amdaPlotObj.PlotObjectConfig.availableFileOutputsForPng);
  45 + if(!output)
  46 + {
  47 + if(!outputValue)
  48 + outputField.setValue('INTERACTIVE');
  49 + else
  50 + outputField.setValue(outputValue);
  51 + }
  52 + else
  53 + {
  54 + outputField.setValue(output);
  55 + }
  56 + }
  57 + else
  58 + {
  59 + outputField.getStore().loadData(amdaPlotObj.PlotObjectConfig.availableFileOutputsForOtherFormats);
  60 + if(!output)
  61 + {
  62 + if(outputValue =='INTERACTIVE' || !outputValue)
  63 + outputField.setValue('TGZ');
  64 + else
  65 + outputField.setValue(outputValue);
  66 + }
  67 + else
  68 + {
  69 + outputField.setValue(output);
  70 + }
  71 + }
54 72 },
55 73  
56 74 getFormItems: function() {
... ...
js/app/views/PlotComponents/PlotPreviewUI.js
... ... @@ -13,49 +13,50 @@
13 13 */
14 14  
15 15 Ext.define('amdaPlotComp.PlotPreviewUI', {
16   - extend: 'Ext.panel.Panel',
17   -
18   - alias: 'widget.plotPreview',
  16 + extend: 'Ext.panel.Panel',
19 17  
20   - requires: [
21   - 'amdaPlotComp.PlotContextManager',
22   - 'amdaPlotComp.PlotResultImage',
  18 + alias: 'widget.plotPreview',
  19 +
  20 + requires: [
  21 + 'amdaPlotComp.PlotContextManager',
  22 + 'amdaPlotComp.PlotResultImage',
23 23 'amdaUI.PlotTabResultUI'
24   - ],
25   -
26   - panelImage : null,
27   - crtContext : null,
28   - sliderPage : null,
29   - contextualMenu : null,
30   - hiddenForm: null,
31   - panelResultInstance:null,
  24 + ],
  25 +
  26 + isPlotFunction: false,
  27 + panelImage: null,
  28 + crtContext: null,
  29 + sliderPage: null,
  30 + contextualMenu: null,
  31 + hiddenForm: null,
  32 + panelResultInstance: null,
32 33  
33   - setPanelResultInstance: function(panelResultInstance_)
34   - {
  34 + setPanelResultInstance: function (panelResultInstance_) {
35 35 this.panelResultInstance = panelResultInstance_;
36 36 },
37   - constructor: function(config) {
38   - this.init(config);
39   - this.callParent(arguments);
40   - },
41   -
42   - getImageSize : function() {
43   - if (!this.crtContext)
44   - return {
45   - width : 0,
46   - height : 0
47   - };
48   -
49   - return {
50   - width : this.crtContext.page.width * this.sliderPage.getValue()/100.,
51   - height : this.crtContext.page.height * this.sliderPage.getValue()/100.
52   - }
53   - },
54   -
55   - getImageUrl: function(resultFolder, plotFile) {
56   - return 'data/'+sessionID +'/RES/'+resultFolder+ '/' + plotFile;
57   - },
58   -
  37 +
  38 + constructor: function (config) {
  39 + this.init(config);
  40 + this.callParent(arguments);
  41 + },
  42 +
  43 + getImageSize: function () {
  44 + if (!this.crtContext)
  45 + return {
  46 + width: 0,
  47 + height: 0
  48 + };
  49 +
  50 + return {
  51 + width: this.crtContext.page.width * this.sliderPage.getValue() / 100.,
  52 + height: this.crtContext.page.height * this.sliderPage.getValue() / 100.
  53 + }
  54 + },
  55 +
  56 + getImageUrl: function (resultFolder, plotFile) {
  57 + return 'data/' + sessionID + '/RES/' + resultFolder + '/' + plotFile;
  58 + },
  59 +
59 60 toPixelOnSourceImage: function (value) {
60 61 return value * 100 / this.sliderPage.getValue();
61 62 },
... ... @@ -68,13 +69,13 @@ Ext.define('amdaPlotComp.PlotPreviewUI', {
68 69 return parseFloat(val).toPrecision(5);
69 70 },
70 71  
71   - createPlotImage: function(resultFolder, plotFile) {
72   - var me = this;
73   - var size = this.getImageSize();
74   - this.panelImage = Ext.create('amdaPlotComp.PlotResultImage', {
75   - src : this.getImageUrl(resultFolder, plotFile),
76   - width : size.width,
77   - height : size.height,
  72 + createPlotImage: function (resultFolder, plotFile) {
  73 + var me = this;
  74 + var size = this.getImageSize();
  75 + this.panelImage = Ext.create('amdaPlotComp.PlotResultImage', {
  76 + src: this.getImageUrl(resultFolder, plotFile),
  77 + width: size.width,
  78 + height: size.height,
78 79 onMouseMove: function (x, y) {
79 80 if (!me.crtContext)
80 81 return;
... ... @@ -131,70 +132,71 @@ Ext.define('amdaPlotComp.PlotPreviewUI', {
131 132 }
132 133 me.coordinatesField.setText(text);
133 134 },
134   - onContextMenu : function(absoluteX, absoluteY, imageX, imageY) {
135   - me.contextualMenu.showAt(absoluteX, absoluteY);
136   - }
137   - });
  135 + onContextMenu: function (absoluteX, absoluteY, imageX, imageY) {
  136 + me.contextualMenu.showAt(absoluteX, absoluteY);
  137 + }
  138 + });
138 139  
139   - return this.panelImage;
140   - },
141   -
142   - updatePlotImage: function(configResult, newPlot) {
143   - this.crtContext = configResult.context;
  140 + return this.panelImage;
  141 + },
  142 +
  143 + updatePlotImage: function (configResult, newPlot) {
  144 + this.crtContext = configResult.context;
144 145  
145   - this.panelImage.setSrc(this.getImageUrl(configResult.folder, configResult.plotFile));
  146 + this.panelImage.setSrc(this.getImageUrl(configResult.folder, configResult.plotFile));
146 147 var newTime = new Date(configResult.time);
147 148 newTime = Ext.Date.add(newTime, Ext.Date.MINUTE, newTime.getTimezoneOffset());
148   - Ext.getCmp('plotPreview-goto-Date' + configResult.interactiveId).setValue(newTime);
149   - var size = this.getImageSize();
150   - this.panelImage.setSize(size.width, size.height);
151   -
152   - this.panelImage.refreshMe();
153   - },
154   -
155   - init: function(configResult){
156   - var me = this;
  149 + if (!this.isPlotFunction)
  150 + Ext.getCmp('plotPreview-goto-Date' + configResult.interactiveId).setValue(newTime);
  151 + var size = this.getImageSize();
  152 + this.panelImage.setSize(size.width, size.height);
  153 +
  154 + this.panelImage.refreshMe();
  155 + },
  156 +
  157 + init: function (configResult) {
  158 + var me = this;
157 159  
158   - this.crtContext = configResult.context;
159   - this.interactiveId = configResult.interactiveId;
  160 + this.crtContext = configResult.context;
  161 + this.interactiveId = configResult.interactiveId;
160 162 this.time = new Date(configResult.time);
161 163 this.time = Ext.Date.add(this.time, Ext.Date.MINUTE, this.time.getTimezoneOffset());
162   - this.panelId= configResult.panelId
163   -
  164 + this.panelId = configResult.panelId;
  165 + this.isPlotFunction = configResult.plotFile.includes("plotFunction");
  166 +
164 167 this.coordinatesField = new Ext.toolbar.TextItem({
165 168 width: 300,
166 169 text: ''
167 170 });
168 171  
169   - this.sliderPage = new Ext.slider.Single({
170   - width: 130,
171   - value: 75,
172   - increment: 5,
173   - minValue: 50,
174   - maxValue: 100,
175   - fieldLabel : 'Resize',
176   - labelWidth : 40,
177   - listeners: {
178   - scope : this,
179   - changecomplete: function(s, v)
180   - {
181   - var size = this.getImageSize();
182   - this.panelImage.width = size.width;
183   - this.panelImage.height = size.height;
184   - this.panelImage.doComponentLayout();
185   - }
186   - }
187   - });
188   - var topToolbar=
  172 + this.sliderPage = new Ext.slider.Single({
  173 + width: 130,
  174 + value: 75,
  175 + increment: 5,
  176 + minValue: 50,
  177 + maxValue: 100,
  178 + fieldLabel: 'Resize',
  179 + labelWidth: 40,
  180 + listeners: {
  181 + scope: this,
  182 + changecomplete: function (s, v) {
  183 + var size = this.getImageSize();
  184 + this.panelImage.width = size.width;
  185 + this.panelImage.height = size.height;
  186 + this.panelImage.doComponentLayout();
  187 + }
  188 + }
  189 + });
  190 + var topToolbar =
189 191 {
190   - xtype:'toolbar',
191   - dock:'top',
192   - items:[{
  192 + xtype: 'toolbar',
  193 + dock: 'top',
  194 + items: [{
193 195 xtype: 'datefield',
194   - allowBlank:true,
  196 + allowBlank: true,
195 197 format: 'Y-m-d\\TH:i:s.u',
196 198 id: 'plotPreview-goto-Date' + this.interactiveId,
197   - value:this.time,
  199 + value: this.time,
198 200 width: 175,
199 201 renderer: function (value) {
200 202 if (value != null) {
... ... @@ -208,33 +210,33 @@ Ext.define('amdaPlotComp.PlotPreviewUI', {
208 210 }
209 211 }
210 212  
211   - },'-',
212   - {
213   - text: 'Change cut time',
214   - scope: this,
215   - handler: function (bt) {
216   - var newTime = Ext.getCmp('plotPreview-goto-Date' + me.interactiveId).getValue();
217   - newTime = Ext.Date.add(newTime, Ext.Date.MINUTE, -newTime.getTimezoneOffset());
218   - me.panelResultInstance.callInteractivePlot({ 'action': 'instant', 'interactiveId': me.panelResultInstance.interactiveId, 'panelId': me.panelId, 'time': newTime.toISOString()});
219   - }
220   - },
  213 + }, '-',
  214 + {
  215 + text: 'Change cut time',
  216 + scope: this,
  217 + handler: function (bt) {
  218 + var newTime = Ext.getCmp('plotPreview-goto-Date' + me.interactiveId).getValue();
  219 + newTime = Ext.Date.add(newTime, Ext.Date.MINUTE, -newTime.getTimezoneOffset());
  220 + me.panelResultInstance.callInteractivePlot({ 'action': 'instant', 'interactiveId': me.panelResultInstance.interactiveId, 'panelId': me.panelId, 'time': newTime.toISOString() });
  221 + }
  222 + },
221 223 '-',
222   - {
223   - xtype:'button',
224   - text : 'Previous',
225   - handler: function(){
226   - var newTime = new Date(amdaPlotComp.PlotContextManager.getInstantTimePrev(me.crtContext)*1000);
227   - me.panelResultInstance.callInteractivePlot({ 'action': 'instant', 'interactiveId': me.panelResultInstance.interactiveId, 'panelId': me.panelId, 'time': newTime.toISOString()});
228   - }
229   - },
230   - {
231   - xtype:'button',
232   - text : 'Next',
233   - handler: function(){
234   - var newTime = new Date(amdaPlotComp.PlotContextManager.getInstantTimeNext(me.crtContext) *1000);
235   - me.panelResultInstance.callInteractivePlot({ 'action': 'instant', 'interactiveId': me.panelResultInstance.interactiveId, 'panelId': me.panelId, 'time': newTime.toISOString()});
236   - }
  224 + {
  225 + xtype: 'button',
  226 + text: 'Previous',
  227 + handler: function () {
  228 + var newTime = new Date(amdaPlotComp.PlotContextManager.getInstantTimePrev(me.crtContext) * 1000);
  229 + me.panelResultInstance.callInteractivePlot({ 'action': 'instant', 'interactiveId': me.panelResultInstance.interactiveId, 'panelId': me.panelId, 'time': newTime.toISOString() });
  230 + }
  231 + },
  232 + {
  233 + xtype: 'button',
  234 + text: 'Next',
  235 + handler: function () {
  236 + var newTime = new Date(amdaPlotComp.PlotContextManager.getInstantTimeNext(me.crtContext) * 1000);
  237 + me.panelResultInstance.callInteractivePlot({ 'action': 'instant', 'interactiveId': me.panelResultInstance.interactiveId, 'panelId': me.panelId, 'time': newTime.toISOString() });
237 238 }
  239 + }
238 240 ]
239 241 }
240 242 var mouseToolbar = {
... ... @@ -248,50 +250,49 @@ Ext.define('amdaPlotComp.PlotPreviewUI', {
248 250 ]
249 251 };
250 252  
251   - this.contextualMenu = Ext.create('Ext.menu.Menu', {
252   - width: 200,
253   - plain: true,
254   - items: [
255   - {
256   - text: 'Save Plot',
257   - handler : function ()
  253 + this.contextualMenu = Ext.create('Ext.menu.Menu', {
  254 + width: 200,
  255 + plain: true,
  256 + items: [
258 257 {
259   - if (me.hiddenForm == null)
260   - me.hiddenForm = Ext.create('Ext.form.Panel', {
261   - title:'hiddenForm',
262   - renderTo: Ext.getBody(),
263   - standardSubmit: true,
264   - url: 'php/downloadPlot.php',
265   - timeout: 120000,
266   - height:100,
267   - width: 100,
268   - hidden:true,
269   - items:[]
270   - });
  258 + text: 'Save Plot',
  259 + handler: function () {
  260 + if (me.hiddenForm == null)
  261 + me.hiddenForm = Ext.create('Ext.form.Panel', {
  262 + title: 'hiddenForm',
  263 + renderTo: Ext.getBody(),
  264 + standardSubmit: true,
  265 + url: 'php/downloadPlot.php',
  266 + timeout: 120000,
  267 + height: 100,
  268 + width: 100,
  269 + hidden: true,
  270 + items: []
  271 + });
271 272  
272   - me.hiddenForm.getForm().submit({
273   - params: {
274   - sessionId: sessionID,
275   - interactiveId : me.interactiveId,
276   - preview: true
277   - },
278   - success: function(form, action) {},
279   - failure: function(form, action) {}
280   - });
  273 + me.hiddenForm.getForm().submit({
  274 + params: {
  275 + sessionId: sessionID,
  276 + interactiveId: me.interactiveId,
  277 + preview: true
  278 + },
  279 + success: function (form, action) { },
  280 + failure: function (form, action) { }
  281 + });
  282 + }
281 283 }
282   - }
283   - ]
284   - });
285   -
286   - var plotPreviewPanelConfig = {
287   - preventHeader : true,
288   - autoScroll: false,
289   - items: [
290   - this.createPlotImage(configResult.folder, configResult.plotFile)
291   - ],
292   - dockedItems: [topToolbar,mouseToolbar]
293   - };
294   -
295   - Ext.apply(this , plotPreviewPanelConfig);
296   - }
  284 + ]
  285 + });
  286 +
  287 + var plotPreviewPanelConfig = {
  288 + preventHeader: true,
  289 + autoScroll: false,
  290 + items: [
  291 + this.createPlotImage(configResult.folder, configResult.plotFile)
  292 + ],
  293 + dockedItems: me.isPlotFunction ? [mouseToolbar] : [topToolbar, mouseToolbar]
  294 + };
  295 +
  296 + Ext.apply(this, plotPreviewPanelConfig);
  297 + }
297 298 });
... ...
js/app/views/PlotComponents/PlotTree.js
... ... @@ -611,179 +611,180 @@ Ext.define('amdaPlotComp.PlotTree', {
611 611 return false;
612 612 },
613 613  
614   - dropParamToCreate: function (targetNode, position, paramId, data)
615   - {
616   - var panelObject = null;
617   - if (targetNode == null)
618   - {
619   - //create new panel
620   - panelObject = this.tabObject.createNewPanel();
621   - } else
622   - {
623   - switch (targetNode.$className)
624   - {
625   - case 'amdaPlotObj.PlotParamsTreeNode' :
626   - case 'amdaPlotObj.PlotPanelTreeNode' :
627   - case 'amdaPlotObj.PlotAxesTreeNode' :
628   - panelObject = targetNode.object;
629   - break;
630   - case 'amdaPlotObj.PlotTimeAxisTreeNode' :
631   - case 'amdaPlotObj.PlotEpochAxisTreeNode' :
632   - case 'amdaPlotObj.PlotXAxisTreeNode' :
633   - case 'amdaPlotObj.PlotYLeftAxisTreeNode' :
634   - case 'amdaPlotObj.PlotYRightAxisTreeNode' :
635   - case 'amdaPlotObj.PlotColorAxisTreeNode' :
636   - case 'amdaPlotObj.PlotParamTreeNode' :
637   - panelObject = targetNode.parentNode.object;
638   - break;
639   - default:
640   - //create new panel
641   - panelObject = this.tabObject.createNewPanel();
642   - }
643   - }
  614 + dropParamToCreate: function (targetNode, position, paramId, data)
  615 + {
  616 + var panelObject = null;
  617 + if (targetNode == null)
  618 + {
  619 + //create new panel
  620 + panelObject = this.tabObject.createNewPanel();
  621 + } else
  622 + {
  623 + switch (targetNode.$className)
  624 + {
  625 + case 'amdaPlotObj.PlotParamsTreeNode' :
  626 + case 'amdaPlotObj.PlotPanelTreeNode' :
  627 + case 'amdaPlotObj.PlotAxesTreeNode' :
  628 + panelObject = targetNode.object;
  629 + break;
  630 + case 'amdaPlotObj.PlotTimeAxisTreeNode' :
  631 + case 'amdaPlotObj.PlotEpochAxisTreeNode' :
  632 + case 'amdaPlotObj.PlotXAxisTreeNode' :
  633 + case 'amdaPlotObj.PlotYLeftAxisTreeNode' :
  634 + case 'amdaPlotObj.PlotYRightAxisTreeNode' :
  635 + case 'amdaPlotObj.PlotColorAxisTreeNode' :
  636 + case 'amdaPlotObj.PlotParamTreeNode' :
  637 + panelObject = targetNode.parentNode.object;
  638 + break;
  639 + default:
  640 + //create new panel
  641 + panelObject = this.tabObject.createNewPanel();
  642 + }
  643 + }
644 644  
645   - //Create param object
646   - var me = this;
647   - if ((typeof data !== "undefined") && (typeof data.predefinedArgs !== "undefined") && data.predefinedArgs) {
648   - var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
649   - plotModule.parseTemplatedParam(paramId, function(param_info) {
650   - data.template_args = param_info.template_args;
651   - panelObject.createNewParam(param_info.paramid, data, function (newParamObject) {
652   - //Rebuild params node
653   - me.buildPanelsNode(newParamObject.getId());
654   - });
655   - //downModule.addParam(param_info.paramid, true, true, components, param_info.template_args);
656   - });
657   - }
658   - else {
659   - panelObject.createNewParam(paramId, data, function (newParamObject) {
660   - //Rebuild params node
661   - me.buildPanelsNode(newParamObject.getId());
662   - //BRE newParamObject
663   - });
664   - }
665   - },
  645 + //Create param object
  646 + var me = this;
  647 + if ((typeof data !== "undefined") && (typeof data.predefinedArgs !== "undefined") && data.predefinedArgs) {
  648 + var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
  649 + plotModule.parseTemplatedParam(paramId, function(param_info) {
  650 + data.template_args = param_info.template_args;
  651 + panelObject.createNewParam(param_info.paramid, data, function (newParamObject) {
  652 + //Rebuild params node
  653 + me.buildPanelsNode(newParamObject.getId());
  654 + });
  655 + //downModule.addParam(param_info.paramid, true, true, components, param_info.template_args);
  656 + });
  657 + }
  658 + else {
  659 + panelObject.createNewParam(paramId, data, function (newParamObject) {
  660 + //Rebuild params node
  661 + me.buildPanelsNode(newParamObject.getId());
  662 + //BRE newParamObject
  663 + });
  664 + }
  665 + },
666 666  
667   - dropRecord: function (record, targetNode, position)
668   - {
669   - var selModel = this.getSelectionModel();
  667 + dropRecord: function (record, targetNode, position)
  668 + {
  669 + var selModel = this.getSelectionModel();
670 670  
671   - //select the target node if defined
672   - if (targetNode)
673   - selModel.select(targetNode);
674   - else
675   - selModel.deselectAll();
  671 + //select the target node if defined
  672 + if (targetNode)
  673 + selModel.select(targetNode);
  674 + else
  675 + selModel.deselectAll();
676 676  
677   - switch (record.$className)
678   - {
679   - case 'amdaModel.sharedTimeTableNode' :
680   - case 'amdaModel.sharedCatalogNode' :
681   - case 'amdaModel.TimeTableNode' :
682   - case 'amdaModel.CatalogNode' :
683   - if (!record.get('leaf'))
684   - return false;
685   - this.dropParamToCreate(targetNode, position, record.get('id'), {'isTTCat': true, 'name': record.get('text')});
686   - return true;
687   - case 'amdaModel.LocalParamNode' :
688   - case 'amdaModel.RemoteParamNode' :
689   - case 'amdaModel.RemoteSimuParamNode' :
690   - if (!record.get('isParameter') || record.get('disable'))
691   - return false;
  677 + switch (record.$className)
  678 + {
  679 + case 'amdaModel.sharedTimeTableNode' :
  680 + case 'amdaModel.sharedCatalogNode' :
  681 + case 'amdaModel.TimeTableNode' :
  682 + case 'amdaModel.CatalogNode' :
  683 + if (!record.get('leaf'))
  684 + return false;
  685 + this.dropParamToCreate(targetNode, position, record.get('id'), {'isTTCat': true, 'name': record.get('text'), 'info':record.data.info});
  686 + return true;
  687 + case 'amdaModel.LocalParamNode' :
  688 + case 'amdaModel.RemoteParamNode' :
  689 + case 'amdaModel.RemoteSimuParamNode' :
  690 + if (!record.get('isParameter') || record.get('disable'))
  691 + return false;
692 692  
693   - if (record.get('alias') != "")
694   - this.dropParamToCreate(targetNode, position, "#" + record.get('alias'));
695   - else {
696   - var isVector = record.get('iconCls') == 'icon-vector';
697   - var component_info = record.get('component_info');
698   - var param_id = record.get('id');
699   - var plot_only = record.get('notyet');
700   - var components = null;
701   - var predefinedArgs = record.get('predefinedArgs');
702   - if (component_info && component_info.parentId) {
703   - //It's a component
704   - param_id = component_info.parentId;
705   - components = [];
706   - if (component_info.index1)
707   - components['index1'] = component_info.index1;
708   - if (component_info.index2)
709   - components['index2'] = component_info.index2;
  693 + if (record.get('alias') != "")
  694 + this.dropParamToCreate(targetNode, position, "#" + record.get('alias'));
  695 + else {
  696 + var isVector = record.get('iconCls') == 'icon-vector';
  697 + var component_info = record.get('component_info');
  698 + var param_id = record.get('id');
  699 + var plot_only = record.get('notyet');
  700 + var param_info = record.data.info;
  701 + var components = null;
  702 + var predefinedArgs = record.get('predefinedArgs');
  703 + if (component_info && component_info.parentId) {
  704 + //It's a component
  705 + param_id = component_info.parentId;
  706 + components = [];
  707 + if (component_info.index1)
  708 + components['index1'] = component_info.index1;
  709 + if (component_info.index2)
  710 + components['index2'] = component_info.index2;
710 711 predefinedArgs = record.parentNode.get('predefinedArgs');
711   - }
712   - this.dropParamToCreate(targetNode, position, param_id, {'components': components, 'isVector': isVector, 'plotOnly': plot_only, 'predefinedArgs': predefinedArgs});
713   - }
714   - return true;
715   - case 'amdaModel.AliasNode' :
716   - if (!record.isLeaf())
717   - return false;
718   - this.dropParamToCreate(targetNode, position, "#" + record.get('text'));
719   - return true;
720   - case 'amdaModel.DerivedParamNode' :
721   - if (!record.get('isParameter'))
722   - return false;
723   - //targetNode, position, paramId, paramComponents, isVector, plotOnly
724   - var isVector = record.get('iconCls') == 'icon-vector';
725   - var components = null;
726   - var dim1=record.get("dim_1");
727   - var dim2=record.get("dim_2");
728   - if(dim1>3 && dim2==1)
729   - {
730   - components = [];
731   - components['index2'] ="0"
732   - }else if(dim1==1 && dim2>1)
733   - {
734   - components = [];
735   - components['index1'] ="0"
736   - }
737   - this.dropParamToCreate(targetNode, position, "ws_" + record.get('text'), {'components': components, 'isVector': isVector});
738   - return true;
739   - case 'amdaModel.DerivedParamComponentNode':
740   - if (!record.get('isParameter'))
741   - return false;
742   - //targetNode, position, paramId, paramComponents, isVector, plotOnly
743   - paramId=record.get('text');
744   - var parentId = paramId.substr(0, paramId.length - 3);
745   - idToSent = "ws_" + parentId;
746   - var regExp = /\(([\d]+)\)/;
747   - var component_index = regExp.exec(paramId);
748   - if (component_index)
749   - {
750   - components = [];
751   - components['index1'] = component_index[1];
752   - }
753   - this.dropParamToCreate(targetNode, position,idToSent, {'components': components});
754   - return true;
755   - case 'amdaModel.MyDataParamComponentNode':
756   - if (!record.get('isParameter'))
757   - return false;
758   - //targetNode, position, paramId, paramComponents, isVector, plotOnly
759   - paramId=record.get('text');
760   - var parentId = paramId.substr(0, paramId.length - 3);
761   - idToSent = "wsd_" + parentId;
762   - var regExp = /\(([\d]+)\)/;
763   - var component_index = regExp.exec(paramId);
764   - if (component_index)
765   - {
766   - components = [];
767   - components['index1'] = component_index[1];
768   - }
769   - this.dropParamToCreate(targetNode, position,idToSent, {'components': components});
770   - return true;
771   - case 'amdaModel.MyDataParamNode' :
772   - if (!record.get('isParameter'))
773   - return false;
774   - this.dropParamToCreate(targetNode, position, "wsd_" + record.get('text'));
775   - return true;
776   - case 'amdaPlotObj.PlotParamTreeNode' :
777   - return this.moveParam(record, targetNode, position);
778   - case 'amdaPlotObj.PlotPanelTreeNode' :
779   - return this.movePanel(record, targetNode, position);
780   - case 'amdaModel.SpecialParamNode' :
781   - if (!record.get('isParameter'))
782   - return false;
783   - this.dropParamToCreate(targetNode, position, record.get('id'));
784   - return true;
785   - default :
786   - return false;
  712 + }
  713 + this.dropParamToCreate(targetNode, position, param_id, {'components': components, 'isVector': isVector, 'plotOnly': plot_only, 'predefinedArgs': predefinedArgs, 'info':param_info});
  714 + }
  715 + return true;
  716 + case 'amdaModel.AliasNode' :
  717 + if (!record.isLeaf())
  718 + return false;
  719 + this.dropParamToCreate(targetNode, position, "#" + record.get('text'));
  720 + return true;
  721 + case 'amdaModel.DerivedParamNode' :
  722 + if (!record.get('isParameter'))
  723 + return false;
  724 + //targetNode, position, paramId, paramComponents, isVector, plotOnly
  725 + var isVector = record.get('iconCls') == 'icon-vector';
  726 + var components = null;
  727 + var dim1=record.get("dim_1");
  728 + var dim2=record.get("dim_2");
  729 + if(dim1>3 && dim2==1)
  730 + {
  731 + components = [];
  732 + components['index2'] ="0"
  733 + }else if(dim1==1 && dim2>1)
  734 + {
  735 + components = [];
  736 + components['index1'] ="0"
  737 + }
  738 + this.dropParamToCreate(targetNode, position, "ws_" + record.get('text'), {'components': components, 'isVector': isVector, 'info':record.data.info});
  739 + return true;
  740 + case 'amdaModel.DerivedParamComponentNode':
  741 + if (!record.get('isParameter'))
  742 + return false;
  743 + //targetNode, position, paramId, paramComponents, isVector, plotOnly
  744 + paramId=record.get('text');
  745 + var parentId = paramId.substr(0, paramId.length - 3);
  746 + idToSent = "ws_" + parentId;
  747 + var regExp = /\(([\d]+)\)/;
  748 + var component_index = regExp.exec(paramId);
  749 + if (component_index)
  750 + {
  751 + components = [];
  752 + components['index1'] = component_index[1];
  753 + }
  754 + this.dropParamToCreate(targetNode, position,idToSent, {'components': components});
  755 + return true;
  756 + case 'amdaModel.MyDataParamComponentNode':
  757 + if (!record.get('isParameter'))
  758 + return false;
  759 + //targetNode, position, paramId, paramComponents, isVector, plotOnly
  760 + paramId=record.get('text');
  761 + var parentId = paramId.substr(0, paramId.length - 3);
  762 + idToSent = "wsd_" + parentId;
  763 + var regExp = /\(([\d]+)\)/;
  764 + var component_index = regExp.exec(paramId);
  765 + if (component_index)
  766 + {
  767 + components = [];
  768 + components['index1'] = component_index[1];
  769 + }
  770 + this.dropParamToCreate(targetNode, position,idToSent, {'components': components});
  771 + return true;
  772 + case 'amdaModel.MyDataParamNode' :
  773 + if (!record.get('isParameter'))
  774 + return false;
  775 + this.dropParamToCreate(targetNode, position, "wsd_" + record.get('text'));
  776 + return true;
  777 + case 'amdaPlotObj.PlotParamTreeNode' :
  778 + return this.moveParam(record, targetNode, position);
  779 + case 'amdaPlotObj.PlotPanelTreeNode' :
  780 + return this.movePanel(record, targetNode, position);
  781 + case 'amdaModel.SpecialParamNode' :
  782 + if (!record.get('isParameter'))
  783 + return false;
  784 + this.dropParamToCreate(targetNode, position, record.get('id'));
  785 + return true;
  786 + default :
  787 + return false;
787 788 }
788 789 return false;
789 790 },
... ...
js/app/views/PlotComponents/PlotZoomPlug.js
... ... @@ -18,7 +18,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
18 18 extend: 'Ext.util.Observable',
19 19 alias: 'plugin.plotZoomPlugin',
20 20 requires: [
21   - 'amdaPlotComp.plotFunction.ParamField', 'amdaPlotComp.plotFunction.FunctionType'],
  21 + 'amdaPlotComp.plotFunction.ParamField', 'amdaPlotComp.plotFunction.FunctionType', 'amdaPlotComp.plotFunction.CreatePlot'],
22 22  
23 23 id: 'plot-zoom-plug',
24 24  
... ... @@ -30,6 +30,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
30 30 zoomType: '',
31 31 interactiveId: '',
32 32 panelId: -1,
  33 + path_context_file: "",
33 34  
34 35 linkedTTCatNode: null,
35 36 /**
... ... @@ -60,7 +61,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
60 61 */
61 62 setParameters: function (listParams_) {
62 63 this.listParams = listParams_;
63   - this.plotFunctionParamField = new amdaPlotComp.plotFunction.ParamField({ params: this.listParams });
  64 + //this.plotFunctionParamField = new amdaPlotComp.plotFunction.ParamField({ params: this.listParams });
64 65 this.plotFunctionType = new amdaPlotComp.plotFunction.FunctionType({});
65 66 },
66 67  
... ... @@ -85,16 +86,15 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
85 86 var minValue = this.form.getForm().findField('zoom-min-time').getValue();
86 87 if (minValue <= max) {
87 88 this.form.getForm().findField('zoom-max-time').setValue(max);
88   - if (this.isPlotFunction)
89   - this.plotFunctionParamField.setValues(minValue, max);
  89 + //if (this.isPlotFunction)
  90 + //this.plotFunctionParamField.setValues(minValue, max);
90 91 }
91 92 else {
92 93 this.form.getForm().findField('zoom-min-time').setValue(max);
93 94 this.form.getForm().findField('zoom-max-time').setValue(minValue);
94   - if (this.isPlotFunction)
95   - this.plotFunctionParamField.setValues(max, minValue);
  95 + // if (this.isPlotFunction)
  96 + // this.plotFunctionParamField.setValues(max, minValue);
96 97 }
97   -
98 98 }
99 99 else {
100 100 var minValue = this.form.getForm().findField('zoom-min-float').getValue();
... ... @@ -434,7 +434,7 @@ Ext.define(&#39;amdaPlotComp.PlotZoomPlug&#39;, {
434 434 intervalFieldSet,
435 435 //Ici on rajoute les composants associés à la fonctionnalité 'PlotFunction'
436 436 me.isPlotFunction ? this.plotFunctionType : insertTTFieldSet,
437   - me.isPlotFunction ? this.plotFunctionParamField : null,
  437 + // me.isPlotFunction ? this.plotFunctionParamField : null,
438 438 ],
439 439 fbar: [
440 440 {
... ... @@ -444,7 +444,7 @@ Ext.define(&#39;amdaPlotComp.PlotZoomPlug&#39;, {
444 444 handler: function () {
445 445 if (this.zoomType == 'timeAxis') {
446 446 var minZoom = Ext.Date.format(this.form.getForm().findField('zoom-min-time').getValue(), 'Y-m-d\\TH:i:s.u');
447   - var maxZoom = Ext.Date.format(this.form.getForm().findField('zoom-max-time').getValue(),'Y-m-d\TH:i:s.u');
  447 + var maxZoom = Ext.Date.format(this.form.getForm().findField('zoom-max-time').getValue(), 'Y-m-d\TH:i:s.u');
448 448 }
449 449 else {
450 450 var minZoom = this.form.getForm().findField('zoom-min-float').getValue();
... ... @@ -461,7 +461,7 @@ Ext.define(&#39;amdaPlotComp.PlotZoomPlug&#39;, {
461 461 const stop_time = this.form.getForm().findField('zoom-max-time').getValue();
462 462  
463 463 let request_to_send = {};
464   - request_to_send = Object.assign({}, me.plotFunctionType.getValues(), me.plotFunctionParamField.getValues());
  464 + request_to_send = Object.assign({}, me.plotFunctionType.getValues()/*, me.plotFunctionParamField.getValues()*/);
465 465 request_to_send = Object.assign({}, request_to_send, {
466 466 'action': 'plotFunction',
467 467 'interactiveId': this.interactiveId,
... ... @@ -470,7 +470,21 @@ Ext.define(&#39;amdaPlotComp.PlotZoomPlug&#39;, {
470 470 'stoptime': stop_time
471 471 });
472 472  
473   - this.hostCmp.callInteractivePlot(request_to_send);
  473 + // const parent = this;
  474 + this.hostCmp.callInteractivePlot(request_to_send);/*, function () {
  475 + Ext.Ajax.request({
  476 + url: parent.path_context_file,
  477 + success: function (response, options) {
  478 + var xmlDoc = response.responseXML;
  479 + const wind = new amdaPlotComp.plotFunction.CreatePlot({
  480 + xmlDoc: xmlDoc, plotFunctionType: me.plotFunctionType,
  481 + plotFunctionParamField: me.plotFunctionParamField
  482 + });
  483 + wind.show();
  484 + wind.plot();
  485 + }
  486 + });
  487 + });*/
474 488  
475 489 } else {
476 490 this.hostCmp.callInteractivePlot({
... ... @@ -504,7 +518,7 @@ Ext.define(&#39;amdaPlotComp.PlotZoomPlug&#39;, {
504 518 });
505 519  
506 520 this.plotFunctionType.setParent(this.form.getForm());
507   - this.plotFunctionParamField.setParent(this.form.getForm());
  521 + // this.plotFunctionParamField.setParent(this.form.getForm());
508 522 return this.form;
509 523 },
510 524  
... ...
js/app/views/PlotComponents/plotFunction/CreatePlot.js 0 → 100644
... ... @@ -0,0 +1,195 @@
  1 +/**
  2 + * Un composant de 'PlotFunction' qui permet à l'utilisateur de séléctionner le type de fonction à appliquer : FFT, SUM, ...
  3 + */
  4 +Ext.define('amdaPlotComp.plotFunction.CreatePlot', {
  5 + extend: 'Ext.window.Window',
  6 + requires: [
  7 + 'amdaUI.PlotlyContainer'
  8 + ],
  9 +
  10 + initComponent: function () {
  11 +
  12 + this.emptyChartConfig = {
  13 + xtype: 'amdaUI.PlotlyContainer',
  14 + id: 'visu-chart',
  15 + };
  16 +
  17 + const config =
  18 + {
  19 + title: 'Apply a Function on Interval',
  20 + width: 700,
  21 + height: 500,
  22 + layout: 'fit',
  23 + bodyStyle: { background: '#FFFFFF' },
  24 + modal: false,
  25 + resizable: true,
  26 + maximizable: true,
  27 + items: [
  28 + this.emptyChartConfig
  29 + ]
  30 + };
  31 +
  32 + Ext.apply(this, config);
  33 + this.callParent(arguments);
  34 + },
  35 +
  36 + getXYData: function (data, serie_label) {
  37 + const separatorItems = "|";
  38 + const separator = ";";
  39 +
  40 + let legends = serie_label.split(separator);
  41 + legends.pop();
  42 +
  43 + let items = data.split(separatorItems);
  44 + items.pop();
  45 +
  46 + const xs = [];
  47 + const ys = [];
  48 + const labels = [];
  49 + for (j = 0; j < legends.length; j++) {
  50 + let i;
  51 + const y = [];
  52 + const x = [];
  53 + for (i = 0; i < items.length; i++) {
  54 + const temp = items[i].split(separator);
  55 + x.push(this.timeConverter(temp[0]));
  56 + y.push(temp[j + 1]);
  57 + }
  58 + ys.push(y);
  59 + xs.push(x);
  60 + labels.push(legends[j]);
  61 + }
  62 +
  63 + return { xs: xs, ys: ys, labels: labels };
  64 + },
  65 +
  66 + timeConverter: function (_timestamp) {
  67 + var a = new Date(_timestamp * 1000);
  68 + var year = a.getUTCFullYear();
  69 + var month = a.getUTCMonth() + 1;
  70 + var date = a.getUTCDate();
  71 + var hour = a.getUTCHours();
  72 + var min = a.getUTCMinutes();
  73 + var sec = a.getUTCSeconds();
  74 + var time = year + '-' + month + '-' + date + ' ' + hour + ':' + min + ':' + sec;
  75 + return time;
  76 + },
  77 +
  78 + applyFunction: function (y, dimSize) {
  79 + const type = this.plotFunctionType;
  80 + const valDict = type.getValues();
  81 + const fct = valDict[type.plotFunctionItems.type.name];
  82 + let out_y = [];
  83 + switch (fct) {
  84 + case type.plotFunctionItems.type.values.sum:
  85 + out_y = y;
  86 + break;
  87 + case type.plotFunctionItems.type.values.fft:
  88 +
  89 + break;
  90 + case type.plotFunctionItems.type.values.avg:
  91 + if (dimSize === -1) {
  92 + out_y = y.map(e => e / y.length);
  93 + } else {
  94 + out_y = y.map(e => e / dimSize);
  95 + }
  96 + break;
  97 +
  98 + default:
  99 + break;
  100 + }
  101 + return out_y;
  102 + },
  103 +
  104 +
  105 +
  106 + plot: function () {
  107 + const param = this.xmlDoc.getElementsByTagName('parameter');
  108 + const traces = [];
  109 + let yAxisLabel = "";
  110 + let i;
  111 + for (i = 0; i < param.length; i++) {
  112 + const param_name = param[i].getAttribute('name');
  113 + const param_unit = param[i].getAttribute('unit');
  114 + const serie = param[i].getElementsByTagName('serie');
  115 +
  116 + yAxisLabel += param_unit + "<br>";
  117 +
  118 + for (let si = 0; si < serie.length; si++) {
  119 + const serie_label = serie[si].getAttribute('serie_label');
  120 + const data_ = this.getXYData(serie[si].getAttribute('data'), serie_label);
  121 + let k;
  122 +
  123 + const dimSize = serie[si].getAttribute('dimSize');
  124 +
  125 + for (k = 0; k < data_.ys.length; k++) {
  126 + let trace = {};
  127 + trace.x = data_.xs[k];
  128 + trace.y = this.applyFunction(data_.ys[k], parseInt(dimSize));
  129 + trace.mode = 'lines+markers';
  130 + trace.name = param_name + " (" + data_.labels[k] + ")";
  131 + trace.type = 'scatter';
  132 +
  133 + traces.push(trace);
  134 + }
  135 + }
  136 + }
  137 +
  138 + var chart = Ext.getCmp(this.emptyChartConfig.id);
  139 +
  140 + var config = this.emptyChartConfig;
  141 +
  142 + config.data = traces;
  143 +
  144 + const config_ = {
  145 + showgrid: true,
  146 + zeroline: true,
  147 + showline: true,
  148 + mirror: 'ticks',
  149 + gridcolor: '#bdbdbd',
  150 + gridwidth: 1,
  151 + zerolinecolor: '#969696',
  152 + zerolinewidth: 1,
  153 + linecolor: '#636363',
  154 + linewidth: 1
  155 + };
  156 +
  157 + let config_x = {
  158 + title: {
  159 + text: "Time, UT"
  160 + },
  161 + type: 'date',
  162 + };
  163 +
  164 + let config_y = {
  165 + title: {
  166 + text: this.format_label(yAxisLabel)
  167 + },
  168 + exponentformat: "e"
  169 + }
  170 +
  171 + for (var key in config_) {
  172 + config_x[key] = config_[key];
  173 + config_y[key] = config_[key];
  174 + }
  175 +
  176 + config.layout = {
  177 + xaxis: config_x,
  178 + yaxis: config_y
  179 + };
  180 +
  181 + if (chart) {
  182 + var chartPanel = chart.up();
  183 + chartPanel.remove(chart);
  184 + }
  185 + var testPlotly = new amdaUI.PlotlyContainer(config);
  186 + chartPanel.insert(testPlotly);
  187 + },
  188 + format_label: function (label) {
  189 + const power_2 = "\xB2";
  190 + const power_3 = "\xB3";
  191 + const amda_power_2 = "#u2";
  192 + const amda_space = "#d";
  193 + return label.replace(amda_power_2, power_2).replace(amda_space, " ");
  194 + }
  195 +});
0 196 \ No newline at end of file
... ...
js/app/views/PlotComponents/plotFunction/FunctionType.js
... ... @@ -13,15 +13,24 @@ Ext.define(&#39;amdaPlotComp.plotFunction.FunctionType&#39;, {
13 13 field: "Function Type",
14 14 values: {
15 15 fft: "FFT",
16   - sum: "AVG"
  16 + dft: "DFT",
  17 + sum: "SUM",
  18 + avg: "AVG"
  19 + },
  20 + labels: {
  21 + fft: "DSP: FFT",
  22 + dft: "DSP: DFT",
  23 + sum: "SUM",
  24 + avg: "AVG"
17 25 }
18 26 },
19 27 scale: {
20 28 name: "scale_abscisse",
21 29 field: "Scale Abscisse",
22 30 values: {
23   - log: "Log",
24   - linear: "Linear"
  31 + log: "logarithmic",
  32 + linear: "linear",
  33 + inherits: "Inherits"
25 34 }
26 35 },
27 36 abscisse: {
... ... @@ -46,11 +55,19 @@ Ext.define(&#39;amdaPlotComp.plotFunction.FunctionType&#39;, {
46 55 const data_function_type = [];
47 56 let item_type = {};
48 57 item_type[key_] = this.plotFunctionItems.type.values.fft;
49   - item_type[name_] = this.plotFunctionItems.type.values.fft;
  58 + item_type[name_] = this.plotFunctionItems.type.labels.fft;
  59 + data_function_type.push(item_type);
  60 + item_type = {};
  61 + item_type[key_] = this.plotFunctionItems.type.values.dft;
  62 + item_type[name_] = this.plotFunctionItems.type.labels.dft;
50 63 data_function_type.push(item_type);
51 64 item_type = {};
52 65 item_type[key_] = this.plotFunctionItems.type.values.sum;
53   - item_type[name_] = this.plotFunctionItems.type.values.sum;
  66 + item_type[name_] = this.plotFunctionItems.type.labels.sum;
  67 + data_function_type.push(item_type);
  68 + item_type = {};
  69 + item_type[key_] = this.plotFunctionItems.type.values.avg;
  70 + item_type[name_] = this.plotFunctionItems.type.labels.avg;
54 71 data_function_type.push(item_type);
55 72  
56 73 const function_type = Ext.create('Ext.data.Store', {
... ... @@ -60,10 +77,15 @@ Ext.define(&#39;amdaPlotComp.plotFunction.FunctionType&#39;, {
60 77  
61 78 //Combo to choose type of scaling
62 79 const data_ = [];
  80 + const item_inherits = {};
  81 + item_inherits[key_] = this.plotFunctionItems.scale.values.inherits;
  82 + item_inherits[name_] = this.plotFunctionItems.scale.values.inherits;
  83 + data_.push(item_inherits);
  84 +
63 85 const item_log = {};
64 86 item_log[key_] = this.plotFunctionItems.scale.values.log;
65 87 item_log[name_] = this.plotFunctionItems.scale.values.log;
66   - //data_.push(item_log);
  88 + data_.push(item_log);
67 89  
68 90 const item_linear = {};
69 91 item_linear[key_] = this.plotFunctionItems.scale.values.linear;
... ... @@ -115,11 +137,11 @@ Ext.define(&#39;amdaPlotComp.plotFunction.FunctionType&#39;, {
115 137 name: this.plotFunctionItems.type.name,
116 138 listeners: {
117 139 change: function (combo, value) {
118   - if (value === me.plotFunctionItems.type.values.sum) {
119   - me.parent.findField(me.plotFunctionItems.abscisse.name).setVisible(false);
  140 + if (value === me.plotFunctionItems.type.values.fft || value === me.plotFunctionItems.type.values.dft) {
  141 + me.parent.findField(me.plotFunctionItems.abscisse.name).setVisible(true);
120 142 }
121 143 else {
122   - me.parent.findField(me.plotFunctionItems.abscisse.name).setVisible(true);
  144 + me.parent.findField(me.plotFunctionItems.abscisse.name).setVisible(false);
123 145 }
124 146 }
125 147 }
... ... @@ -132,7 +154,7 @@ Ext.define(&#39;amdaPlotComp.plotFunction.FunctionType&#39;, {
132 154 displayField: name_,
133 155 valueField: key_,
134 156 editable: false,
135   - value: this.plotFunctionItems.scale.values.linear,
  157 + value: this.plotFunctionItems.scale.values.inherits,
136 158 name: this.plotFunctionItems.scale.name
137 159 },
138 160 {
... ... @@ -155,7 +177,7 @@ Ext.define(&#39;amdaPlotComp.plotFunction.FunctionType&#39;, {
155 177 displayField: name_,
156 178 valueField: key_,
157 179 editable: false,
158   - value: this.plotFunctionItems.scale.values.linear,
  180 + value: this.plotFunctionItems.scale.values.inherits,
159 181 name: this.plotFunctionItems.scale_ordonnee.name
160 182 }
161 183 ]
... ...
js/app/views/PlotComponents/plotFunction/ParamField.js
... ... @@ -18,7 +18,7 @@ Ext.define(&#39;amdaPlotComp.plotFunction.ParamField&#39;, {
18 18  
19 19 initComponent: function () {
20 20 const items_params = [];
21   - const minSampling = "Min Sampling (s)";
  21 + const minSampling = "Sampling Time (s)";
22 22 const minValue = 0;
23 23 const labelWitdh = 120;
24 24 const width = 30;
... ... @@ -101,7 +101,7 @@ Ext.define(&#39;amdaPlotComp.plotFunction.ParamField&#39;, {
101 101 const ui_item = this.parent.findField(this.label_number_field1 + param.id);
102 102 if (i > 0) list += delimeter;
103 103 if (ui_item !== undefined && ui_item !== null) {
104   - list += param.id + delimeter + param.MinSampling + delimeter + ui_item.getValue();
  104 + list += param.id + delimeter + param.MinSampling + delimeter + ui_item.getValue() + delimeter + "5";
105 105 }
106 106 i++;
107 107 }
... ...
js/app/views/PlotTabResultUI.js
... ... @@ -80,8 +80,10 @@ Ext.define(&#39;amdaUI.PlotTabResultUI&#39;, {
80 80 var size = this.getImageSize();
81 81 // We need a list of parameters to compute the number of points needed to apply FFT
82 82 this.listParams = panelContext["parameters"];
  83 + zoomPlugin.path_context_file = 'data/' + sessionID + '/RES/' + this.configResult.folder + '/' + "plotFunction0_context.xml";
83 84 zoomPlugin.setParameters(this.listParams);
84 85  
  86 +
85 87 var me = this;
86 88 var insertIntervalItem = null;
87 89 var plotFunctionItem = null;
... ... @@ -159,7 +161,7 @@ Ext.define(&#39;amdaUI.PlotTabResultUI&#39;, {
159 161 scope: this
160 162 });
161 163 //plotFunction Menu
162   - /*plotFunctionItem = {
  164 + plotFunctionItem = {
163 165 text: 'Apply a Function on Interval',
164 166 handler: function (item, e) {
165 167 zoomPlugin.show(me.interactiveId, axis.id, panelContext.id, true);
... ... @@ -167,7 +169,7 @@ Ext.define(&#39;amdaUI.PlotTabResultUI&#39;, {
167 169 me.panelImage.startZoom(true, 0, size.height, onMinTimeSelection, onMaxTimeSelection);
168 170 },
169 171 scope: this
170   - };*/
  172 + };
171 173 insertIntervalItem = {
172 174 text: 'Insert Interval in TimeTable or Catalog',
173 175 handler: function (item, e) {
... ... @@ -220,7 +222,7 @@ Ext.define(&#39;amdaUI.PlotTabResultUI&#39;, {
220 222 me.contextualMenu.add(insertIntervalItem);
221 223 }
222 224 if (plotFunctionItem != null) {
223   - me.contextualMenu.insert(0,'-');
  225 + me.contextualMenu.insert(0, '-');
224 226 me.contextualMenu.insert(0, plotFunctionItem);
225 227 }
226 228 },
... ... @@ -334,7 +336,7 @@ Ext.define(&#39;amdaUI.PlotTabResultUI&#39;, {
334 336  
335 337 var crtTime = new Date(crtTimestamp * 1000);
336 338 //crtTime = Ext.Date.add(crtTime, Ext.Date.MINUTE, crtTime.getTimezoneOffset());
337   - me.callInteractivePlot({ 'action': 'instant', 'interactiveId': this.interactiveId, 'panelId': panel.id, 'time': crtTime.toISOString()});
  339 + me.callInteractivePlot({ 'action': 'instant', 'interactiveId': this.interactiveId, 'panelId': panel.id, 'time': crtTime.toISOString() });
338 340 },
339 341 scope: me
340 342 },
... ... @@ -453,7 +455,7 @@ Ext.define(&#39;amdaUI.PlotTabResultUI&#39;, {
453 455 ttTotalField.setValue(this.crtContext.page.ttNbIntervals);
454 456 },
455 457  
456   - callInteractivePlot: function (obj) {
  458 + callInteractivePlot: function (obj, postProcess = () => null) {
457 459 loadMask.show(true);
458 460  
459 461 var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
... ... @@ -690,6 +692,7 @@ Ext.define(&#39;amdaUI.PlotTabResultUI&#39;, {
690 692  
691 693 init: function (configResult) {
692 694 this.crtContext = configResult.context;
  695 + this.configResult = configResult;
693 696 this.interactiveId = configResult.interactiveId;
694 697 this.multiplot = (configResult.multiplot == true);
695 698  
... ...
js/app/views/SearchUI.js
... ... @@ -386,11 +386,11 @@ Ext.define(&#39;amdaUI.SearchUI&#39;,
386 386 if (searchModule) {
387 387 if (data.records[0].get('predefinedArgs')) {
388 388 searchModule.parseTemplatedParam(nameToSent, function (param_info) {
389   - searchModule.addParam(param_info.paramid, data.records[0].get('leaf'), true, components, param_info.template_args);
  389 + searchModule.addParam(param_info.paramid, data.records[0].get('leaf'), true, components, param_info.template_args, null);
390 390 });
391 391 }
392 392 else {
393   - searchModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
  393 + searchModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components, null, null);
394 394 }
395 395 }
396 396 return true;
... ...
js/app/views/StatisticsUI.js
... ... @@ -50,7 +50,7 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
50 50 parentUI.paramGrid.getView().refresh();
51 51 },
52 52  
53   - addParam: function (paramId, isLeaf, needArgs, components)
  53 + addParam: function (paramId, isLeaf, needArgs, components, predefined_args,info)
54 54 {
55 55 // adding the parameter to the paramGrid
56 56 var paramObj = amdaModel.RequestParamObject.getEmptyObj();
... ... @@ -68,6 +68,10 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
68 68 }
69 69 }
70 70  
  71 + if(info){
  72 + paramObj.qtip= info;
  73 + }
  74 +
71 75 var r = Ext.create('amdaModel.StatisticParam', paramObj);
72 76 this.paramGrid.getStore().add(r);
73 77 this.paramGrid.getSelectionModel().select(this.paramGrid.getStore().getCount() - 1);
... ... @@ -296,6 +300,7 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
296 300 sortable: false,
297 301 menuDisabled: true,
298 302 renderer: function (val, meta, rec) {
  303 + meta.tdAttr = 'data-qtip="' + rec.data.qtip + '"';
299 304 return rec.getParamFullName();
300 305 }
301 306 },
... ... @@ -366,6 +371,7 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
366 371 return false;
367 372 var nameToSent;
368 373 var components = null;
  374 + var info = data.records[0].get('info');
369 375  
370 376 switch (data.records[0].data.nodeType)
371 377 {
... ... @@ -449,11 +455,11 @@ Ext.define(&#39;amdaUI.StatisticsUI&#39;,
449 455 {
450 456 if (data.records[0].get('predefinedArgs')) {
451 457 module.parseTemplatedParam(nameToSent, function(param_info) {
452   - module.addParam(param_info.paramid, data.records[0].get('leaf'), true, components, param_info.template_args);
  458 + module.addParam(param_info.paramid, data.records[0].get('leaf'), true, components, param_info.template_args, info);
453 459 });
454 460 }
455 461 else {
456   - module.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components);
  462 + module.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components,null,info);
457 463 }
458 464 }
459 465 return true;
... ...
php/WebServices/WebServer.php
... ... @@ -623,6 +623,33 @@ class WebServer
623 623  
624 624 $this->throwError("serverError", $res['message']);
625 625 }
  626 +
  627 +/*
  628 +* get EPN-TAP granule
  629 +*/
  630 + public function getGranule($data)
  631 + {
  632 + if (!array_key_exists('obs_id', $data) || !array_key_exists('start', $data) || !array_key_exists('stop', $data)) {
  633 + $this->throwError("serverError", "Missing obs_id, start or stop definition");
  634 + }
  635 + $data['datasetID'] = $data['obs_id'];
  636 + $data['startTime'] = $data['start'];
  637 + $data['stopTime'] = $data['stop'];
  638 + $data['outputFormat'] = "CDF_ISTP";
  639 + if (array_key_exists('format', $data)) {
  640 + $data['outputFormat'] = $data["format"];
  641 + }
  642 + $res = $this->getDataset($data);
  643 + if (!$res['success']) {
  644 + return $res;
  645 + }
  646 + if (array_key_exists('dataFileURLs', $res)) {
  647 + $data = file_get_contents($res['dataFileURLs']);
  648 + header("Location: ".$res['dataFileURLs']);
  649 + die();
  650 + }
  651 + $this->throwError("serverError", "Unknown error");
  652 + }
626 653  
627 654 /*
628 655 * get status for jobs in batch
... ...
php/classes/CatalogCacheIntervalObject.php
... ... @@ -56,7 +56,11 @@ class CatalogCacheIntervalObject extends TimeTableCacheIntervalObject
56 56 $value = ($i >= count($values_array)) ? "" : $values_array[$i];
57 57 switch ($parameter['type']) {
58 58 case 0: //double
59   - fwrite($handle,pack('d', floatval($value)));
  59 + if($value == "nan")
  60 + $floatValue = NAN;
  61 + else
  62 + $floatValue = floatval($value);
  63 + fwrite($handle,pack('d', $floatValue));
60 64 break;
61 65 case 1: //date (timestamp)
62 66 fwrite($handle,pack('d', TimeUtils::iso2stamp($value)));
... ... @@ -98,7 +102,7 @@ class CatalogCacheIntervalObject extends TimeTableCacheIntervalObject
98 102 if (!$res = unpack('dval',fread($handle,8))) {
99 103 break;
100 104 }
101   - $val = $res['val'];
  105 + $val = is_nan($res['val']) ? "nan" : $res['val'];
102 106 break;
103 107 case 1: //date (timestamp)
104 108 if (!$res = unpack('dval',fread($handle,8))) {
... ...
php/config.php
... ... @@ -120,6 +120,9 @@ define(&#39;XMLPATH&#39;, IHM_SRC_DIR.&#39;/php/XML/&#39;);
120 120 define('HAPIData', DATAPATH.'/HAPI/');
121 121 define('HAPISERVER_PATH', '/opt/tools/hapi-server/');
122 122  
  123 +// EPNTAP dirs
  124 +define('EPNTAPData', DATAPATH.'/EPN-TAP/');
  125 +
123 126 require_once(INTEGRATION_BASE_PATH.'/src/amdaintegration_autoload.php');
124 127  
125 128  
... ...
php/getEnv.php
... ... @@ -26,6 +26,8 @@ $variables = array(
26 26 'RemoteData',
27 27 'HAPIData',
28 28 'HAPISERVER_PATH',
  29 + 'EPNTAPData',
  30 + 'REST_API_URL',
29 31 );
30 32  
31 33 foreach ($variables as $variable) {
... ...
php/rest/getGranule.php 0 → 100644
... ... @@ -0,0 +1,44 @@
  1 +<?php
  2 +
  3 +/**
  4 + * @api {get} getDataset.php getDataset
  5 + * @apiDescription Provides data corresponding to a dataset chosen by the user among those available in AMDA
  6 + * @apiName getDataset
  7 + * @apiGroup webservices
  8 + *
  9 + * @apiParam {String} token The API token.
  10 + * @apiParam {String} startTime Beginning of the time interval (ISO 8601 or UNIXTIME format).
  11 + * @apiParam {String} stopTime End of the time interval (ISO 8601 or UNIXTIME format).
  12 + * @apiParam {String} datasetID Identifier of the dataset, as defined in the file returned by the *getObsDataTree* web-services.
  13 + * @apiParam {String} [sampling] Sampling of data (*in seconds*).
  14 + * @apiParam {String} [userID] Identifier of the user in AMDA (*mandatory for user owned data*)
  15 + * @apiParam {String} [password] Password of the user in AMDA (*mandatory for user owned data*)
  16 + * @apiParam {String} [outputFormat] Format of the returned file. Two options: `VOTable` and `ASCII`.
  17 + * @apiParam {String} [timeFormat] Format of time in the data files. Two options: `ISO8601` and `UNIXTIME`.
  18 + * @apiParam {Boolean} [gzip] `1` if the file must be compressed before delivery.
  19 + *
  20 + * @apiSuccess {String} success `true`
  21 + * @apiSuccess {String} dataFileURLs URL of the files matching the criteria. If the file is empty, there is no data
  22 + * matching these criteria.
  23 + * @apiSuccess {String} status status of the job ( done | in_progress )
  24 + *
  25 + * @apiSuccessExample Success-Response:
  26 + * HTTP/1.1 200 OK
  27 + * [success] => 1
  28 + * http://amda.irap.omp.eu/AMDA/data/WSRESULT/getdataset_ace-imf-all_20130923T090000_20130924T130000.txt
  29 + * [status] => done
  30 + *
  31 + * @apiErrorExample Error-Response:
  32 + * {"error":"Cannot find info file for dataset ace-imf-any"}
  33 +
  34 + */
  35 +
  36 +//ini_set("allow_url_fopen", true);
  37 + require_once '../config.php';
  38 +
  39 + $amda_ws = new WebServer();
  40 +
  41 + $result = $amda_ws->getGranule($_GET);
  42 +
  43 + echo json_encode($result);
  44 +?>
... ...
update_amda/makeEPNTAPGranules.php 0 → 100644
... ... @@ -0,0 +1,368 @@
  1 +<?php
  2 +
  3 +//error_reporting(E_ERROR);
  4 +
  5 +$localparams_tree = getenv('LocalData')."/LocalParams.xml";
  6 +$output_file = getenv('EPNTAPData')."/amda-granules.csv";
  7 +$ddservice_wsdl = getenv('DD_WSDL');
  8 +$amda_rest_api = getenv('REST_API_URL');
  9 +
  10 +$mapping = array(
  11 + 'granule_uid' => '@@dataset_id@@-@@granule_index@@',
  12 + 'granule_gid' => 'data',
  13 + 'obs_id' => '@@dataset_id@@',
  14 + 'dataproduct_type' => 'ts',
  15 + 'target_name' => '@@target_name@@',
  16 + 'target_class' => '@@target_class@@',
  17 + 'time_min' => '@@granule_start_time@@',
  18 + 'time_max' => '@@granule_stop_time@@',
  19 + 'time_sampling_step_min' => '@@min_sampling@@',
  20 + 'time_sampling_step_max' => '@@max_sampling@@',
  21 + 'time_exp_min' => '',
  22 + 'time_exp_max' => '',
  23 + 'spectral_range_min' => '',
  24 + 'spectral_range_max' => '',
  25 + 'spectral_sampling_step_min' => '',
  26 + 'spectral_sampling_step_max' => '',
  27 + 'spectral_resolution_min' => '',
  28 + 'spectral_resolution_max' => '',
  29 + 'c1min' => '',
  30 + 'c1max' => '',
  31 + 'c2min' => '',
  32 + 'c2max' => '',
  33 + 'c3min' => '',
  34 + 'c3max' => '',
  35 + 's_region' => '',
  36 + 'c1_resol_min' => '',
  37 + 'c1_resol_max' => '',
  38 + 'c2_resol_min' => '',
  39 + 'c2_resol_max' => '',
  40 + 'c3_resol_min' => '',
  41 + 'c3_resol_max' => '',
  42 + 'spatial_frame_type' => '',
  43 + 'incidence_min' => '',
  44 + 'incidence_max' => '',
  45 + 'emergence_min' => '',
  46 + 'emergence_max' => '',
  47 + 'phase_min' => '',
  48 + 'phase_max' => '',
  49 + 'instrument_host_name' => '@@mission_name@@',
  50 + 'instrument_name' => '@@instrument_name@@',
  51 + 'measurement_type' => '@@measurement_type@@',
  52 + 'processing_level' => '@@processing_level@@',
  53 + 'creation_date' => '@@creation_date@@',
  54 + 'modification_date' => '@@modification_date@@',
  55 + 'release_date' => '@@release_date@@',
  56 + 'service_title' => 'AMDADB',
  57 + 'access_url' => '@@amda_rest_api_entry_point@@getGranule.php?obs_id=@@dataset_id@@&start=@@granule_start_time_timestamp@@&stop=@@granule_stop_time_timestamp@@&format=CDF',
  58 + 'access_format' => 'application/x-cdf-istp',
  59 + 'target_region' => '@@target_region@@',
  60 + 'publisher' => 'CDPP',
  61 + 'time_scale' => 'UTC',
  62 + 'spase_resource_id' => '@@spase_resource_id@@',
  63 + 'spase_region' => '@@spase_region@@',
  64 + 'spase_measurement_type' => '@@spase_measurement_type@@',
  65 +);
  66 +
  67 +function parseSampling($sampling) {
  68 + if (empty($sampling))
  69 + return "";
  70 + $unit = substr($sampling, -1);
  71 + $value = floatval(substr($sampling, 0, -1));
  72 + switch ($unit) {
  73 + case "S":
  74 + return strval($value);
  75 + case "M":
  76 + return strval(60.*$value);
  77 + case "H":
  78 + return strval(3600.*$value);
  79 + case "D":
  80 + return strval(86400.*$value);
  81 + default:
  82 + echo "[WARNING] Sampling - Unknown unit: ".$sampling.PHP_EOL;
  83 + return $sampling;
  84 + }
  85 +}
  86 +
  87 +function parseProcessingLevel($info) {
  88 + if (strpos($info, 'L1') !== FALSE) {
  89 + return '2';
  90 + }
  91 + if (strpos($info, 'L3') !== FALSE) {
  92 + return '5';
  93 + }
  94 + return '3';
  95 +}
  96 +
  97 +function spaseToEpnTapMeasurementType($measurement_type) {
  98 + return $measurement_type;
  99 +}
  100 +
  101 +function timestampToJulianDay($timestamp) {
  102 + return intval($timestamp) / 86400 + 2440587.5;
  103 +}
  104 +
  105 +function getTargetClass($spaseRegion) {
  106 + $parts = explode(".", $spaseRegion);
  107 + if (count($parts) < 1) {
  108 + echo "[WARNING] Error in ObservatoryRegion definition : ".$spaseRegion.PHP_EOL;
  109 + return "planet";
  110 + }
  111 + switch ($parts[0]) {
  112 + case "Asteroid":
  113 + return "asteroid";
  114 + case "Comet":
  115 + return "comet";
  116 + case "Earth":
  117 + case "Jupiter":
  118 + case "Mars":
  119 + case "Mercury":
  120 + case "Neptune":
  121 + case "Pluto":
  122 + case "Saturn":
  123 + case "Uranus":
  124 + case "Venus":
  125 + if ((count($parts) > 1) && !in_array($parts[1], array("Magnetosheath", "Magnetosphere", "NearSurface", "Surface"))) {
  126 + return "satellite";
  127 + }
  128 + return "planet";
  129 + case "Heliosphere":
  130 + case "Interstellar":
  131 + return "interplanetary_medium";
  132 + case "Sun":
  133 + return "star";
  134 + }
  135 + echo "[WARNING] Error in ObservatoryRegion definition : ".$spaseRegion.PHP_EOL;
  136 + return "planet";
  137 +}
  138 +
  139 +function getTargetName($targetClass, $spaseRegion, $missionName, $dataset_id) {
  140 + $parts = explode(".", $spaseRegion);
  141 + if (count($parts) < 1) {
  142 + return "";
  143 + }
  144 + switch ($targetClass) {
  145 + case "planet":
  146 + if ((count($parts) > 1) && !in_array($parts[1], array("Magnetosheath", "Magnetosphere", "NearSurface", "Surface"))) {
  147 + return $parts[1];
  148 + }
  149 + return $parts[0];
  150 + case "star":
  151 + case "interplanetary_medium":
  152 + return "Sun";
  153 + case "comet":
  154 + switch ($missionName) {
  155 + case "Rosetta":
  156 + return "67P";
  157 + case "Giotto":
  158 + return "1P";
  159 + case "Astronomical Objects Ephemerides":
  160 + if ($dataset_id == "p67-orb-all")
  161 + return "67P";
  162 + break;
  163 + case "ICE":
  164 + if ($dataset_id == "ice-mag-p21")
  165 + return "21P";
  166 + }
  167 + echo "[WARNING] Comet Id not defined for mission : ".$missionName.PHP_EOL;
  168 + return "";
  169 + }
  170 + echo "[WARNING] Cannot retrieve target name from target class : ".$targetClass.PHP_EOL;
  171 + return "";
  172 +}
  173 +
  174 +function getTargetRegion($targetClass, $spaseRegion) {
  175 + $parts = explode(".", $spaseRegion);
  176 + if (count($parts) < 1) {
  177 + return "";
  178 + }
  179 + switch ($targetClass) {
  180 + case "planet":
  181 + if (count($parts) > 1) {
  182 + switch ($parts[1]) {
  183 + case "Magnetosheath":
  184 + case "Magnetosphere":
  185 + return "planetary-magnetosphere";
  186 + case "NearSurface":
  187 + if (count($parts) > 2) {
  188 + switch ($parts[2]) {
  189 + case "Atmosphere":
  190 + return "planetary-atmospheres";
  191 + case "Ionosphere":
  192 + return "planetary-ionospheres";
  193 + }
  194 + }
  195 + return "planetary-atmospheres";
  196 + case "Surface":
  197 + return "planetary-surfaces";
  198 + }
  199 + }
  200 + break;
  201 + case "star":
  202 + case "interplanetary_medium":
  203 + return "solar-wind";
  204 + }
  205 + return "";
  206 +}
  207 +
  208 +ini_set("soap.wsdl_cache_enabled", 0);
  209 +try {
  210 + $client = new SoapClient($ddservice_wsdl, array('trace' => 1));
  211 +}
  212 +catch (SoapFault $exception) {
  213 + echo "[ERROR] Cannot retrieve DDService - ".$ddservice_wsdl.PHP_EOL;
  214 + return;
  215 +}
  216 +
  217 +$amda_place_holders = array(
  218 + 'amda_rest_api_entry_point' => $amda_rest_api,
  219 +);
  220 +
  221 +$doc = new DOMDocument();
  222 +@$doc->load($localparams_tree);
  223 +
  224 +$xpath = new DOMXpath($doc);
  225 +
  226 +$output_file_handle = fopen($output_file, 'w');
  227 +fputcsv($output_file_handle, array_keys($mapping));
  228 +
  229 +$dataset_nodes = $xpath->query("/dataRoot/dataCenter/mission/instrument/dataset | /dataRoot/dataCenter/mission/observatory/instrument/dataset | /dataRoot/dataCenter/mission/instrument/datasetGroup/dataset");
  230 +$datasets = array();
  231 +foreach ($dataset_nodes as $dataset_node) {
  232 + $dataset_place_holders = array();
  233 + //Dataset id
  234 + $datasetId = $dataset_node->getAttribute("xml:id");
  235 + if (empty($datasetId)) {
  236 + echo "[WARNING] Cannot retrieve dataset id".PHP_EOL;
  237 + continue;
  238 + }
  239 + $dataset_place_holders['dataset_id'] = $datasetId;
  240 +
  241 + //Exclude dataset with group
  242 + $to_exclude = FALSE;
  243 + $crt_node = $dataset_node;
  244 + while (($crt_node != NULL) && !$to_exclude) {
  245 + if ($crt_node->nodeType == XML_ELEMENT_NODE) {
  246 + $group = $crt_node->getAttribute("group");
  247 + if (!empty($group)) {
  248 + $to_exclude = TRUE;
  249 + }
  250 + }
  251 + $crt_node = $crt_node->parentNode;
  252 + }
  253 + if ($to_exclude) {
  254 + echo "[WARNING] Exclude dataset ".$datasetId." (group restriction)".PHP_EOL;
  255 + continue;
  256 + }
  257 +
  258 + $dataset_place_holders['min_sampling'] = parseSampling($dataset_node->getAttribute("sampling"));
  259 + $dataset_place_holders['max_sampling'] = parseSampling($dataset_node->getAttribute("maxSampling"));
  260 + $dataset_place_holders['spase_resource_id'] = $dataset_node->getAttribute("spaseId");
  261 + $dataset_place_holders['spase_measurement_type'] = $dataset_node->getAttribute("measurement_type");
  262 + $dataset_place_holders['measurement_type'] = spaseToEpnTapMeasurementType($dataset_place_holders['spase_measurement_type']);
  263 + $dataset_place_holders['processing_level'] = parseProcessingLevel($dataset_node->getAttribute("xml:id"));
  264 + $target = $dataset_node->getAttribute("target");
  265 +
  266 +
  267 + $instrument_node = NULL;
  268 + $mission_node = NULL;
  269 + $observatory_node = NULL;
  270 + $dataset_group_node = NULL;
  271 +
  272 + $crt_node = $dataset_node;
  273 + while ($crt_node = $crt_node->parentNode) {
  274 + switch ($crt_node->nodeName) {
  275 + case 'instrument':
  276 + $instrument_node = $crt_node;
  277 + break;
  278 + case 'mission':
  279 + $mission_node = $crt_node;
  280 + break;
  281 + case 'observatory':
  282 + $observatory_node = $crt_node;
  283 + break;
  284 + case 'datasetGroup':
  285 + $dataset_group_node = $crt_node;
  286 + break;
  287 + }
  288 + }
  289 +
  290 + if (empty($instrument_node) || empty($mission_node)) {
  291 + echo "[ERROR] Cannot retrieve Mission or Instrument info for dataset ".$datasetId.PHP_EOL;
  292 + continue;
  293 + }
  294 +
  295 + $mission_name = $mission_node->getAttribute('name');
  296 + $instrument_name = $instrument_node->getAttribute('name');
  297 + if (empty($target)) {
  298 + $target = $instrument_node->getAttribute('target');
  299 + if (empty($target)) {
  300 + if (!empty($observatory_node)) {
  301 + $target = $observatory_node->getAttribute('target');
  302 + }
  303 + if (empty($target)) {
  304 + $target = $mission_node->getAttribute('target');
  305 + }
  306 + }
  307 + }
  308 + if (empty($target)) {
  309 + echo "[WARNING] No target defined for ".$datasetId.PHP_EOL;
  310 + }
  311 + $dataset_place_holders['spase_region'] = $target;
  312 + $dataset_place_holders['target_class'] = getTargetClass($target);
  313 + $dataset_place_holders['target_name'] = getTargetName($dataset_place_holders['target_class'], $target, $mission_name, $datasetId);
  314 + $dataset_place_holders['target_region'] = getTargetRegion($dataset_place_holders['target_class'], $target);
  315 + if (!empty($observatory_node)) {
  316 + $mission_name = $observatory_node->getAttribute('name');
  317 + }
  318 + $dataset_place_holders['mission_name'] = $mission_name;
  319 + $dataset_place_holders['instrument_name'] = $instrument_name;
  320 + if (!empty($dataset_group_node)) {
  321 + if ($dataset_place_holders['processing_level'] == 'L2') {
  322 + $dataset_place_holders['processing_level'] = parseProcessingLevel($dataset_group_node->getAttribute("xml:id"));
  323 + }
  324 + }
  325 +
  326 + try {
  327 + $vi = str_replace("-","_",$datasetId);
  328 + $res = $client->getGranules($vi);
  329 + }
  330 + catch (SoapFault $exception) {
  331 + echo "[ERROR] Cannot retrieve granules for ".$datasetId." - ".$exception->faultstring.PHP_EOL;
  332 + continue;
  333 + }
  334 +
  335 + if (empty($res)) {
  336 + echo "[ERROR] No granules for ".$datasetId.PHP_EOL;
  337 + continue;
  338 + }
  339 +
  340 + $granules = explode(PHP_EOL, $res);
  341 + foreach ($granules as $granule) {
  342 + $granule_info = explode(" ", $granule);
  343 + if (empty($granule_info) || (count($granule_info) != 4)) {
  344 + echo "[ERROR] Bad granule info in ".$datasetId.PHP_EOL;
  345 + continue;
  346 + }
  347 + $granule_place_holders['granule_index'] = str_replace(".nc", "", $granule_info[2]);
  348 + $granule_place_holders['granule_start_time'] = timestampToJulianDay($granule_info[0]);
  349 + $granule_place_holders['granule_stop_time'] = timestampToJulianDay($granule_info[1]);
  350 + $granule_place_holders['modification_date'] = timestampToJulianDay($granule_info[3]);
  351 + $granule_place_holders['granule_start_time_timestamp'] = $granule_info[0];
  352 + $granule_place_holders['granule_stop_time_timestamp'] = $granule_info[1];
  353 + $granule_place_holders['creation_date'] = $granule_place_holders['modification_date'];
  354 + $granule_place_holders['release_date'] = $granule_place_holders['modification_date'];
  355 +
  356 + $fields = array_values($mapping);
  357 + $all_place_holders = $amda_place_holders + $dataset_place_holders + $granule_place_holders;
  358 + foreach ($all_place_holders as $place_holder => $value) {
  359 + foreach ($fields as &$field) {
  360 + $field = str_replace('@@'.$place_holder.'@@', $value, $field);
  361 + }
  362 + }
  363 + fputcsv($output_file_handle, $fields);
  364 + }
  365 +}
  366 +
  367 +fclose($output_file_handle);
  368 +?>
... ...