Commit 80b3946d714623618c94fd3da7f28e44cee959ea

Authored by Benjamin Renard
1 parent 17e47c9e

Fix NaN for HAPI (#6318)

Showing 2 changed files with 6 additions and 2 deletions   Show diff stats
php/hapi/getData.php
@@ -109,7 +109,11 @@ while(1) @@ -109,7 +109,11 @@ while(1)
109 foreach ($columns as $col_key => $col_name) { 109 foreach ($columns as $col_key => $col_name) {
110 if ($col_key != 0) 110 if ($col_key != 0)
111 echo ","; 111 echo ",";
112 - echo trim($data[$col_key]); 112 + $val = trim($data[$col_key]);
  113 + if ($val == "NaN") {
  114 + $val = "-1e31";
  115 + }
  116 + echo $val;
113 if ($col_key == 0) 117 if ($col_key == 0)
114 echo "Z"; 118 echo "Z";
115 } 119 }
update_amda/makeHAPIMetadata.php
@@ -199,7 +199,7 @@ foreach ($dataset_nodes as $dataset_node) { @@ -199,7 +199,7 @@ foreach ($dataset_nodes as $dataset_node) {
199 $parameter->{"units"} = $units; 199 $parameter->{"units"} = $units;
200 200
201 //fill 201 //fill
202 - $parameter->{"fill"} = "NaN"; 202 + $parameter->{"fill"} = "-1e31";
203 203
204 //description 204 //description
205 $description = $parameter_node->getAttribute("description"); 205 $description = $parameter_node->getAttribute("description");