firstChild) { while ($node->firstChild->firstChild) { remove_children($node->firstChild); } $node->removeChild($node->firstChild); } } define("NEWMETA",getenv("NEWMETA")); define("AMDA_INTERNAL_METADATA",getenv("AMDAINTERNALDIR")); $pattern = "info_psp_om*.xml"; $info = new DomDocument("1.0"); // $infoName = $argv[1]; foreach (glob(NEWMETA."/ParamInfo/".$pattern) as $infoName) { $info->load($infoName); $dimensions = $info->getElementsByTagName("dimensions")->item(0); if ($dimensions->hasAttribute("dim_2") && $dimensions->getAttribute("dim_2") == "1") $dimensions->removeAttribute("dim_2"); $components = $info->getElementsByTagName("components"); if ($components->length == 0) continue; if ( !$components->item(0)->hasChildNodes() ) continue; // has been already processed $a=$components->item(0); remove_children($a); $channels = $info->getElementsByTagName("channel"); foreach ($channels as $channel) { $min = $channel->getAttribute("min"); $max = $channel->getAttribute("max"); if ( $min == "nan" ) { $channel->setAttribute("min", "-"); } if ( $max== "nan" ) { $channel->setAttribute("max", "-"); } if (is_numeric($min)) $channel->setAttribute("min",number_format($min,1,".","")); if (is_numeric($max)) $channel->setAttribute("max",number_format($max,1,".","")); } echo basename($infoName).PHP_EOL; $info->save(AMDA_INTERNAL_METADATA."/PARAM_INFO_PREDEFINED/".basename($infoName)); } ?>