[GRASS-SVN] r67419 - grass-addons/grass7/raster/r.meb

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 29 05:14:49 PST 2015


Author: pvanbosgeo
Date: 2015-12-29 05:14:49 -0800 (Tue, 29 Dec 2015)
New Revision: 67419

Modified:
   grass-addons/grass7/raster/r.meb/r.meb.py
Log:
Solves problem that script fails when reference layer is a reclass map

Modified: grass-addons/grass7/raster/r.meb/r.meb.py
===================================================================
--- grass-addons/grass7/raster/r.meb/r.meb.py	2015-12-29 13:14:44 UTC (rev 67418)
+++ grass-addons/grass7/raster/r.meb/r.meb.py	2015-12-29 13:14:49 UTC (rev 67419)
@@ -264,6 +264,15 @@
     digits = int(options['digits'])
     digits2 = pow(10, digits)
 
+    # Check input
+    reftype = grass.raster_info(ref)['datatype']
+    if reftype != 'CELL':
+        grass.fatal('Your reference map should be an integer binary map with 0 and 1')
+    else:
+        refrange = grass.parse_command("r.univar", flags="g", map=ref)
+        if refrange['min'] != '0' or refrange['max'] != '1':
+            grass.fatal('Your reference map should be an binary map with 0 and 1')
+
     #----------------------------------------------------------------------------
     # Compute MES
     #----------------------------------------------------------------------------



More information about the grass-commit mailing list