[GRASS-SVN] r36491 -
grass-addons/LandDyn/devs_landcover_scripts/r.landcover.update
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Mar 26 16:10:48 EDT 2009
Author: isaacullah
Date: 2009-03-26 16:10:48 -0400 (Thu, 26 Mar 2009)
New Revision: 36491
Modified:
grass-addons/LandDyn/devs_landcover_scripts/r.landcover.update/r.landcover.update
Log:
Modified: grass-addons/LandDyn/devs_landcover_scripts/r.landcover.update/r.landcover.update
===================================================================
--- grass-addons/LandDyn/devs_landcover_scripts/r.landcover.update/r.landcover.update 2009-03-26 20:09:53 UTC (rev 36490)
+++ grass-addons/LandDyn/devs_landcover_scripts/r.landcover.update/r.landcover.update 2009-03-26 20:10:48 UTC (rev 36491)
@@ -73,18 +73,18 @@
#% key: lc_rules
#% type: string
#% gisprompt: string
-#% description: path to reclass rules file for landcover map
+#% description: Path to reclass rules file for making a "labels" map. If no rules specified, no labels map will be made.
#% answer: /usr/local/grass-6.5.svn/scripts/rules/luse_reclass_rules.txt
-#% required : yes
+#% required : no
#%END
#%option
#% key: lc_color
#% type: string
#% gisprompt: string
-#% description: path to color rules file for landcover map
+#% description: Path to color rules file for landcover map
#% answer: /usr/local/grass-6.5.svn/scripts/rules/luse_colors.txt
-#% required : yes
+#% required : no
#%END
#%flag
@@ -127,16 +127,12 @@
temp_rate="temp_rate"
-temp_lc=$outmap"temp_landcover"
+reclass_out=$outmap"_labels"
-temp_reclass=$outmap"temp_landcover_reclass"
-outlc=$outmap
-
-
#setting initial conditions of map area
-g.region rast=$inmap
+g.region --quiet rast=$inmap
r.mask --quiet input=$inmap maskcats=*
@@ -148,18 +144,26 @@
#updating raw landscape category numbers based on agent impacts and newly calculated regrowth rate
-r.mapcalc "$temp_lc=if($inmap == $max && isnull($impacts), $max, if($inmap < $max && isnull($impacts), ($inmap + $temp_rate), if($inmap > $max, ($max - $impacts), if($inmap < 0, 0, ($inmap - $impacts) ) ) ) )"
+r.mapcalc "$outmap=if($inmap == $max && isnull($impacts), $max, if($inmap < $max && isnull($impacts), ($inmap + $temp_rate), if($inmap > $max, ($max - $impacts), if($inmap < 0, 0, ($inmap - $impacts) ) ) ) )"
+r.colors --quiet map=$outmap rules=$lc_color
-#adding text descriptions to raw landscape categories and setting colors
+if [ -z "$GIS_OPT_lc_rules" ] ; then
- cat $lc_rules | r.reclass input=$temp_lc output=$temp_reclass
+g.message "No Labels reclass rules specified, so no Labels map will be mnade"
- r.mapcalc "$outlc = $temp_reclass"
+else
+
+
+g.message "Creating reclassed Lables map ($reclass_out) of text descriptions to raw landscape categories"
+
+cat $lc_rules | r.reclass --quiet input=$outmap output=$reclass_out
+
+r.colors --quiet map=$reclass_out rules=$lc_color
+
+fi
- r.colors map=$outlc rules=$lc_color
-
#checking total area of updated cells
temparea=`eval r.stats -a -n input=$impacts fs=- nv=* nsteps=1 | cut -d'-' -f2`
@@ -177,7 +181,7 @@
echo "" >> $txtout
echo "Landcover class #, Landcover description, Area (sq. m)" >> $txtout
echo "" >> $txtout
-r.stats -a -l -n input=$prfx"_landuse1" fs=, nv=* nsteps=$max >> $txtout
+r.stats --quiet -a -l -n input=$prfx"_landuse1" fs=, nv=* nsteps=$max >> $txtout
fi
@@ -190,7 +194,7 @@
echo ""
-g.remove --quiet rast=MASK,$temp_reclass,$temp_lc,$temp_rate
+g.remove --quiet rast=MASK,$temp_rate
More information about the grass-commit
mailing list