This is an automated email from the ASF dual-hosted git repository.

fgreg pushed a commit to branch 1.1.0-SNAPSHOT
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-nexus.git


The following commit(s) were added to refs/heads/1.1.0-SNAPSHOT by this push:
     new a4d4604  SDAP-205: Lat/lon netcdf not writing as float
a4d4604 is described below

commit a4d46042fb42e774cd86965e24026b4acd746444
Author: Maya DeBellis <[email protected]>
AuthorDate: Tue Aug 20 15:26:17 2019 -0700

    SDAP-205: Lat/lon netcdf not writing as float
    
    cast min and max to float - filter out None values (#77)
---
 analysis/webservice/algorithms/doms/BaseDomsHandler.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/analysis/webservice/algorithms/doms/BaseDomsHandler.py 
b/analysis/webservice/algorithms/doms/BaseDomsHandler.py
index 6d1a713..7387fd1 100644
--- a/analysis/webservice/algorithms/doms/BaseDomsHandler.py
+++ b/analysis/webservice/algorithms/doms/BaseDomsHandler.py
@@ -559,8 +559,8 @@ class DomsNetCDFValueWriter:
         latVar = self.group.createVariable("lat", "f4", ("dim",), 
fill_value=-32767.0)
         timeVar = self.group.createVariable("time", "f4", ("dim",), 
fill_value=-32767.0)
 
-        self.__enrichLon(lonVar, min(self.lon), max(self.lon))
-        self.__enrichLat(latVar, min(self.lat), max(self.lat))
+        self.__enrichLon(lonVar, self.__calcMin(self.lon), 
self.__calcMax(self.lon))
+        self.__enrichLat(latVar, self.__calcMin(self.lat), 
self.__calcMax(self.lat))
         self.__enrichTime(timeVar)
 
         latVar[:] = self.lat
@@ -652,12 +652,18 @@ class DomsNetCDFValueWriter:
                 depthVar[:] = tempDepth
 
     #
-    # Lists may include 'None" values, to calc min these must be filtered out
+    # Lists may include 'None" values, to calc min these must be filtered out. 
Cast as float.
     #
     @staticmethod
     def __calcMin(var):
-        return min(x for x in var if x is not None)
+        return min(float(x) for x in var if x is not None)
 
+    #
+    # Lists may include 'None" values, to calc max these must be filtered out. 
Cast as float.
+    #
+    @staticmethod
+    def __calcMax(var):
+        return max(float(x) for x in var if x is not None)
 
     #
     # Add attributes to each variable
@@ -777,4 +783,4 @@ class DomsNetCDFValueWriter:
         var.flag_meanings = "good unknown_unavailable_notevaluated 
questionable_suspect bad"
 
         if wind:
-            var.comment = "this status_flag applies to WindU and WindV"
+            var.comment = "this status_flag applies to WindU and WindV"
\ No newline at end of file

Reply via email to