Commit 63f833966f71e71aa40a61bdef95fb94cd1ee8f2

Authored by Elena.Budnik
1 parent 6a3bb8f6

orbit in km for impex

php/RemoteDataCenter/ImpexParamManager.php
... ... @@ -20,14 +20,14 @@ class ImpexParamManager
20 20 protected $baseManager = null;
21 21 protected $votManager = null;
22 22 protected $impex_pairs = array("/" => "_", ":" => "_");
  23 + protected $webAlias;
23 24  
24 25 public $startTime, $stopTime;
25 26  
26 27 private $impexParamInfo = null;
27 28  
28   - //TODO
29   - private $scale = array("km" => 1, "Rme" => 2438, "Rv" => 6052, "Re" => 6371, "Rma" => 3396, "Rm" => 3396,
30   - "Rj" => 71492, "Rs" => 60268, "Ru" => 25559, "Rn" => 24764);
  29 +// private $scale = array("km" => 1, "Rme" => 2438, "Rv" => 6052, "Re" => 6371, "Rma" => 3396, "Rm" => 3396,
  30 +// "Rj" => 71492, "Rs" => 60268, "Ru" => 25559, "Rn" => 24764);
31 31  
32 32 function __construct()
33 33 {
... ... @@ -35,6 +35,8 @@ class ImpexParamManager
35 35  
36 36 date_default_timezone_set('UTC');
37 37 ini_set("soap.wsdl_cache_enabled", "0");
  38 +
  39 + $this->webAlias = webAlias.IHMConfigClass::getRelativeResultPath();;
38 40 }
39 41  
40 42 public function getImpexFullParamId($param_id, $templateArgs = NULL) {
... ... @@ -115,8 +117,11 @@ class ImpexParamManager
115 117  
116 118 $localFile = $this->center->getFileName($this->resourceID, $templateArgs,$start);
117 119  
118   - if (!copy($remoteFile, IHMConfigClass::getLocalBasePath().$localFile)) {
119   - throw new Exception('Cannot wget '.$remoteFile);
  120 + if (!copy($remoteFile, IHMConfigClass::getLocalBasePath().$localFile)) {
  121 + if ($this->orbitTempFolder)
  122 + CommonClass::rrmdir($this->orbitTempFolder);
  123 +
  124 + throw new Exception('Cannot wget '.$remoteFile);
120 125 }
121 126  
122 127 if ($this->center->outputFormat == "VOTable")
... ... @@ -124,13 +129,21 @@ class ImpexParamManager
124 129 if (!$this->votManager)
125 130 $this->votManager = new VOTableMgr();
126 131  
127   - if (!$this->votManager->load(IHMConfigClass::getLocalBasePath().$localFile))
128   - throw new Exception('Cannot load '.$localFile);
  132 + if (!$this->votManager->load(IHMConfigClass::getLocalBasePath().$localFile))
  133 + {
  134 + if ($this->orbitTempFolder)
  135 + CommonClass::rrmdir($this->orbitTempFolder);
  136 +
  137 + throw new Exception('Cannot load '.$localFile);
  138 + }
129 139  
130 140 if (!$this->votManager->isData())
131 141 {
132 142 unlink(IHMConfigClass::getLocalBasePath().$localFile);
133   - throw new Exception('Empty file '.$localFile);
  143 + if ($this->orbitTempFolder)
  144 + CommonClass::rrmdir($this->orbitTempFolder);
  145 +
  146 + throw new Exception('Empty file '.$localFile);
134 147 }
135 148  
136 149 if ($this->vectorList)
... ... @@ -260,8 +273,10 @@ class ImpexParamManager
260 273 {
261 274 $viID = $this->addFileToDb($mask, $localFile, $startTime, $stopTime, 'cdf');
262 275 }
  276 +
263 277 if ($this->orbitTempFolder)
264   - CommonClass::rrmdir($this->orbitTempFolder);
  278 + CommonClass::rrmdir($this->orbitTempFolder);
  279 +
265 280 }
266 281 }
267 282 // nothing to add
... ... @@ -380,11 +395,11 @@ class ImpexParamManager
380 395 }
381 396  
382 397 $this->orbitTempFolder = IHMConfigClass::getRequestPath().$downloadResult['folder'];
383   -
  398 +
384 399 try
385 400 {
386 401 $this->convertVot($paramId, $downloadResult['result']);
387   - $orbitURL = "http://apus.irap.omp.eu/NEWAMDA/data/budnik/RES/".$downloadResult['folder']."/".$downloadResult['result'].".vot";
  402 + $orbitURL = $this->webAlias.$downloadResult['folder']."/".$downloadResult['result'].".vot";
388 403  
389 404 return $orbitURL;
390 405 }
... ... @@ -471,17 +486,18 @@ class ImpexParamManager
471 486 }
472 487 //TODO unit from output VOT file
473 488 /*----------------- temporary-----------------*/
474   - $temp = new DomDocument("1.0");
475   - $temp->load(IHMConfigClass::getLocalParamDBPath().$paramID.".xml");
476   - $unit = $temp->getElementsByTagName('units')->item(0)->nodeValue;
  489 +// $temp = new DomDocument("1.0");
  490 +// $temp->load(IHMConfigClass::getLocalParamDBPath().$paramID.".xml");
  491 +// $unit = $temp->getElementsByTagName('units')->item(0)->nodeValue;
477 492  
  493 + $unit = 'km';
478 494 /*----------------- temporary-----------------*/
479 495 if ($firstTD > 0)
480 496 {
481   - if (array_key_exists($unit, $this->scale))
  497 + /*if (array_key_exists($unit, $this->scale))
482 498 $unitScale = $this->scale[$unit];
483 499 else
484   - throw new Exception("Undefined unit ".$unit);
  500 + throw new Exception("Undefined unit ".$unit);*/
485 501  
486 502 $table->removeChild($fields->item($firstTD));
487 503  
... ... @@ -491,7 +507,7 @@ class ImpexParamManager
491 507 $new_field->appendChild(new DOMAttr('ID', $comp));
492 508 $new_field->appendChild(new DOMAttr('name', $comp));
493 509 $new_field->appendChild(new DOMAttr('datatype', $datatype));
494   - $new_field->appendChild(new DOMAttr('unit', 'km')); // $unit
  510 + $new_field->appendChild(new DOMAttr('unit', $unit)); // $unit
495 511 $new_field->appendChild(new DOMAttr('ucd', 'pos.cartesian.'.$comp));
496 512  
497 513 $table->insertBefore($new_field,$data);
... ... @@ -507,7 +523,8 @@ class ImpexParamManager
507 523  
508 524 foreach ($values as $value)
509 525 {
510   - $td = $dom->createElement('TD', $value*$unitScale); //3400
  526 + //$td = $dom->createElement('TD', $value*$unitScale); //3400
  527 + $td = $dom->createElement('TD', $value);
511 528 $tr->appendChild($td);
512 529 }
513 530 }
... ...
php/RemoteDataCenter/makeOrbitsArgs.php
... ... @@ -14,18 +14,22 @@
14 14 if (!defined('SimuTargetsXml'))
15 15 exit('SimuTargetsXml is not defined in config.php'.PHP_EOL);
16 16  
17   - if (!file_exists(orbitsXml))
18   - exit("ERROR : NO Orbites.xml FILE !!! Run makeOrbitsList.php".PHP_EOL);
  17 +// if (!file_exists(orbitsXml))
  18 +// exit("ERROR : NO Orbites.xml FILE !!! Run makeOrbitsList.php".PHP_EOL);
  19 +
  20 + if (!file_exists(orbitsAllXml))
  21 + exit("ERROR : NO OrbitsAll.xml FILE !!! Run makeOrbitsList.php and makeOrbitsInKm.php".PHP_EOL);
19 22  
20 23 if (!file_exists(SimuTargetsXml))
21 24 exit("ERROR : NO TargetsSimu FILE !!! Run makeProxy.php".PHP_EOL);
22 25  
23 26 $targetXml = simplexml_load_file(SimuTargetsXml);
24 27 $orbitsXml = new DomDocument("1.0");
25   - $orbitsXml->load(orbitsXml);
  28 + $orbitsXml->load(orbitsAllXml);
26 29 $xpath = new DOMXpath($orbitsXml);
27 30  
28 31 $targets = $targetXml->Target;
  32 + $unitsImpex = "km";
29 33  
30 34 foreach ($targets as $target)
31 35 {
... ... @@ -37,18 +41,17 @@
37 41  
38 42 // Mecrury double definition
39 43 if ($coordImpex == "HSM") $coordImpex == "MSM";
40   -
  44 +
41 45 // general case
42   - $params = $xpath->query('//orbites[@target="'.$target.'" and @coordinate_system="'.$coordImpex.'"]');
43   -
  46 + $params = $xpath->query('//orbites[@target="'.$target.'" and @coordinate_system="'.$coordImpex.'" and @units="'.$unitsImpex.'"]');
  47 +
44 48 // case of targetImpex = Jupiter.Magnetosphere; targetAmda = Jupiter
45 49 if ($params->length == 0)
46   - $params = $xpath->query('//orbites[@target="'.$targetMain.'" and @coordinate_system="'.$coordImpex.'"]');
47   -
  50 + $params = $xpath->query('//orbites[@target="'.$targetMain.'" and @coordinate_system="'.$coordImpex.'" and @units="'.$unitsImpex.'"]');
  51 +
48 52 // case of targetImpex = Ganymede; targetAmda = Jupiter.Ganymede
49 53 if ($params->length == 0)
50   - // $params = $xpath->query('//orbites[contains(@target,"'.$target.')" and @coordinate_system="'.$coordImpex.'"]');
51   - $params = $xpath->query('//orbites[contains(@target,"'.$target.'")]');
  54 + $params = $xpath->query('//orbites[@coordinate_system="'.$coordImpex.'" and @units="'.$unitsImpex.'" and contains(@target,"'.$target.'")]');
52 55  
53 56 if ($params->length > 0)
54 57 {
... ... @@ -57,7 +60,10 @@
57 60 $misGrpArr = array();
58 61  
59 62 foreach ($params as $param)
60   - {
  63 + {
  64 +
  65 + // if ($param->getAttribute('units') != $unitsImpex) continue;
  66 +
61 67 $dsId = $param->getAttribute('dataset');
62 68  
63 69 if (!is_array($dsArr[$dsId])) $dsArr[$dsId] = array();
... ...
php/config.php
... ... @@ -113,7 +113,9 @@ define('plotsXml', IHM_SRC_DIR.'public/WebServices/XML/AmdaPlots.xml'); // Web S
113 113  
114 114 // Web Service servers WSDL : $_SERVER['SERVER_NAME'] (par apache) gethostname() (par command)
115 115 $SERVER_NAME = $_SERVER['SERVER_NAME'] ? $_SERVER['SERVER_NAME'] : gethostname();
116   -define('wsdl_AMDA', "http://".$SERVER_NAME.APACHE_ALIAS."public/wsdl/Methods_AMDA.wsdl");
  116 +
  117 +define('webAlias',"http://".$SERVER_NAME.APACHE_ALIAS);
  118 +define('wsdl_AMDA', webAlias."public/wsdl/Methods_AMDA.wsdl");
117 119 /*-------------------END WEB SERVICES section ---------*/
118 120  
119 121 // AKKA - KERNELBIN is now the new kernel bin dir
... ...