[GRASS-SVN] r34935 - in grass/trunk: lib/python scripts/i.landsat.rgb

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Dec 19 12:36:51 EST 2008


Author: martinl
Date: 2008-12-19 12:36:51 -0500 (Fri, 19 Dec 2008)
New Revision: 34935

Modified:
   grass/trunk/lib/python/grass.py
   grass/trunk/scripts/i.landsat.rgb/i.landsat.rgb.py
Log:
i.landsat.rgb: write history only for raster maps in the current mapset


Modified: grass/trunk/lib/python/grass.py
===================================================================
--- grass/trunk/lib/python/grass.py	2008-12-19 17:14:52 UTC (rev 34934)
+++ grass/trunk/lib/python/grass.py	2008-12-19 17:36:51 UTC (rev 34935)
@@ -519,9 +519,18 @@
 def raster_history(map):
     """Set the command history for a raster map to the command used to
     invoke the script (interface to `r.support').
+
+    @return 1 on success
+    @return 0 on failure
     """
-    run_command('r.support', map = map, history = os.environ['CMDLINE'])
-
+    current_mapset = gisenv()['MAPSET']
+    if find_file(name = map)['mapset'] == current_mapset:
+        run_command('r.support', map = map, history = os.environ['CMDLINE'])
+        return 1
+    
+    warning("Unable to write history for <%s>. Raster map <%s> not found in current mapset." % (map, map))
+    return 0
+    
 # run "r.info -rgstmpud ..." and parse output
 
 def raster_info(map):

Modified: grass/trunk/scripts/i.landsat.rgb/i.landsat.rgb.py
===================================================================
--- grass/trunk/scripts/i.landsat.rgb/i.landsat.rgb.py	2008-12-19 17:14:52 UTC (rev 34934)
+++ grass/trunk/scripts/i.landsat.rgb/i.landsat.rgb.py	2008-12-19 17:36:51 UTC (rev 34935)
@@ -21,7 +21,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
@@ -111,7 +111,7 @@
 
     if not preserve:
 	for i in [red, green, blue]:
-	    grass.message("Processing <%s> ..." % i)
+	    grass.message("Processing <%s>..." % i)
 	    v0 = get_percentile(i, 2)
 	    v1 = get_percentile(i, brightness)
 	    grass.debug("<%s>:  min=%f   max=%f" % (i, v0, v1))
@@ -120,7 +120,7 @@
 	all_max = 0
 	all_min = 255
 	for i in [red, green, blue]:
-	    grass.message("Processing <%s> ..." % i)
+	    grass.message("Processing <%s>..." % i)
 	    v0 = get_percentile(i, 2)
 	    v1 = get_percentile(i, brightness)
 	    grass.debug("<%s>:  min=%f   max=%f" % (i, v0, v1))



More information about the grass-commit mailing list