Blame view

php/old_amda/getVotVar.php 1.28 KB
16035364   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?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();

?>