[GRASS-SVN] r52205 - grass/branches/develbranch_6/scripts/i.tasscap
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jun 25 02:20:35 PDT 2012
Author: hamish
Date: 2012-06-25 02:20:34 -0700 (Mon, 25 Jun 2012)
New Revision: 52205
Modified:
grass/branches/develbranch_6/scripts/i.tasscap/description.html
grass/branches/develbranch_6/scripts/i.tasscap/i.tasscap
Log:
run r.mapcalc jobs in parallel, linewrap, quote map names, simpler if-else flow control, add 4-up display to help example.
Modified: grass/branches/develbranch_6/scripts/i.tasscap/description.html
===================================================================
--- grass/branches/develbranch_6/scripts/i.tasscap/description.html 2012-06-25 02:28:58 UTC (rev 52204)
+++ grass/branches/develbranch_6/scripts/i.tasscap/description.html 2012-06-25 09:20:34 UTC (rev 52205)
@@ -25,6 +25,13 @@
band3=lsat7_2002_30 band4=lsat7_2002_40 \
band5=lsat7_2002_50 band7=lsat7_2002_70 \
outprefix=tasscap
+# display
+d.mon x0
+d.split.frame
+d.frame uno; d.rast tasscap.1
+d.frame dos; d.rast tasscap.2
+d.frame tres; d.rast tasscap.3
+d.frame cuatro; d.rast tasscap.4
</pre></div>
Results:
Modified: grass/branches/develbranch_6/scripts/i.tasscap/i.tasscap
===================================================================
--- grass/branches/develbranch_6/scripts/i.tasscap/i.tasscap 2012-06-25 02:28:58 UTC (rev 52204)
+++ grass/branches/develbranch_6/scripts/i.tasscap/i.tasscap 2012-06-25 09:20:34 UTC (rev 52205)
@@ -107,55 +107,88 @@
fi
if [ $GIS_FLAG_4 -eq 1 ] ; then
- g.message "LANDSAT-4..."
- g.message "Calculating first TC component $GIS_OPT_OUTPREFIX.1 ..."
- r.mapcalc "$GIS_OPT_OUTPREFIX.1 = 0.3037 * $GIS_OPT_BAND1 + 0.2793 * $GIS_OPT_BAND2 + 0.4743 * $GIS_OPT_BAND3 + 0.5585 * $GIS_OPT_BAND4 + 0.5082 * $GIS_OPT_BAND5 + 0.1863 * $GIS_OPT_BAND7"
-
- g.message "Calculating second TC component $GIS_OPT_OUTPREFIX.2 ..."
- r.mapcalc "$GIS_OPT_OUTPREFIX.2 = -0.2848 * $GIS_OPT_BAND1 - 0.2435 * $GIS_OPT_BAND2 - 0.5435 * $GIS_OPT_BAND3 + 0.7243 * $GIS_OPT_BAND4 + 0.0840 * $GIS_OPT_BAND5 - 0.1800 * $GIS_OPT_BAND7"
-
- g.message "Calculating third TC component $GIS_OPT_OUTPREFIX.3 ..."
- r.mapcalc "$GIS_OPT_OUTPREFIX.3 = 0.1509 * $GIS_OPT_BAND1 + 0.1973 * $GIS_OPT_BAND2 + 0.3279 * $GIS_OPT_BAND3 + 0.3406 * $GIS_OPT_BAND4 - 0.7112 * $GIS_OPT_BAND5 - 0.4572 * $GIS_OPT_BAND7"
+ g.message "LANDSAT-4..."
+ g.message "Calculating first TC component $GIS_OPT_OUTPREFIX.1 ..."
+ r.mapcalc "\"$GIS_OPT_OUTPREFIX.1\" = 0.3037 * \"$GIS_OPT_BAND1\" \
+ + 0.2793 * \"$GIS_OPT_BAND2\" + 0.4743 * \"$GIS_OPT_BAND3\" \
+ + 0.5585 * \"$GIS_OPT_BAND4\" + 0.5082 * \"$GIS_OPT_BAND5\" \
+ + 0.1863 * \"$GIS_OPT_BAND7\"" &
+
+ g.message "Calculating second TC component $GIS_OPT_OUTPREFIX.2 ..."
+ r.mapcalc "\"$GIS_OPT_OUTPREFIX.2\" = -0.2848 * \"$GIS_OPT_BAND1\" \
+ - 0.2435 * \"$GIS_OPT_BAND2\" - 0.5435 * \"$GIS_OPT_BAND3\" \
+ + 0.7243 * \"$GIS_OPT_BAND4\" + 0.0840 * \"$GIS_OPT_BAND5\" \
+ - 0.1800 * \"$GIS_OPT_BAND7\"" &
+
+ g.message "Calculating third TC component $GIS_OPT_OUTPREFIX.3 ..."
+ r.mapcalc "\"$GIS_OPT_OUTPREFIX.3\" = 0.1509 * \"$GIS_OPT_BAND1\" \
+ + 0.1973 * \"$GIS_OPT_BAND2\" + 0.3279 * \"$GIS_OPT_BAND3\" \
+ + 0.3406 * \"$GIS_OPT_BAND4\" - 0.7112 * \"$GIS_OPT_BAND5\" \
+ - 0.4572 * \"$GIS_OPT_BAND7\"" &
+ wait
+elif [ $GIS_FLAG_5 -eq 1 ] ; then
+ g.message "LANDSAT-5..."
+ g.message "Calculating first TC component $GIS_OPT_OUTPREFIX.1 (Brightness) ..."
+ r.mapcalc "\"$GIS_OPT_OUTPREFIX.1\" = 0.2909 * \"$GIS_OPT_BAND1\" \
+ + 0.2493 * \"$GIS_OPT_BAND2\" + 0.4806 * \"$GIS_OPT_BAND3\" \
+ + 0.5568 * \"$GIS_OPT_BAND4\" + 0.4438 * \"$GIS_OPT_BAND5\" \
+ + 0.1706 * \"$GIS_OPT_BAND7\" + 10.3695" &
+
+ g.message "Calculating second TC component $GIS_OPT_OUTPREFIX.2 (Greenness) ..."
+ r.mapcalc "\"$GIS_OPT_OUTPREFIX.2\" = -0.2728 * \"$GIS_OPT_BAND1\" \
+ - 0.2174 * \"$GIS_OPT_BAND2\" - 0.5508 * \"$GIS_OPT_BAND3\" \
+ + 0.7221 * \"$GIS_OPT_BAND4\" + 0.0733 * \"$GIS_OPT_BAND5\" \
+ - 0.1648 * \"$GIS_OPT_BAND7\" - 0.7310" &
+
+ g.message "Calculating third TC component $GIS_OPT_OUTPREFIX.3 (Wetness) ..."
+ r.mapcalc "\"$GIS_OPT_OUTPREFIX.3\" = 0.1446 * \"$GIS_OPT_BAND1\" \
+ + 0.1761 * \"$GIS_OPT_BAND2\" + 0.3322 * \"$GIS_OPT_BAND3\" \
+ + 0.3396 * \"$GIS_OPT_BAND4\" - 0.6210 * \"$GIS_OPT_BAND5\" \
+ - 0.4186 * \"$GIS_OPT_BAND7\" - 3.3828" &
+
+ g.message "Calculating fourth TC component $GIS_OPT_OUTPREFIX.4. (Haze) ..."
+ r.mapcalc "\"$GIS_OPT_OUTPREFIX.4\" = 0.8461 * \"$GIS_OPT_BAND1\" \
+ - 0.0731 * \"$GIS_OPT_BAND2\" - 0.4640 * \"$GIS_OPT_BAND3\" \
+ - 0.0032 * \"$GIS_OPT_BAND4\" - 0.0492 * \"$GIS_OPT_BAND5\" \
+ - 0.0119 * \"$GIS_OPT_BAND7\" + 0.7879" &
+ wait
+elif [ $GIS_FLAG_7 -eq 1 ] ; then
+ g.message "LANDSAT-7..."
+ g.message "Calculating first TC component $GIS_OPT_OUTPREFIX.1 (Brightness) ..."
+ r.mapcalc "\"$GIS_OPT_OUTPREFIX.1\" = 0.3561 * \"$GIS_OPT_BAND1\" \
+ + 0.3972 * \"$GIS_OPT_BAND2\" + 0.3904 * \"$GIS_OPT_BAND3\" \
+ + 0.6966 * \"$GIS_OPT_BAND4\" + 0.2286 * \"$GIS_OPT_BAND5\" \
+ + 0.1596 * \"$GIS_OPT_BAND7\"" &
+
+ g.message "Calculating second TC component $GIS_OPT_OUTPREFIX.2 (Greenness) ..."
+ r.mapcalc "\"$GIS_OPT_OUTPREFIX.2\" = -0.3344 * \"$GIS_OPT_BAND1\" \
+ - 0.3544 * \"$GIS_OPT_BAND2\" - 0.4556 * \"$GIS_OPT_BAND3\" \
+ + 0.6966 * \"$GIS_OPT_BAND4\" - 0.0242 * \"$GIS_OPT_BAND5\" \
+ - 0.2630 * \"$GIS_OPT_BAND7\"" &
+
+ g.message "Calculating third TC component $GIS_OPT_OUTPREFIX.3 (Wetness) ..."
+ r.mapcalc "\"$GIS_OPT_OUTPREFIX.3\" = 0.2626 * \"$GIS_OPT_BAND1\" \
+ + 0.2141 * \"$GIS_OPT_BAND2\" + 0.0926 * \"$GIS_OPT_BAND3\" \
+ + 0.0656 * \"$GIS_OPT_BAND4\" - 0.7629 * \"$GIS_OPT_BAND5\" \
+ - 0.5388 * \"$GIS_OPT_BAND7\"" &
+
+ g.message "Calculating fourth TC component $GIS_OPT_OUTPREFIX.4. (Haze) ..."
+ r.mapcalc "\"$GIS_OPT_OUTPREFIX.4\" = 0.0805 * \"$GIS_OPT_BAND1\" \
+ - 0.0498 * \"$GIS_OPT_BAND2\" + 0.1950 * \"$GIS_OPT_BAND3\" \
+ - 0.1327 * \"$GIS_OPT_BAND4\" + 0.5752 * \"$GIS_OPT_BAND5\" \
+ - 0.7775 * \"$GIS_OPT_BAND7\"" &
+ wait
else
- if [ $GIS_FLAG_5 -eq 1 ] ; then
- g.message "LANDSAT-5..."
- g.message "Calculating first TC component $GIS_OPT_OUTPREFIX.1 (Brightness) ..."
- r.mapcalc $GIS_OPT_OUTPREFIX.1 = "0.2909 * $GIS_OPT_BAND1 + 0.2493 * $GIS_OPT_BAND2 + 0.4806 * $GIS_OPT_BAND3 + 0.5568 * $GIS_OPT_BAND4 + 0.4438 * $GIS_OPT_BAND5 + 0.1706 * $GIS_OPT_BAND7 + 10.3695"
-
- g.message "Calculating second TC component $GIS_OPT_OUTPREFIX.2 (Greenness) ..."
- r.mapcalc $GIS_OPT_OUTPREFIX.2 ="-0.2728 * $GIS_OPT_BAND1 - 0.2174 * $GIS_OPT_BAND2 - 0.5508 * $GIS_OPT_BAND3 + 0.7221 * $GIS_OPT_BAND4 + 0.0733 * $GIS_OPT_BAND5 - 0.1648 * $GIS_OPT_BAND7 - 0.7310"
-
- g.message "Calculating third TC component $GIS_OPT_OUTPREFIX.3 (Wetness) ..."
- r.mapcalc $GIS_OPT_OUTPREFIX.3 = "0.1446 * $GIS_OPT_BAND1 + 0.1761 * $GIS_OPT_BAND2 + 0.3322 * $GIS_OPT_BAND3 + 0.3396 * $GIS_OPT_BAND4 - 0.6210 * $GIS_OPT_BAND5 - 0.4186 * $GIS_OPT_BAND7 - 3.3828"
-
- g.message "Calculating fourth TC component $GIS_OPT_OUTPREFIX.4. (Haze) ..."
- r.mapcalc $GIS_OPT_OUTPREFIX.4 = "0.8461 * $GIS_OPT_BAND1 - 0.0731 * $GIS_OPT_BAND2 - 0.4640 * $GIS_OPT_BAND3 - 0.0032 * $GIS_OPT_BAND4 - 0.0492 * $GIS_OPT_BAND5 - 0.0119 * $GIS_OPT_BAND7 + 0.7879"
- else
- if [ $GIS_FLAG_7 -eq 1 ] ; then
- g.message "LANDSAT-7..."
- g.message "Calculating first TC component $GIS_OPT_OUTPREFIX.1 (Brightness) ..."
- r.mapcalc $GIS_OPT_OUTPREFIX.1 = "0.3561 * $GIS_OPT_BAND1 + 0.3972 * $GIS_OPT_BAND2 + 0.3904 * $GIS_OPT_BAND3 + 0.6966 * $GIS_OPT_BAND4 + 0.2286 * $GIS_OPT_BAND5 + 0.1596 * $GIS_OPT_BAND7"
-
- g.message "Calculating second TC component $GIS_OPT_OUTPREFIX.2 (Greenness) ..."
- r.mapcalc $GIS_OPT_OUTPREFIX.2 ="-0.3344 * $GIS_OPT_BAND1 - 0.3544 * $GIS_OPT_BAND2 - 0.4556 * $GIS_OPT_BAND3 + 0.6966 * $GIS_OPT_BAND4 - 0.0242 * $GIS_OPT_BAND5 - 0.2630 * $GIS_OPT_BAND7"
-
- g.message "Calculating third TC component $GIS_OPT_OUTPREFIX.3 (Wetness) ..."
- r.mapcalc $GIS_OPT_OUTPREFIX.3 = "0.2626 * $GIS_OPT_BAND1 + 0.2141 * $GIS_OPT_BAND2 + 0.0926 * $GIS_OPT_BAND3 + 0.0656 * $GIS_OPT_BAND4 - 0.7629 * $GIS_OPT_BAND5 - 0.5388 * $GIS_OPT_BAND7"
-
- g.message "Calculating fourth TC component $GIS_OPT_OUTPREFIX.4. (Haze) ..."
- r.mapcalc $GIS_OPT_OUTPREFIX.4 = "0.0805 * $GIS_OPT_BAND1 - 0.0498 * $GIS_OPT_BAND2 + 0.1950 * $GIS_OPT_BAND3 - 0.1327 * $GIS_OPT_BAND4 + 0.5752 * $GIS_OPT_BAND5 - 0.7775 * $GIS_OPT_BAND7"
- else
- g.message -e 'Select LANDSAT satellite by flag!'
- exit 1
- fi
- fi
+ g.message -e 'Select LANDSAT satellite by flag!'
+ exit 1
fi
-r.colors map=$GIS_OPT_OUTPREFIX.1 color=grey
-r.colors map=$GIS_OPT_OUTPREFIX.2 color=grey
-r.colors map=$GIS_OPT_OUTPREFIX.3 color=grey
+
+r.colors map="$GIS_OPT_OUTPREFIX.1" color=grey
+r.colors map="$GIS_OPT_OUTPREFIX.2" color=grey
+r.colors map="$GIS_OPT_OUTPREFIX.3" color=grey
if [ $GIS_FLAG_4 -ne 1 ] ; then
- r.colors map=$GIS_OPT_OUTPREFIX.4 color=grey
+ r.colors map="$GIS_OPT_OUTPREFIX.4" color=grey
fi
g.message "Tasseled Cap components calculated."
More information about the grass-commit
mailing list