[GRASS-user] Parallel GRASS jobs .....

Good day.

In grass wiki page about Parallel GRASS jobs (http://grasswiki.osgeo.org/wiki/Parallel_GRASS_jobs), they suggest 2 approaches. One of them (which I want to implement and try) is

  • split map into spatial chunks (possibly with overlap to gain smooth results)
    But they say nothing about how you can split the map into chunks .

Is there anybody who tried this kind of parallelism?
How I can split the map into chunks to do the calculation in every chunk separately?

Thanks in advance.

Hi,

for this approach, the best would be to
(before the multi-process job)

  • put your map into the PERMANENT mapset

(for each process in parallel)

  • make a new mapset for each process
  • define the region of each mapset as a chunk of the whole region
  • make your calculation

(once the process competed)

  • put together all the results (eg, with r.patch)

Sylvain

I have been trying something like this some time ago, but I could not define region of a mapset as chunk of the whole region.
I was trying to do that with g.region, but it only resized my map and didn’t “cut” it.

Is g.region the right tool for this task?
If it is not difficult for you, can you, please, explain the process of doing " define the region of each mapset as a chunk of the whole region " a bit more detailed.

On Wed, Nov 28, 2012 at 1:56 PM, Sylvain Maillard <sylvain.maillard@gmail.com> wrote:

Hi,

for this approach, the best would be to
(before the multi-process job)

  • put your map into the PERMANENT mapset

(for each process in parallel)

  • make a new mapset for each process
  • define the region of each mapset as a chunk of the whole region
  • make your calculation

(once the process competed)

  • put together all the results (eg, with r.patch)

Sylvain


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Hi there,

I do this too and the standard methodology for me is to leave the resolution the same and change the region’s borders. Take a look at the manual of g.region for guides on this, but let’s say I’ve got the following:

GRASS 6.4.3svn (EPSG4326_WGS84_ll):~ > g.region -g
n=63
s=-63
w=95
e=180
nsres=1.10020395685734e-05
ewres=1.10020399076346e-05
rows=11452422
cols=7725840
cells=88479579984480

Then to reduce the region’s size I’d do e.g.:
g.region n=50 s=-50 w=100 e=110

That would “shrink” my region down to the area that I’m interested in.

HTH!
Daniel

···

2012/11/28 Andranik Hayrapetyan <andranik.h89@gmail.com>

I have been trying something like this some time ago, but I could not define region of a mapset as chunk of the whole region.
I was trying to do that with g.region, but it only resized my map and didn’t “cut” it.

Is g.region the right tool for this task?
If it is not difficult for you, can you, please, explain the process of doing " define the region of each mapset as a chunk of the whole region " a bit more detailed.

On Wed, Nov 28, 2012 at 1:56 PM, Sylvain Maillard <sylvain.maillard@gmail.com> wrote:

Hi,

for this approach, the best would be to
(before the multi-process job)

  • put your map into the PERMANENT mapset

(for each process in parallel)

  • make a new mapset for each process
  • define the region of each mapset as a chunk of the whole region
  • make your calculation

(once the process competed)

  • put together all the results (eg, with r.patch)

Sylvain


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

hi. Even If we do not use it at the end, you could try r.tileset to create region tiles.

Ivan

inviato da smartphone

Il giorno 28/nov/2012 10:47, “Andranik Hayrapetyan” <andranik.h89@gmail.com> ha scritto:

Good day.

In grass wiki page about Parallel GRASS jobs (http://grasswiki.osgeo.org/wiki/Parallel_GRASS_jobs), they suggest 2 approaches. One of them (which I want to implement and try) is

  • split map into spatial chunks (possibly with overlap to gain smooth results)
    But they say nothing about how you can split the map into chunks .

Is there anybody who tried this kind of parallelism?
How I can split the map into chunks to do the calculation in every chunk separately?

Thanks in advance.


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

I was trying to do that with g.region, but it only resized my map and didn’t “cut” it.
In fact it didn’t modify your map, but resize the area where the calculation is done byt hte other modules : with a small region defined in a mapset, your code will work only on that part of the map in the PERMANENT mapset.

as an example with a region of n=100 s=0 e=100 w=0, you can pass the region limits to your script (eg: my_script.sh 50 0 50 0; my_script.sh 100 50 50 0; …) so the calculation are made only of a quarter of the whole region.
if your script can handle arguments, it will the first define its own sub-region from what you passed to it: “g.region n=$1 s=$2 e=$3 w=$4”

···

Sylvain

2012/11/28 Daniel Lee <lee@isi-solutions.org>

Hi there,

I do this too and the standard methodology for me is to leave the resolution the same and change the region’s borders. Take a look at the manual of g.region for guides on this, but let’s say I’ve got the following:

GRASS 6.4.3svn (EPSG4326_WGS84_ll):~ > g.region -g
n=63
s=-63
w=95
e=180
nsres=1.10020395685734e-05
ewres=1.10020399076346e-05
rows=11452422
cols=7725840
cells=88479579984480

Then to reduce the region’s size I’d do e.g.:
g.region n=50 s=-50 w=100 e=110

That would “shrink” my region down to the area that I’m interested in.

HTH!
Daniel

2012/11/28 Andranik Hayrapetyan <andranik.h89@gmail.com>

I have been trying something like this some time ago, but I could not define region of a mapset as chunk of the whole region.
Is g.region the right tool for this task?
If it is not difficult for you, can you, please, explain the process of doing " define the region of each mapset as a chunk of the whole region " a bit more detailed.

On Wed, Nov 28, 2012 at 1:56 PM, Sylvain Maillard <sylvain.maillard@gmail.com> wrote:

Hi,

for this approach, the best would be to
(before the multi-process job)

  • put your map into the PERMANENT mapset

(for each process in parallel)

  • make a new mapset for each process
  • define the region of each mapset as a chunk of the whole region
  • make your calculation

(once the process competed)

  • put together all the results (eg, with r.patch)

Sylvain


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

I think I don’t understand the concept of region itself. Here is the output of my g.region -p

projection: 0 (x,y)
zone: 0
north: 4569989.25
south: 4357350.75
west: 436605.75
east: 670334.25
nsres: 28.5
ewres: 28.5
rows: 7461
cols: 8201
cells: 61187661

Please, can you tell me how to reduce this region into 2 chunks.

Thanks in advance

···

Sylvain

2012/11/28 Daniel Lee <lee@isi-solutions.org>

Hi there,

I do this too and the standard methodology for me is to leave the resolution the same and change the region’s borders. Take a look at the manual of g.region for guides on this, but let’s say I’ve got the following:

GRASS 6.4.3svn (EPSG4326_WGS84_ll):~ > g.region -g
n=63
s=-63
w=95
e=180
nsres=1.10020395685734e-05
ewres=1.10020399076346e-05
rows=11452422
cols=7725840
cells=88479579984480

Then to reduce the region’s size I’d do e.g.:
g.region n=50 s=-50 w=100 e=110

That would “shrink” my region down to the area that I’m interested in.

HTH!
Daniel

2012/11/28 Andranik Hayrapetyan <andranik.h89@gmail.com>

I have been trying something like this some time ago, but I could not define region of a mapset as chunk of the whole region.

Is g.region the right tool for this task?
If it is not difficult for you, can you, please, explain the process of doing " define the region of each mapset as a chunk of the whole region " a bit more detailed.

On Wed, Nov 28, 2012 at 1:56 PM, Sylvain Maillard <sylvain.maillard@gmail.com> wrote:

Hi,

for this approach, the best would be to
(before the multi-process job)

  • put your map into the PERMANENT mapset

(for each process in parallel)

  • make a new mapset for each process
  • define the region of each mapset as a chunk of the whole region
  • make your calculation

(once the process competed)

  • put together all the results (eg, with r.patch)

Sylvain


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Hi Andranik,

I’d really recommend reading the manual to g.region. If you’re using the GUI, just open the manual tab among all the tabs at the top. Otherwise, it’s also available here:

http://ludique.u-bourgogne.fr/grass/grass65/manuals/html65_user/g.region.html

What the printout you’ve posted is the following, I’ll comment on it line for line:

···

projection: 0 (x,y)

Apparently you’re not working in a projection, your region is in an arbitrary lat/lon location.

zone: 0

There is no zone assigned because it’s not a projection with zones like e.g. UTM

north: 4569989.25

The northernmost border of your region is at 4569989.25 in whatever unit your projection works with, probably meters.

south: 4357350.75

This is the southernmost border.

west: 436605.75

This is the westernmost border.

east: 670334.25

This is the easternmost border.

nsres: 28.5

The north-to-south resolution is 28.5 map units, so if you’re working e.g. with a raster your cells would be 28.5 m across if your map units are meters.

ewres: 28.5

The east-to-west resolution is the same as the north-to-west resolution.

rows: 7461

There’s a total of 7461 rows in your region.

cols: 8201

And 8201 columns.

cells: 61187661

That makes for a total of 61187661 cells (7461 x 8201 = 61187661).

So if you’re wanting to split your region into two regions that have the same length north to south and are divided in the middle of your original region, you could e.g. move the eastern border to the west, thus “cutting off” the eastern half of the region:
g.region e=553470
and then put the western border there and move the eastern border back to where it was, after you’re done working on region 1.
g.region w=553470 e=670334.25

Hope that helps!
Daniel