Commit 337f0c932e455e7184b83c1cf968da18532f43df
1 parent
ff8c764d
Exists in
master
and in
91 other branches
Use group restriction to generate HAPI metadata
Showing
1 changed file
with
18 additions
and
0 deletions
Show diff stats
update_amda/makeHAPIMetadata.php
@@ -15,12 +15,30 @@ $xpath = new DOMXpath($doc); | @@ -15,12 +15,30 @@ $xpath = new DOMXpath($doc); | ||
15 | $dataset_nodes = $xpath->query("/dataRoot/dataCenter/mission/instrument/dataset | /dataRoot/dataCenter/mission/observatory/instrument/dataset | /dataRoot/dataCenter/mission/instrument/datasetGroup/dataset"); | 15 | $dataset_nodes = $xpath->query("/dataRoot/dataCenter/mission/instrument/dataset | /dataRoot/dataCenter/mission/observatory/instrument/dataset | /dataRoot/dataCenter/mission/instrument/datasetGroup/dataset"); |
16 | $datasets = array(); | 16 | $datasets = array(); |
17 | foreach ($dataset_nodes as $dataset_node) { | 17 | foreach ($dataset_nodes as $dataset_node) { |
18 | + //Dataset id | ||
18 | $datasetId = $dataset_node->getAttribute("xml:id"); | 19 | $datasetId = $dataset_node->getAttribute("xml:id"); |
19 | if (empty($datasetId)) { | 20 | if (empty($datasetId)) { |
20 | echo "[WARNING] Cannot retrieve dataset id".PHP_EOL; | 21 | echo "[WARNING] Cannot retrieve dataset id".PHP_EOL; |
21 | continue; | 22 | continue; |
22 | } | 23 | } |
23 | 24 | ||
25 | + //Exclude dataset with group | ||
26 | + $to_exclude = FALSE; | ||
27 | + $crt_node = $dataset_node; | ||
28 | + while (($crt_node != NULL) && !$to_exclude) { | ||
29 | + if ($crt_node->nodeType == XML_ELEMENT_NODE) { | ||
30 | + $group = $crt_node->getAttribute("group"); | ||
31 | + if (!empty($group)) { | ||
32 | + $to_exclude = TRUE; | ||
33 | + } | ||
34 | + } | ||
35 | + $crt_node = $crt_node->parentNode; | ||
36 | + } | ||
37 | + if ($to_exclude) { | ||
38 | + echo "[WARNING] Exclude dataset ".$datasetId." (group restriction)".PHP_EOL; | ||
39 | + continue; | ||
40 | + } | ||
41 | + | ||
24 | //Dataset start date | 42 | //Dataset start date |
25 | $startDate = $dataset_node->getAttribute("dataStart"); | 43 | $startDate = $dataset_node->getAttribute("dataStart"); |
26 | if (empty($startDate)) { | 44 | if (empty($startDate)) { |