getElementsByTagName("VI"); $Old = $vi->item(0)->getElementsByTagName($tagName)->item(0); $New = $dom->createElement($tagName, $tagValue); $vi->item(0)->replaceChild($New, $Old); } /* * MAIN */ if($argc == 2) $infoXml = "$argv[1]_info.xml"; else exit(" info FULL prefix should be specified"); global $dom; define("DDBASEBIN",getenv("DDBASEBIN")); $dom = new DomDocument(); $path_parts = pathinfo($argv[1]); $path = $path_parts['dirname']."/"; $currDir = getcwd(); if (!$dom->load($infoXml)) { chdir($path); $dom->loadXML(file_get_contents($path_parts['basename']."_info.xml")); // NFS connection doesn't load chdir($currDir); } // Read *_times.nc $res = system(DDBASEBIN."/StartStopLocal $argv[1]_times.nc"); $Time = explode("-",$res); // Start $Start = days2MonthDay($Time[0]); updateTag('GlobalStart', $Start); updateTag('LocalStart', $Start); // Stop $Stop = days2MonthDay($Time[1]); updateTag('GlobalStop', $Stop); updateTag('LocalStop', $Stop); $dom->save($infoXml); // make *_info.nc system(DDBASEBIN."/infoLocal2nc $infoXml $argv[1]_info.nc"); // check if there is TimeRestriction if (file_exists($path."TimeRestriction")) { chdir($path); $restr = file("./TimeRestriction", FILE_IGNORE_NEW_LINES); // $days = $restr[0]; $n = sscanf($restr[0], "%d-%d-%d", $yy, $mm, $dd); $infoXmlRestr = $restr[1].".xml"; $infoNcRestr = $restr[1].".nc"; if ($n == 1) { $restrStop = date("Y-m-d", strtotime("-$yy days"))."T23:59:59.999Z"; } else { $restrStop = $restr[0]."T23:59:59.999Z"; } if ($restrStop < $Stop) { updateTag('GlobalStop', $restrStop); updateTag('LocalStop', $restrStop); } $dom->save($infoXmlRestr); system(DDBASEBIN."/infoLocal2nc $infoXmlRestr $infoNcRestr"); chdir($currDir); } ?>