climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From good...@apache.org
Subject svn commit: r1521245 - /incubator/climate/trunk/ocw/data_source/rcmed.py
Date Mon, 09 Sep 2013 19:03:19 GMT
Author: goodale
Date: Mon Sep  9 19:03:18 2013
New Revision: 1521245

URL: http://svn.apache.org/r1521245
Log:
CLIMATE-283: Fix the RCMED Masking Bug
*  Added in a check against the values.dtype to make sure the missingdataflag
is converted to a compatible type.

Modified:
    incubator/climate/trunk/ocw/data_source/rcmed.py

Modified: incubator/climate/trunk/ocw/data_source/rcmed.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/ocw/data_source/rcmed.py?rev=1521245&r1=1521244&r2=1521245&view=diff
==============================================================================
--- incubator/climate/trunk/ocw/data_source/rcmed.py (original)
+++ incubator/climate/trunk/ocw/data_source/rcmed.py Mon Sep  9 19:03:18 2013
@@ -74,6 +74,12 @@ def _make_mask_array(values, parameter_i
         if each['parameter_id'].encode() == str(parameter_id):
             missing_values = each['missingdataflag'].encode()
             break
+    # Need to encode the string to proper dtype so the mask is applied
+    if 'float' in str(values.dtype):
+        missing_values = float(missing_values)
+    if 'int' in str(values.dtype):
+        missing_values = int(missing_values)
+
     values = ma.masked_array(values, mask=(values == missing_values))
 
     return values



Mime
View raw message