[GRASS-dev] GRASS 7 scripts overhaul

Glynn Clements glynn at gclements.plus.com
Sun Sep 4 22:19:36 EDT 2011


Hamish wrote:

> It tries to run grass.raster_history() without first testing
> if the map is in the current mapset.

Given that those maps are listed as inputs, it's debatable whether it
should be modifying the history even if those maps are in the current
mapset.

In any case, the corresponding fix is:

--- scripts/i.landsat.rgb/i.landsat.rgb.py	(revision 48120)
+++ scripts/i.landsat.rgb/i.landsat.rgb.py	(working copy)
@@ -124,8 +124,10 @@
 	    set_colors(i, v0, v1)
 
     # write cmd history:
+    mapset = grass.gisenv()['MAPSET']
     for i in [red, green, blue]:
-	grass.raster_history(i)
+        if grass.find_file(i)['mapset'] == mapset:
+            grass.raster_history(i)
 
 if __name__ == "__main__":
     options, flags = grass.parser()

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list