[GRASS-SVN] r61927 - in grass/branches/releasebranch_7_0: . scripts/r.reclass.area
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Sep 13 16:15:32 PDT 2014
Author: annakrat
Date: 2014-09-13 16:15:32 -0700 (Sat, 13 Sep 2014)
New Revision: 61927
Modified:
grass/branches/releasebranch_7_0/
grass/branches/releasebranch_7_0/scripts/r.reclass.area/r.reclass.area.py
Log:
r.reclass.area: add -d flag for clumping diagonal cells - #2400 (merge from trunk, r61829)
Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Modified: svn:mergeinfo
- /grass/trunk:60289,60696,61269,61380,61420,61422,61480,61500,61764,61808,61831,61854,61888,61891,61905,61907,61913-61914,61916,61918,61921
+ /grass/trunk:60289,60696,61269,61380,61420,61422,61480,61500,61764,61808,61829,61831,61854,61888,61891,61905,61907,61913-61914,61916,61918,61921
Modified: grass/branches/releasebranch_7_0/scripts/r.reclass.area/r.reclass.area.py
===================================================================
--- grass/branches/releasebranch_7_0/scripts/r.reclass.area/r.reclass.area.py 2014-09-13 23:13:56 UTC (rev 61926)
+++ grass/branches/releasebranch_7_0/scripts/r.reclass.area/r.reclass.area.py 2014-09-13 23:15:32 UTC (rev 61927)
@@ -54,6 +54,11 @@
#% description: Input map is clumped
#%end
+#%flag
+#% key: d
+#% description: Clumps including diagonal neighbors
+#%end
+
import sys
import os
import atexit
@@ -68,6 +73,7 @@
greater = options['greater']
outfile = options['output']
clumped = flags['c']
+ diagonal = flags['d']
s = grass.read_command("g.region", flags='p')
kv = grass.parse_key_val(s, sep=':')
@@ -88,6 +94,9 @@
if not grass.find_file(infile)['name']:
grass.fatal(_("Raster map <%s> not found") % infile)
+ if clumped and diagonal:
+ grass.fatal(_("flags c and d are mutually exclusive"))
+
if clumped:
clumpfile = infile
else:
@@ -97,10 +106,13 @@
if not grass.overwrite():
if grass.find_file(clumpfile)['name']:
grass.fatal(_("Temporary raster map <%s> exists") % clumpfile)
+ if diagonal:
+ grass.message(_("Generating a clumped raster file including diagonal neighbors..."))
+ grass.run_command('r.clump', flags='d', input=infile, output=clumpfile)
+ else:
+ grass.message(_("Generating a clumped raster file ..."))
+ grass.run_command('r.clump', input=infile, output=clumpfile)
- grass.message(_("Generating a clumped raster file ..."))
- grass.run_command('r.clump', input=infile, output=clumpfile)
-
if lesser:
grass.message(_("Generating a reclass map with area size less than " \
"or equal to %f hectares...") % limit)
More information about the grass-commit
mailing list