Commit 775592ff53bd747d8198ba2504c80bc48bc49aa5
1 parent
8c0d5a9f
Exists in
master
and in
9 other branches
bug in insNodes addition
Showing
1 changed file
with
21 additions
and
16 deletions
Show diff stats
src/REMOTEDATA/CDAWEB.php
... | ... | @@ -18,7 +18,7 @@ class CDAWEB extends RemoteDataCenterClass |
18 | 18 | private $validInstrumentTypes = [ "Activity%20Indices", "Electric%20Fields%20(space)","Gamma%20and%20X-Rays", |
19 | 19 | "Magnetic%20Fields%20(space)", "Particles%20(space)", "Plasma%20and%20Solar%20Wind", |
20 | 20 | "Radio%20and%20Plasma%20Waves%20(space)" ]; |
21 | - // private $validInstrumentTypes = [ "Magnetic%20Fields%20(space)", "Radio%20and%20Plasma%20Waves%20(space)" ]; | |
21 | +// private $validInstrumentTypes = [ "Radio%20and%20Plasma%20Waves%20(space)" ]; | |
22 | 22 | |
23 | 23 | // not used : $validInstrumentTypes = ["Ephemeris"]; |
24 | 24 | |
... | ... | @@ -26,7 +26,7 @@ class CDAWEB extends RemoteDataCenterClass |
26 | 26 | |
27 | 27 | // not in "https://heliophysicsdata.sci.gsfc.nasa.gov/queries/CDAWeb_SPASE.xql" List; |
28 | 28 | // FOR INFO : Excluded automatically |
29 | - private $excludeDatasets = ["DMSP_R0_SSJ4", "DMSP_R0_SSIES", "I7_R0_LEPEDEA", "I8_R0_LEPEDEA", "WI_STRAHL0_SWE" ]; | |
29 | + private $excludeDatasets = [ "DMSP_R0_SSJ4", "DMSP_R0_SSIES", "I7_R0_LEPEDEA", "I8_R0_LEPEDEA" ]; | |
30 | 30 | |
31 | 31 | protected $DDserverXml, $DDserverXmlName; |
32 | 32 | |
... | ... | @@ -64,6 +64,12 @@ class CDAWEB extends RemoteDataCenterClass |
64 | 64 | |
65 | 65 | $this->res = new DomDocument(); |
66 | 66 | $this->res->loadXML(curl_exec($this->ch)); |
67 | + | |
68 | + if ($this->res->getElementsByTagName('EndpointAddress')->length == 0) { | |
69 | + error_log("Problem connect to ".CDAWebConfigClass::$restUrl."/dataviews", 3, err); | |
70 | + exit("Problem connect to ".CDAWebConfigClass::$restUrl."/dataviews".PHP_EOL); | |
71 | + } | |
72 | + | |
67 | 73 | $this->dataViewURL = $this->res->getElementsByTagName('EndpointAddress')->item(0)->nodeValue; |
68 | 74 | } |
69 | 75 | |
... | ... | @@ -75,16 +81,16 @@ class CDAWEB extends RemoteDataCenterClass |
75 | 81 | $this->setDataViewURL(); |
76 | 82 | $this->obsGroupsIds = array(); |
77 | 83 | |
78 | - foreach ( $this->validInstrumentTypes as $insType) | |
84 | + foreach ($this->validInstrumentTypes as $insType) | |
79 | 85 | { |
80 | 86 | curl_setopt($this->ch, CURLOPT_URL, $this->dataViewURL."/observatoryGroupsAndInstruments?instrumentType=".$insType); |
81 | 87 | echo $insType.PHP_EOL; |
82 | 88 | $this->res->loadXML(curl_exec($this->ch)); |
83 | - // $this->res->save($insType.".xml"); | |
84 | - $observatoryGroups = $this->res->getElementsByTagName("ObservatoryGroupInstrumentDescription"); | |
89 | + | |
90 | + $observatoryGroups = $this->res->getElementsByTagName("ObservatoryGroupInstrumentDescription"); | |
85 | 91 | |
86 | - foreach ( $observatoryGroups as $obsGroup ) | |
87 | - { | |
92 | + foreach ($observatoryGroups as $obsGroup) | |
93 | + { | |
88 | 94 | $obsGroupId = $obsGroup->getElementsByTagName('Name')->item(0)->nodeValue; |
89 | 95 | |
90 | 96 | // Exclude some Missions |
... | ... | @@ -502,15 +508,14 @@ class CDAWEB extends RemoteDataCenterClass |
502 | 508 | foreach ($groupIds as $groupId => $obss) |
503 | 509 | { |
504 | 510 | $obsNodes = array(); |
505 | - | |
511 | + | |
506 | 512 | foreach ($obss as $obs => $inss) |
507 | 513 | { |
508 | 514 | // ! observatory OMNI is taken for observatoriesGroup OMNI only ! |
509 | 515 | if (substr($obs,0,4) == "OMNI" && substr($groupId,0,4) != "OMNI"){ |
510 | 516 | echo 'OMNI '.$obs.' '.$missionId.PHP_EOL; |
511 | 517 | continue; |
512 | - } | |
513 | - | |
518 | + } | |
514 | 519 | $insNodes = array(); |
515 | 520 | // Create instrument nodes |
516 | 521 | foreach ($inss as $ins => $dss) |
... | ... | @@ -536,19 +541,19 @@ class CDAWEB extends RemoteDataCenterClass |
536 | 541 | if (!$insSpaseId ) |
537 | 542 | $insSpaseId = $ins; |
538 | 543 | |
539 | - $obsSpaseId = $this->getObservatorySpase(); | |
544 | + $obsSpaseId = strtolower($this->getObservatorySpase()); | |
540 | 545 | if (!$obsSpaseId ) |
541 | - $obsSpaseId = $obs; | |
546 | + $obsSpaseId = strtolower($obs); | |
542 | 547 | |
543 | 548 | $insId = $this->baseID.":".$this->param2dd($groupId).":".$this->param2dd($obsSpaseId).":".$this->param2dd($insSpaseId); |
544 | 549 | |
545 | 550 | if (!($insNode = $this->domAmda->getElementById($insId))){ |
546 | 551 | $insNode = $this->createInstrumentNode($insSpaseId, $obsSpaseId, $groupId); |
547 | - $insNodes[] = $insNode; | |
548 | - } | |
552 | + } | |
549 | 553 | foreach ($dsNodes as $dsNode){ |
550 | 554 | $insNode->appendChild($dsNode); |
551 | 555 | } |
556 | + $insNodes[] = $insNode; | |
552 | 557 | } |
553 | 558 | } // foreach ($inss as $ins => $dss) |
554 | 559 | if ($insNodes) |
... | ... | @@ -557,13 +562,13 @@ class CDAWEB extends RemoteDataCenterClass |
557 | 562 | |
558 | 563 | if (!($obsNode = $this->domAmda->getElementById($obsId))){ |
559 | 564 | $obsNode = $this->createObservatoryNode($obsSpaseId, $groupId); |
560 | - | |
561 | - $obsNodes[] = $obsNode; | |
562 | 565 | } |
563 | 566 | |
564 | 567 | foreach ($insNodes as $insNode){ |
565 | 568 | $obsNode->appendChild($insNode); |
566 | 569 | } |
570 | + | |
571 | + $obsNodes[] = $obsNode; | |
567 | 572 | } |
568 | 573 | } // foreach ($obss as $obs => $inss) |
569 | 574 | ... | ... |