Commit bc0f89a8f31cef0235dd55151347662ff75abc0b

Authored by Elena.Budnik
1 parent a8bb25b8

correctNan for 2 dims

Showing 1 changed file with 17 additions and 7 deletions   Show diff stats
update_amda/correctNan.php
... ... @@ -4,21 +4,31 @@
4 4  
5 5 $info = new DomDocument("1.0");
6 6 // $infoName = $argv[1];
7   - $pattern = "info_psp_om*.xml";
  7 + $pattern = "info_psp_loic_*.xml";
8 8 foreach (glob(AMDA_INTERNAL_METADATA."/PARAM_INFO_PREDEFINED/".$pattern) as $infoName) {
9 9 $info->load($infoName);
10 10  
11 11 $dimensions = $info->getElementsByTagName("dimensions")->item(0);
12 12  
13 13 $dim_1 = $dimensions->getAttribute("dim_1");
14   - $channels = $info->getElementsByTagName("channel");
  14 + $dim_2 = null;
  15 + if ($dimensions->hasAttribute("dim_2"))
  16 + $dim_2 = $dimensions->getAttribute("dim_2");
15 17  
16   - if ($dim_1 != $channels->length) {
17   - $dimensions->setAttribute("dim_1", $channels->length);
18   - echo $infoName.PHP_EOL;
19   - echo $dim_1." ".$channels->length.PHP_EOL;
20   - }
  18 +
  19 + $tables = $info->getElementsByTagName("table");
21 20  
  21 + foreach ($tables as $table) {
  22 + $channels = $table->getElementsByTagName("channel");
  23 + $dim = $table->getAttribute("relatedDim");
  24 + if ( $dim == "dim_1" ) $dim_ = $dim_1;
  25 + if ( $dim == "dim_2" ) $dim_ = $dim_2;
  26 + if ($dim_ != $channels->length) {
  27 + $dimensions->setAttribute($dim, $channels->length);
  28 + echo $infoName.PHP_EOL;
  29 + echo $dim_." ".$channels->length.PHP_EOL;
  30 + }
  31 + }
22 32 $info->save($infoName);
23 33 }
24 34  
... ...