diff --git a/php/hapi/getData.php b/php/hapi/getData.php
index d649cf4..12d448e 100644
--- a/php/hapi/getData.php
+++ b/php/hapi/getData.php
@@ -109,7 +109,11 @@ while(1)
                 foreach ($columns as $col_key => $col_name) {
                         if ($col_key != 0)
                                 echo ",";
-                        echo trim($data[$col_key]);
+			$val = trim($data[$col_key]);
+			if ($val == "NaN") {
+				$val = "-1e31";
+			}
+                        echo $val;
                         if ($col_key == 0)
                                 echo "Z";
                 }
diff --git a/update_amda/makeHAPIMetadata.php b/update_amda/makeHAPIMetadata.php
index af2608f..36c7dae 100644
--- a/update_amda/makeHAPIMetadata.php
+++ b/update_amda/makeHAPIMetadata.php
@@ -199,7 +199,7 @@ foreach ($dataset_nodes as $dataset_node) {
 		$parameter->{"units"} = $units;
 
 		//fill
-		$parameter->{"fill"} = "NaN";
+		$parameter->{"fill"} = "-1e31";
 
 		//description
 		$description = $parameter_node->getAttribute("description");
--
libgit2 0.21.2