[GRASS-SVN] r49561 - grass/branches/develbranch_6/scripts/r.reclass.area

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 6 10:40:48 EST 2011


Author: martinl
Date: 2011-12-06 07:40:48 -0800 (Tue, 06 Dec 2011)
New Revision: 49561

Modified:
   grass/branches/develbranch_6/scripts/r.reclass.area/r.reclass.area
Log:
r.reclass.area: copy color table from input
		fix g.message call


Modified: grass/branches/develbranch_6/scripts/r.reclass.area/r.reclass.area
===================================================================
--- grass/branches/develbranch_6/scripts/r.reclass.area/r.reclass.area	2011-12-06 12:13:58 UTC (rev 49560)
+++ grass/branches/develbranch_6/scripts/r.reclass.area/r.reclass.area	2011-12-06 15:40:48 UTC (rev 49561)
@@ -84,6 +84,12 @@
  exit 1
 fi
 
+if [ -z "$GIS_OPT_GREATER" -a -z "$GIS_OPT_LESSER" ] ||
+    [ -n "$GIS_OPT_GREATER" -a -n "$GIS_OPT_LESSER" ]; then
+  g.message -e message="You have to specify either lesser= or greater="
+  exit 1
+fi
+
 if [ -n "$GIS_OPT_LESSER" ] ; then
   op=0
   limit="$GIS_OPT_LESSER"
@@ -92,10 +98,6 @@
   op=1
   limit="$GIS_OPT_GREATER"
 fi
-if [ -z "$GIS_OPT_GREATER" -a -z "$GIS_OPT_LESSER" ] ; then
-  g.message -e "You have to specify either lesser= or greater="
-  exit 1
-fi
 
 file2="$infile.clump.$outfile"
 
@@ -153,7 +155,7 @@
         '{hectares=$5 * 0.0001; 
           {if (hectares <= LIM)
 	     printf("%d = %d %s\n",$1,$3,$4) } }' > "$infile.rules"
-  else
+else
    g.message  "Generating a reclass rules file with area size greater than or equal to $limit hectares..."
    r.stats -aln in="$file2","$infile" fs='|' | \
       awk -F'|' -v LIM="$limit" \
@@ -169,6 +171,8 @@
 g.message "Generating output raster map <$outfile>..."
 cat "$infile.rules" | r.reclass i="$file2" o="$outfile.recl"
 r.mapcalc "$outfile = $outfile.recl"
+r.colors map=$outfile raster=$infile --quiet
+
 g.remove rast="$outfile.recl","$file2" --quiet
 
 #####cleanup



More information about the grass-commit mailing list