Commit 7e4e1064cc977891d402fcf02f7b2fce76395d27

Authored by Benjamin Renard
2 parents 090b0d11 4793fd6e

Merge branch 'amdadev'

generic_data/Functions/functions.xml
... ... @@ -49,6 +49,34 @@
49 49 <info_brief>skewness() function</info_brief>
50 50 <new_kernel>#skew</new_kernel>
51 51 </function>
  52 + <function name="covariance_(,,)" args="2" kind="time" group="stat">
  53 + <prompts>
  54 + <prompt>input window time in secs</prompt>
  55 + </prompts>
  56 + <info_brief>covariance() function for two params</info_brief>
  57 + <new_kernel>#covariance</new_kernel>
  58 + </function>
  59 + <function name="pearson_(,,)" args="2" kind="time" group="stat">
  60 + <prompts>
  61 + <prompt>input window time in secs</prompt>
  62 + </prompts>
  63 + <info_brief>Pearson coefficient of two parameters</info_brief>
  64 + <new_kernel>#pearson</new_kernel>
  65 + </function>
  66 + <function name="kendall_(,,)" args="2" kind="time" group="stat">
  67 + <prompts>
  68 + <prompt>input window time in secs</prompt>
  69 + </prompts>
  70 + <info_brief>Kendall coefficient of two parameters</info_brief>
  71 + <new_kernel>#kendall</new_kernel>
  72 + </function>
  73 + <function name="spearman_(,,)" args="2" kind="time" group="stat">
  74 + <prompts>
  75 + <prompt>input window time in secs</prompt>
  76 + </prompts>
  77 + <info_brief>Spearman coefficient of two parameters</info_brief>
  78 + <new_kernel>#spearman</new_kernel>
  79 + </function>
52 80 <function name="mean_sm_(,)" args="1" kind="sliding" group="stat">
53 81 <prompts>
54 82 <prompt>input averaging time in secs</prompt>
... ... @@ -114,11 +142,37 @@
114 142 <info_brief>Remove Spikes ( ! Experimental ! ) : filter(param, factor,nPoints)</info_brief>
115 143 <new_kernel>#filter</new_kernel>
116 144 </function>
  145 + <function name="BCain(,)" args="2" kind="model" group="space">
  146 + <default_args>"",mag</default_args>
  147 + <info_brief>Cain model for Mars Magnetic Field</info_brief>
  148 + <new_kernel>#bcain</new_kernel>
  149 + </function>
117 150 <function name="vAlfven(,)" args="2" kind="physics" group="space">
118 151 <prompt_param>density[cm^⁻3], b_magnitude[nT]</prompt_param>
119 152 <info_brief>Alfven velocity Valfven(density[cm^⁻3], b_magnitude[nT])</info_brief>
120 153 <new_kernel>alfvenVelocity</new_kernel>
121 154 </function>
  155 + <function name="mlt_maglib(,)" args="1" kind="physics" group="space">
  156 + <prompts>
  157 + <prompt type="list" subtype="external_fields" default="1">External field:</prompt>
  158 + </prompts>
  159 + <info_brief>Compute MLT from geographical spacecraft position (cartesian coordinates and in Earth radius)</info_brief>
  160 + <new_kernel>#maglib_mlt</new_kernel>
  161 + </function>
  162 + <function name="invlat_maglib(,)" args="1" kind="physics" group="space">
  163 + <prompts>
  164 + <prompt type="list" subtype="external_fields" default="1">External field:</prompt>
  165 + </prompts>
  166 + <info_brief>Compute InvLat from geographical spacecraft position (cartesian coordinates and in Earth radius)</info_brief>
  167 + <new_kernel>#maglib_invlat</new_kernel>
  168 + </function>
  169 + <function name="lparam_maglib(,)" args="1" kind="physics" group="space">
  170 + <prompts>
  171 + <prompt type="list" subtype="external_fields" default="1">External field:</prompt>
  172 + </prompts>
  173 + <info_brief>Compute L Param from geographical spacecraft position (cartesian coordinates and in Earth radius)</info_brief>
  174 + <new_kernel>#maglib_lparam</new_kernel>
  175 + </function>
122 176  
123 177 <function name="perreault78(,,)" args="3" kind="model" group="space">
124 178 <info_brief>Perreault and Akasofu 1978 model u = perreault78(E_mag, B_mag, theta_p)</info_brief>
... ... @@ -156,11 +210,35 @@
156 210 </info_brief>
157 211 <new_kernel>lopez90</new_kernel>
158 212 </function>
  213 + <function name="pv_ionos_dn(,)" args="2" kind="model" group="space">
  214 + <prompt_param></prompt_param>
  215 + <default_args>alt(Km), sza(Radians)</default_args>
  216 + <info_brief>
  217 + Electron Density around Venus &lt;br/&gt;
  218 + dn = pv_ionos_dn(alt, sza) &lt;br/&gt;
  219 + alt is the altitude in Km
  220 + sza is the solat zenith angle in radians
  221 + dn is the base 10 log of the model electron density in no/cc
  222 + </info_brief>
  223 + <new_kernel>pv_ionos_dn</new_kernel>
  224 + </function>
  225 + <function name="pv_ionos_te(,)" args="2" kind="model" group="space">
  226 + <prompt_param></prompt_param>
  227 + <default_args>alt(Km), sza(Radians)</default_args>
  228 + <info_brief>
  229 + Electron temperature around Venus &lt;br/&gt;
  230 + te = pv_ionos_dn(alt, sza) &lt;br/&gt;
  231 + alt is the altitude in Km
  232 + sza is the solat zenith angle in radians
  233 + te is in log10 deg K
  234 + </info_brief>
  235 + <new_kernel>pv_ionos_te</new_kernel>
  236 + </function>
159 237 <function name="framesTransformation(,,,)" args="1" kind="frames" group="space">
160 238 <prompts>
161 239 <prompt type="list" subtype="frames" default="GSM">Input frame:</prompt>
162 240 <prompt type="list" subtype="frames" default="GSE">Output frame:</prompt>
163   - <prompt type="boolean">The vector represent a position in space?</prompt>
  241 + <prompt type="boolean">The vector represents a position in space</prompt>
164 242 </prompts>
165 243 <info_brief>Frames transformation</info_brief>
166 244 <new_kernel>#framesTransformation</new_kernel>
... ...
generic_data/Functions/functions_args_list.xml
... ... @@ -32,4 +32,11 @@
32 32 <value key="VSO" value="VSO" info="Venus Solar Orbital"/>
33 33 </values>
34 34 </arglist>
  35 + <arglist id="external_fields">
  36 + <values>
  37 + <value key="1" value="Tsyganenko 87"/>
  38 + <value key="2" value="Tsyganenko 89"/>
  39 + <value key="3" value="Kosik 97"/>
  40 + </values>
  41 + </arglist>
35 42 </argslist>
... ...
js/app/views/CalculatorUI.js
... ... @@ -681,6 +681,7 @@ Ext.define(&#39;amdaUI.CalculatorUI&#39;, {
681 681 break;
682 682 case 'TimeFunctions' :
683 683 amdaUI.CalculatorUI.functionStore.filter('kind', 'time');
  684 + width = .33;
684 685 break;
685 686 case 'FunctionsSliding' :
686 687 amdaUI.CalculatorUI.functionStore.filter('kind', 'sliding');
... ...
js/app/views/CatalogUI.js
... ... @@ -409,7 +409,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
409 409 hidden: true,
410 410 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '1',
411 411 renderer: function (value) {
412   - return Ext.util.Format.number(value, '0.00');
  412 + return this.dateToString(value);
413 413 },
414 414 listeners: {
415 415 beforeshow: function () {
... ... @@ -429,7 +429,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
429 429 hidden: true,
430 430 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '2',
431 431 renderer: function (value) {
432   - return Ext.util.Format.number(value, '0.00');
  432 + return this.dateToString(value);
433 433 },
434 434 listeners: {
435 435 beforeshow: function () {
... ... @@ -449,7 +449,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
449 449 hidden: false,
450 450 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '3',
451 451 renderer: function (value) {
452   - return Ext.util.Format.number(value, '0.00');
  452 + return this.dateToString(value);
453 453 },
454 454 listeners: {
455 455 beforeshow: function () {
... ... @@ -469,7 +469,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
469 469 hidden: true,
470 470 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '4',
471 471 renderer: function (value) {
472   - return Ext.util.Format.number(value, '0.00');
  472 + return Ext.util.Format.number(value, '0.000');
473 473 },
474 474 listeners: {
475 475 beforeshow: function () {
... ... @@ -939,6 +939,24 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
939 939 frame: true,
940 940 columnLines: true,
941 941 selModel: {pruneRemoved: false},
  942 +
  943 + countDecimals: function (value) {
  944 + if (Math.floor(value) === value)
  945 + return 0;
  946 + return value.toString().split(".")[1].length || 0;
  947 + },
  948 +
  949 + dateToString: function (value) {
  950 + ndegits = this.countDecimals(value);
  951 + if (ndegits <= 3) {
  952 + return Ext.util.Format.number(value, '0.000');
  953 + } else if (value < 0.1) {
  954 + return value.toExponential(3);
  955 + } else {
  956 + return Ext.util.Format.number(value, '0.000000');
  957 + }
  958 + },
  959 +
942 960 // selType: 'cellmodel',
943 961 plugins: [cellEditing, {ptype: 'bufferedrenderer'}],
944 962 listeners: {
... ...
js/app/views/ExplorerUI.js
... ... @@ -970,6 +970,11 @@ Ext.define(&#39;amdaUI.ExplorerUI&#39;, {
970 970 }
971 971  
972 972 this.dockedItems.getAt(1).items.items[0].select(filter['name']);
  973 + },
  974 + listeners: {
  975 + tabchange: function( tabPanel, newCard, oldCard, eOpts ) {
  976 + tabPanel.down('toolbar').setVisible(newCard.getId() == amdaUI.ExplorerUI.RESRC_TAB.TREE_ID);
  977 + }
973 978 }
974 979 });
975 980  
... ...
js/app/views/TimeTableUI.js
... ... @@ -383,8 +383,8 @@ Ext.define(&#39;amdaUI.TimeTableUI&#39;, {
383 383 convertUTCDateToLocalDate: function (date) {
384 384 if (date == null) {
385 385 return date;
386   - }
387   - ;
  386 + };
  387 +
388 388 var newDate = new Date(date.getTime() + date.getTimezoneOffset() * 60 * 1000);
389 389  
390 390 var offset = date.getTimezoneOffset() / 60;
... ... @@ -514,7 +514,6 @@ Ext.define(&#39;amdaUI.TimeTableUI&#39;, {
514 514 {type: 'date', dataIndex: 'stop', dateFormat: 'Y-m-d'}
515 515 ]
516 516 };
517   -
518 517 var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
519 518 onEditComplete: function (ed, value, startValue) {
520 519 var me = this,
... ... @@ -580,6 +579,23 @@ Ext.define(&#39;amdaUI.TimeTableUI&#39;, {
580 579 features: [filters],
581 580 columnLines: true,
582 581 selModel: {pruneRemoved: false},
  582 +
  583 + countDecimals: function (value) {
  584 + if (Math.floor(value) === value)
  585 + return 0;
  586 + return value.toString().split(".")[1].length || 0;
  587 + },
  588 +
  589 + dateToString: function (value) {
  590 + ndegits = this.countDecimals(value);
  591 + if (ndegits <= 3) {
  592 + return Ext.util.Format.number(value, '0.000');
  593 + } else if (value < 0.1) {
  594 + return value.toExponential(3);
  595 + } else {
  596 + return Ext.util.Format.number(value, '0.000000');
  597 + }
  598 + },
583 599 columns: [
584 600 {
585 601 xtype: 'rownumberer',
... ... @@ -624,13 +640,12 @@ Ext.define(&#39;amdaUI.TimeTableUI&#39;, {
624 640 }
625 641 }
626 642 },
627   - {
  643 + {
628 644 header: 'Duration (day)', width: 120, dataIndex: 'durationDay',
629 645 id: amdaUI.TimeTableUI.COL_TO_HIDE + '1',
630 646 hidden: true,
631 647 renderer: function (value) {
632   -
633   - return Ext.util.Format.number(value, '0.00');
  648 + return this.dateToString(value);
634 649 },
635 650 listeners: {
636 651 beforeshow: function () {
... ... @@ -652,7 +667,7 @@ Ext.define(&#39;amdaUI.TimeTableUI&#39;, {
652 667 id: amdaUI.TimeTableUI.COL_TO_HIDE + '2',
653 668 hidden: true,
654 669 renderer: function (value) {
655   - return Ext.util.Format.number(value, '0.00');
  670 + return this.dateToString(value);
656 671 },
657 672 listeners: {
658 673 beforeshow: function () {
... ... @@ -673,7 +688,7 @@ Ext.define(&#39;amdaUI.TimeTableUI&#39;, {
673 688 header: 'Duration (min)', width: 120, dataIndex: 'durationMin',
674 689 id: amdaUI.TimeTableUI.COL_TO_HIDE + '3',
675 690 renderer: function (value) {
676   - return Ext.util.Format.number(value, '0.00');
  691 + return this.dateToString(value);
677 692 },
678 693 listeners: {
679 694 beforeshow: function () {
... ... @@ -695,7 +710,7 @@ Ext.define(&#39;amdaUI.TimeTableUI&#39;, {
695 710 id: amdaUI.TimeTableUI.COL_TO_HIDE + '4',
696 711 hidden: true,
697 712 renderer: function (value) {
698   - return Ext.util.Format.number(value, '0.00');
  713 + return Ext.util.Format.number(value, '0.000');
699 714 },
700 715 listeners: {
701 716 beforeshow: function () {
... ... @@ -786,7 +801,7 @@ Ext.define(&#39;amdaUI.TimeTableUI&#39;, {
786 801 this.fireEvent("refresh");
787 802 }
788 803 }
789   -
  804 +
790 805 }
791 806 });
792 807  
... ...
php/classes/AmdaStats.php
... ... @@ -16,13 +16,13 @@ class AmdaStats {
16 16 private $task = array('request'=>'plot','condition'=>'mining', 'download'=>'print','statistic'=>'statistics',
17 17 'getparameter'=>'ws_print', 'getdataset' => 'ws_print', 'getorbites' => 'ws_print', 'getplot' => 'ws_plot');
18 18  
19   - public function __construct($user) {
  19 + public function __construct($user, $year = NULL) {
20 20 if (!is_dir(DATAPATH.'Statistics')) {
21 21 if (!mkdir(DATAPATH.'Statistics', 0775)) $this->success = false; //return -1;
22 22 if (!chgrp(DATAPATH.'Statistics', APACHE_USER)) $this->success = false; // return -1;
23 23 }
24 24  
25   - $this->statsFilePath = $this->getStatsFilePath($user);
  25 + $this->statsFilePath = $this->getStatsFilePath($user, $year);
26 26 }
27 27  
28 28 public function addTask($user, $task, $vars) {
... ... @@ -45,8 +45,11 @@ class AmdaStats {
45 45 return $this->concurrentAccessGuestFile(array($this,'_mergeStats'), array('inXml' => $inXml));
46 46 }
47 47  
48   - private function getStatsFilePath($user) {
49   - $thisYear = date("Y");
  48 + private function getStatsFilePath($user, $year) {
  49 + if (!isset($year))
  50 + $thisYear = date("Y");
  51 + else
  52 + $thisYear = $year;
50 53 if (empty($user)){
51 54 return DATAPATH."Statistics/Stats$thisYear.xml";
52 55 }
... ...