Blame view

update_amda/correctNan.php 1.17 KB
a8bb25b8   Elena.Budnik   tools to correct ...
1
2
3
4
5
6
<?php

    define("AMDA_INTERNAL_METADATA",getenv("AMDAINTERNALDIR"));
    
    $info = new DomDocument("1.0");
   // $infoName = $argv[1];
bc0f89a8   Elena.Budnik   correctNan for 2 ...
7
    $pattern = "info_psp_loic_*.xml";
a8bb25b8   Elena.Budnik   tools to correct ...
8
9
10
11
12
13
    foreach (glob(AMDA_INTERNAL_METADATA."/PARAM_INFO_PREDEFINED/".$pattern) as $infoName) {
        $info->load($infoName);
        
        $dimensions =  $info->getElementsByTagName("dimensions")->item(0);
        
        $dim_1 = $dimensions->getAttribute("dim_1");
bc0f89a8   Elena.Budnik   correctNan for 2 ...
14
15
16
        $dim_2 = null;
        if ($dimensions->hasAttribute("dim_2"))
            $dim_2 = $dimensions->getAttribute("dim_2");
a8bb25b8   Elena.Budnik   tools to correct ...
17
        
bc0f89a8   Elena.Budnik   correctNan for 2 ...
18
19

        $tables = $info->getElementsByTagName("table");
a8bb25b8   Elena.Budnik   tools to correct ...
20
        
bc0f89a8   Elena.Budnik   correctNan for 2 ...
21
22
23
24
25
26
27
28
29
30
31
        foreach ($tables as $table) {
            $channels = $table->getElementsByTagName("channel");
            $dim = $table->getAttribute("relatedDim");
            if ( $dim == "dim_1" ) $dim_ = $dim_1;
            if ( $dim == "dim_2" ) $dim_ = $dim_2;
            if ($dim_ != $channels->length) {
                $dimensions->setAttribute($dim, $channels->length);
                echo $infoName.PHP_EOL;
                echo $dim_." ".$channels->length.PHP_EOL;
            }
        }
a8bb25b8   Elena.Budnik   tools to correct ...
32
33
34
35
        $info->save($infoName);
    }

?>