You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by go...@apache.org on 2013/09/09 21:03:19 UTC

svn commit: r1521245 - /incubator/climate/trunk/ocw/data_source/rcmed.py

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