[GRASS-user] could the region change between 2 commands in a single Bash script?

Hi!

I'm writing a Bash script that

1. outputs the region settings into a temp file, to create a Grass
   ASCII raster header (to be used in step 4)

2. outputs 2 rasters to xyz ascii files
   a. r.stats -1g raster1 > file1.xyz
   b. r.stats -1g raster2 > file2.xyz

3. processes them, converts the resust into a single Grass ASCII raster

4. imports it with r.in.ascii (header created based on region settings
   obtained in step 1)

2a and 2b might take some time.

The question: if I run my script in background, and then I change the
region before eg. step 2a completes, is there any danger that 2b will
be run in a different region?

I hope not, I need 2a and 2b product to be the same number of lines,
the same coordinates.

?

Maciek

--------------------
W polskim Internecie s? setki milion?w stron. My przekazujemy Tobie tylko najlepsze z nich!
http://katalog.panoramainternetu.pl/

Maciek Sieczka wrote:

I'm writing a Bash script that

1. outputs the region settings into a temp file, to create a Grass
   ASCII raster header (to be used in step 4)

2. outputs 2 rasters to xyz ascii files
   a. r.stats -1g raster1 > file1.xyz
   b. r.stats -1g raster2 > file2.xyz

3. processes them, converts the resust into a single Grass ASCII raster

4. imports it with r.in.ascii (header created based on region settings
   obtained in step 1)

2a and 2b might take some time.

The question: if I run my script in background, and then I change the
region before eg. step 2a completes, is there any danger that 2b will
be run in a different region?

Yes.

However, you can force the use of a different region by setting either
of the environment variables WIND_OVERRIDE or GRASS_REGION.

WIND_OVERRIDE should be the name of a saved region (created with e.g.
"g.region save=..."), while GRASS region should be a complete region
definition in the same format as a region file except that newlines
are replaced with semicolons.

E.g.

  region=myscript.$$
  g.region save=$region
  export WIND_OVERRIDE=$region

  ...

  g.remove region=$region

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

On Thu, 1 Jun 2006 17:31:07 +0100
Glynn Clements <glynn@gclements.plus.com> wrote:

you can force the use of a different region by setting either
of the environment variables WIND_OVERRIDE or GRASS_REGION.

WIND_OVERRIDE should be the name of a saved region (created with e.g.
"g.region save=..."), while GRASS region should be a complete region
definition in the same format as a region file except that newlines
are replaced with semicolons.

E.g.

  region=myscript.$$
  g.region save=$region
  export WIND_OVERRIDE=$region

  ...

  g.remove region=$region

Thank you Glynn! This will help.

Maciek

--------------------
W polskim Internecie s? setki milion?w stron. My przekazujemy Tobie tylko najlepsze z nich!
http://katalog.panoramainternetu.pl/