[GRASS-SVN] r46379 - grass/trunk/scripts/r.mask

svn_grass at osgeo.org svn_grass at osgeo.org
Mon May 23 05:20:55 EDT 2011


Author: aghisla
Date: 2011-05-23 02:20:55 -0700 (Mon, 23 May 2011)
New Revision: 46379

Modified:
   grass/trunk/scripts/r.mask/r.mask.py
Log:
Check datatype of input map - translated from shell.

Modified: grass/trunk/scripts/r.mask/r.mask.py
===================================================================
--- grass/trunk/scripts/r.mask/r.mask.py	2011-05-23 08:12:43 UTC (rev 46378)
+++ grass/trunk/scripts/r.mask/r.mask.py	2011-05-23 09:20:55 UTC (rev 46379)
@@ -68,6 +68,16 @@
     if not grass.find_file(input)['file'] and not remove:
         grass.fatal(_("<%s> does not exist.") % input)
 
+    if not 'MASKCATS' in grass.gisenv() and not remove:
+        ## beware: next check is made with != , not with 'is', otherwise:
+        #>>> grass.raster_info("basin_50K")['datatype'] is "CELL"
+        #False
+        # even if:
+        #>>> "CELL" is "CELL"
+        #True 
+        if grass.raster_info(input)['datatype'] != "CELL":
+            grass.fatal(_("Raster map %s must be integer for maskcats parameter") % input)
+
     mapset = grass.gisenv()['MAPSET']
     exists = bool(grass.find_file('MASK', element = 'cell', mapset = mapset)['file'])
 



More information about the grass-commit mailing list