[GRASS-SVN] r34934 - grass/branches/develbranch_6/scripts/i.landsat.rgb

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Dec 19 12:14:52 EST 2008


Author: martinl
Date: 2008-12-19 12:14:52 -0500 (Fri, 19 Dec 2008)
New Revision: 34934

Modified:
   grass/branches/develbranch_6/scripts/i.landsat.rgb/i.landsat.rgb
Log:
i.landsat.rgb: write history only for raster maps in the current mapset

Modified: grass/branches/develbranch_6/scripts/i.landsat.rgb/i.landsat.rgb
===================================================================
--- grass/branches/develbranch_6/scripts/i.landsat.rgb/i.landsat.rgb	2008-12-19 16:51:39 UTC (rev 34933)
+++ grass/branches/develbranch_6/scripts/i.landsat.rgb/i.landsat.rgb	2008-12-19 17:14:52 UTC (rev 34934)
@@ -10,7 +10,7 @@
 # PURPOSE:      create pretty LANDSAT RGBs: the trick is to remove outliers 
 #               using percentiles (area under the histogram curve)
 #
-# COPYRIGHT:	(C) 2006 by the GRASS Development Team
+# COPYRIGHT:	(C) 2006-2008 by the GRASS Development Team
 #
 #		This program is free software under the GNU General Public
 #		License (>=v2). Read the file COPYING that comes with GRASS
@@ -20,7 +20,7 @@
 #############################################################################
 
 #%Module
-#%  description: Auto-balancing of colors for LANDSAT images
+#%  description: Performs auto-balancing of colors for LANDSAT images.
 #%  keywords: raster, imagery, colors
 #%End
 #%option
@@ -122,7 +122,7 @@
 
 if [ 0 -eq $GIS_FLAG_P ] ; then
    for i in $RED $GREEN $BLUE ; do
-      g.message "Processing <$i> ..."
+      g.message "Processing <$i>..."
       MIN=`r.univar -ge $i perc=2 | grep "^percentile_" | cut -d'=' -f2`
       MAX=`r.univar -ge $i perc=$BRIGHTNESS | grep "^percentile_" | cut -d'=' -f2`
       g.message -d message="<$i>:  min=$MIN   max=$MAX"
@@ -137,7 +137,7 @@
    ALL_MAX=0
    ALL_MIN=255
    for i in $RED $GREEN $BLUE ; do
-      g.message "Processing <$i> ..."
+      g.message "Processing <$i>..."
       MIN=`r.univar -ge $i perc=2  | grep "^percentile_" | cut -d'=' -f2`
       MAX=`r.univar -ge $i perc=$BRIGHTNESS | grep "^percentile_" | cut -d'=' -f2`
       g.message -d message="<$i>:  min=$MIN   max=$MAX"
@@ -155,9 +155,28 @@
    done
 fi
 
-# write cmd history:
-r.support ${GIS_OPT_BLUE} history="${CMDLINE}"
-r.support ${GIS_OPT_GREEN} history="${CMDLINE}"
-r.support ${GIS_OPT_RED} history="${CMDLINE}"
+# write cmd history (only if raster maps are located in the current mapset)
+CURRENT_MAPSET=`g.gisenv MAPSET`
+RED_MAPSET=`g.findfile -n elem=cell file=$RED | grep mapset | cut -d'=' -f2`
+BLUE_MAPSET=`g.findfile -n elem=cell file=$BLUE | grep mapset | cut -d'=' -f2`
+GREEN_MAPSET=`g.findfile -n elem=cell file=$GREEN | grep mapset | cut -d'=' -f2`
 
+if [ "$BLUE_MAPSET" == "$MAPSET" ] ; then
+    r.support ${BLUE} history="${CMDLINE}"
+else
+    g.message -w message="Unable to write history for <$BLUE>. Raster map <$BLUE> not found in current mapset."
+fi
+
+if [ "$GREEN_MAPSET" == "$MAPSET" ] ; then
+    r.support ${GREEN} history="${CMDLINE}"
+else
+    g.message -w message="Unable to write history for <$GREEN>. Raster map <$GREEN> not found in current mapset."
+fi
+
+if [ "$RED_MAPSET" == "$MAPSET" ] ; then
+    r.support ${RED} history="${CMDLINE}"
+else
+    g.message -w message="Unable to write history for <$RED>. Raster map <$RED> not found in current mapset."
+fi
+
 exit 0



More information about the grass-commit mailing list