getVotVar.php 1.28 KB
<?php

//putenv("USER_DATA_PATH=/home/benjamin/workspace/AMDA-NG4/data/renard/DATA/");
//putenv("PHP_CLASSES_PATH=/home/benjamin/workspace/AMDA-NG4/php/classes/");

date_default_timezone_set('UTC');

require getenv('PHP_CLASSES_PATH').'VOTableMgr.php';

$files       = $argv[1];
$paramId     = $argv[2];
$dims        = $argv[3];
$startDouble = $argv[4];
$intDouble   = $argv[5];

$mgr = new VOTableMgr();
  
$files_arr = explode(",",$files);

foreach ($files_arr as $file)
{
  $fileName = getenv('USER_DATA_PATH').$file;

  $mgr->load($fileName);
  	 
  $timeIndex = $mgr->getTimeFieldIndex();
  if ($timeIndex < 0)
    continue;
  
  $paramIndex= $mgr->getFieldIndexByID($paramId);
  if ($paramIndex < 0)
    continue;
  
  $paramInfo = $mgr->getFieldInfoByID($paramId);
  if (isset($paramInfo["error"]))
    continue;
  
  $tr = $mgr->getFirstTR();
  
  $crtTime = $startDouble;
  
  while ($tr)
  {
  	 $time = strtotime($mgr->getTDValueByFieldIndex($tr,$timeIndex));
      
    if ($time > $crtTime)
	   {
	     if ($time <= $startDouble + $intDouble)
	     {
	       $val = $mgr->getTDValueByFieldIndex($tr,$paramIndex);
	      
	        echo $time." ".$val."\n";
	      
	        $crtTime = $time;
	      }
	      else
	        break;
     }
      
     $tr = $mgr->getNextTR($tr);
   }
}

exit();

?>