[GRASS-SVN] r53624 - grass/trunk/scripts/r.blend

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Oct 31 12:34:19 PDT 2012


Author: mmetz
Date: 2012-10-31 12:34:18 -0700 (Wed, 31 Oct 2012)
New Revision: 53624

Modified:
   grass/trunk/scripts/r.blend/r.blend.py
Log:
r.blend: fix NULL handling

Modified: grass/trunk/scripts/r.blend/r.blend.py
===================================================================
--- grass/trunk/scripts/r.blend/r.blend.py	2012-10-31 17:30:45 UTC (rev 53623)
+++ grass/trunk/scripts/r.blend/r.blend.py	2012-10-31 19:34:18 UTC (rev 53624)
@@ -75,7 +75,7 @@
 
     grass.message(_("Calculating the three component maps..."))
 
-    template = string.Template("$$output.$ch = $$frac1 * $ch#$$first + $$frac2 * $ch#$$second")
+    template = string.Template("$$output.$ch = if(isnull($$first), $ch#$$second, if(isnull($$second), $ch#$$first, $$frac1 * $ch#$$first + $$frac2 * $ch#$$second))")
     cmd = [template.substitute(ch = ch) for ch in ['r','g','b']]
     cmd = ';'.join(cmd)
 



More information about the grass-commit mailing list