generateGranulesIndex.php
1.06 KB
<?php
/**
* @file generateGranulesIndex.php
* @brief
* @version $Id: $
*/
require_once '../DDserverWeb_ini.php';
$ddSys = new DOMDocument('1.0');
$ddSys->load(baseDir.'/DDsys.xml');
$dataSets = $ddSys->getElementsByTagName('VI');
foreach ($dataSets as $VI)
{
$id = $VI->getElementsByTagName('NAME')->item(0)->nodeValue;
$main = array();
$index = array();
$location = $VI->getElementsByTagName("LOCATION")->item(0)->nodeValue;
if (file_exists($location."RestrictedAccess")) continue; // PrivateAccess
foreach (glob($location."*.nc.gz") as $granule)
{
$cmd = 'stat --printf="%s" '. $granule;
$file = basename($granule,".nc.gz");
$index[$file] = exec($cmd);
}
$main[substr($location,strlen(baseDir))] = $index;
file_put_contents("../GRANULES/$id.json", json_encode($main));
}
?>