[GRASS-user] Creation of GISDBASE in a script

Hi list,

I'm trying to use GRASS 6.4.2 rc1 on a cluster, where each session is
launched on a TMP space. As a consequence, I cannot setup a GRASSDATA
db once for all - I need to upload the spatial data I want to work
with, create a tmp grassdata/location/mapset in a script, then launch
my GIS with another script. Unfortunately, I can't figure out how to
create the grassdata from scratch (not only the location, the whole
thing!), using a script (ie without any GUI).

I had this problem once with the dev version (grass70-svn), and the -c
flag resolved my problems [1]. But that solution does not seem to work
for this version.

Cheers,

Pierre

[1]: http://lists.osgeo.org/pipermail/grass-dev/2011-March/thread.html#53900

--
Scientist
Landcare Research, New Zealand

On Mon, Nov 7, 2011 at 4:11 AM, Pierre Roudier <pierre.roudier@gmail.com> wrote:

Hi list,

I'm trying to use GRASS 6.4.2 rc1 on a cluster, where each session is
launched on a TMP space. As a consequence, I cannot setup a GRASSDATA
db once for all - I need to upload the spatial data I want to work
with, create a tmp grassdata/location/mapset in a script, then launch
my GIS with another script. Unfortunately, I can't figure out how to
create the grassdata from scratch (not only the location, the whole
thing!), using a script (ie without any GUI).

For GRASS 6, see in Addons "grass_create_location.sh":
http://trac.osgeo.org/grass/browser/grass-addons/general/grass_create_location

Markus

On Mon, Nov 7, 2011 at 4:11 AM, Pierre Roudier <pierre.roudier@gmail.com> wrote:

Hi list,

I’m trying to use GRASS 6.4.2 rc1 on a cluster, where each session is
launched on a TMP space. As a consequence, I cannot setup a GRASSDATA
db once for all - I need to upload the spatial data I want to work
with, create a tmp grassdata/location/mapset in a script, then launch
my GIS with another script. Unfortunately, I can’t figure out how to
create the grassdata from scratch (not only the location, the whole
thing!), using a script (ie without any GUI).

I am in a similar situation, where I am simulating on different cluster nodes and have spatial results in a GRASS database. I simply created a template grass database, and copied it to the nodes (I actually linked the PERMANENT mapset, as it containes several GB of data and is read only).

If you want to, you should be able to consolidate all mapsets in one final location, i.e. copying then under a unique name ito the location (I just leave them as separate gras databases).

Cheers,

Rainer

I had this problem once with the dev version (grass70-svn), and the -c
flag resolved my problems 1. But that solution does not seem to work
for this version.

Cheers,

Pierre


Scientist
Landcare Research, New Zealand


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


Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax (F): +33 - (0)9 58 10 27 44

Fax (D): +49 - (0)3 21 21 25 22 44

email: Rainer@krugs.de

Skype: RMkrug

Thanks for your answers,

For GRASS 6, see in Addons "grass_create_location.sh":
http://trac.osgeo.org/grass/browser/grass-addons/general/grass_create_location

I did saw this add-on, but isn't it generating a new location only (ie
not a new, entire GRASSDATA)?

Pierre

--
Scientist
Landcare Research, New Zealand

On Mon, Nov 7, 2011 at 8:46 PM, Pierre Roudier <pierre.roudier@gmail.com> wrote:

Thanks for your answers,

For GRASS 6, see in Addons "grass_create_location.sh":
http://trac.osgeo.org/grass/browser/grass-addons/general/grass_create_location

I did saw this add-on, but isn't it generating a new location only (ie
not a new, entire GRASSDATA)?

You asked
"create a tmp grassdata/location/mapset in a script"

and creating the "grassdata/" is simply

mkdir grassdata

Then you can use the script indicating that directory or use Rainer's approach
to copy an existing empty location.

BTW: I only create temporary *mapsets* and work in the same location
on a cluster (in this case the location is valid for all jobs). Much easier...

Markus

Thanks for the clarification Markus et al., it works indeed,

Pierre

2011/11/8 Markus Neteler <neteler@osgeo.org>:

On Mon, Nov 7, 2011 at 8:46 PM, Pierre Roudier <pierre.roudier@gmail.com> wrote:

Thanks for your answers,

For GRASS 6, see in Addons "grass_create_location.sh":
http://trac.osgeo.org/grass/browser/grass-addons/general/grass_create_location

I did saw this add-on, but isn't it generating a new location only (ie
not a new, entire GRASSDATA)?

You asked
"create a tmp grassdata/location/mapset in a script"

and creating the "grassdata/" is simply

mkdir grassdata

Then you can use the script indicating that directory or use Rainer's approach
to copy an existing empty location.

BTW: I only create temporary *mapsets* and work in the same location
on a cluster (in this case the location is valid for all jobs). Much easier...

Markus

--
Scientist
Landcare Research, New Zealand

On Mon, Nov 7, 2011 at 9:19 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Mon, Nov 7, 2011 at 8:46 PM, Pierre Roudier <pierre.roudier@gmail.com> wrote:

Thanks for your answers,

For GRASS 6, see in Addons “grass_create_location.sh”:
http://trac.osgeo.org/grass/browser/grass-addons/general/grass_create_location

I did saw this add-on, but isn’t it generating a new location only (ie
not a new, entire GRASSDATA)?

You asked

“create a tmp grassdata/location/mapset in a script”

and creating the “grassdata/” is simply

mkdir grassdata

Then you can use the script indicating that directory or use Rainer’s approach
to copy an existing empty location.

BTW: I only create temporary mapsets and work in the same location
on a cluster (in this case the location is valid for all jobs). Much easier…

One disadvantage though: as the location has to be on a shared volume, all data has to be transfered via the network backend of the cluster. If you need the data often, it might be considerably faster to copy the data to the local volume of the node, and work there and copy the results back.
Alternative approach: you can have linked the temporary mapset, which sits on the local volume of the node, into the location on the shared volume - best of both worlds?

Cheers,

Rainer

Markus


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


Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax (F): +33 - (0)9 58 10 27 44

Fax (D): +49 - (0)3 21 21 25 22 44

email: Rainer@krugs.de

Skype: RMkrug

On Tue, Nov 8, 2011 at 9:51 AM, Rainer M Krug <r.m.krug@gmail.com> wrote:
...

One disadvantage though: as the location has to be on a shared volume, all
data has to be transfered via the network backend of the cluster. If you
need the data often, it might be considerably faster to copy the data to the
local volume of the node, and work there and copy the results back.

Yes, see this script as an example:
http://grass.osgeo.org/wiki/Parallel_GRASS_jobs#The_Grid_Engine_script
...
# temporarily store *locally* the stuff to avoid NFS overflow/locking problem
## Remove XXX to enable
grep XXX/storage/local /etc/mtab >/dev/null && (
  if test "$MYMAPSET" = ""; then
...

Markus

On Tue, Nov 8, 2011 at 11:40 AM, Markus Neteler <neteler@osgeo.org> wrote:

On Tue, Nov 8, 2011 at 9:51 AM, Rainer M Krug <r.m.krug@gmail.com> wrote:

One disadvantage though: as the location has to be on a shared volume, all
data has to be transfered via the network backend of the cluster. If you
need the data often, it might be considerably faster to copy the data to the
local volume of the node, and work there and copy the results back.

Yes, see this script as an example:
http://grass.osgeo.org/wiki/Parallel_GRASS_jobs#The_Grid_Engine_script

temporarily store locally the stuff to avoid NFS overflow/locking problem

Remove XXX to enable

grep XXX/storage/local /etc/mtab >/dev/null && (
if test “$MYMAPSET” = “”; then

Very nice script - I might add some aspects to my script.

Cheers,

Rainer

Markus


Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax (F): +33 - (0)9 58 10 27 44

Fax (D): +49 - (0)3 21 21 25 22 44

email: Rainer@krugs.de

Skype: RMkrug