[GRASS-dev] [bug #4742] (grass) i.fusion.brovey, i.in.spotvgt, v.rast.stats: don't use g.region

Michael Barton michael.barton at asu.edu
Tue Jun 27 11:47:01 EDT 2006


See below.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton



> From: Hamish <hamish_nospam at yahoo.com>
> Date: Tue, 27 Jun 2006 14:04:04 +1200
> To: Markus Neteler <neteler at itc.it>
> Cc: <grass-bugs at intevation.de>, <grass-dev at grass.itc.it>
> Subject: Re: [GRASS-dev] [bug #4742] (grass) i.fusion.brovey, i.in.spotvgt,
> v.rast.stats: don't use g.region
> 
> in practice WIND_OVERRIDE is actually more work? see below.
> 
> 
> Markus:
>> i.in.spotvgt: it is an import script. The GRASS import commands are
>>  expected to import a full map at original resolution. The internal
>>  bit shuffling must therefore be done at the original map region
>>  and resolution. The script saves the current user region and restores
>>  it back.
> 
> (guessed) current region usage:
> 
> g.region save=region.save
> g.region rast=$input
> do_stuff()
> g.region region.save
> g.remove region=region.save
> 
> same thing, using WIND_OVERRIDE:
> 
> g.region save=region.save
> g.region rast=$input
> g.region save=region.tmp
> g.region region.save
> WIND_OVERRIDE=region.tmp
> export WIND_OVERRIDE
> do_stuff()
> unset WIND_OVERRIDE   # unneeded if script exits, but good hygiene
> g.remove region=region.save,region.tmp

Actually, this is making it overly complicated. It should actually be as
follows.

g.region -u save=region.save # save a region but don't change WIND
WIND_OVERRIDE=region.save
export WIND_OVERRIDE # use region.save like WIND but don't change WIND
g.region rast=$input
do_stuff()
unset WIND_OVERRIDE   # unneeded if script exits, but good hygiene
g.remove region=region.save

The first way is not a problem for a simple script like this. It becomes a
problem when you are doing a lot of region changes for independent displays
in a GUI and don't want to  mess things up for different displays or for
people doing something from the command line.



> g.region rast=$input





More information about the grass-dev mailing list