[GRASS-dev] GRASS 7 scripts overhaul

Markus Metz markus.metz.giswork at googlemail.com
Mon Sep 5 02:13:40 EDT 2011


Glynn Clements wrote:
>
> 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.
>
All that i.landsat.rgb does is creating color rules. They are stored
in /colr2 if the input maps are not in the current mapset. As r.colors
does not modify the raster history, and i.landsat.rgb is just a
front-end for r.colors, one could argue that i.landsta.rgb should not
touch raster history as well.

my2c

Markus M

> 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>
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
>


More information about the grass-dev mailing list