[GRASS-user] Creating a new mapset

Is there any way to create a new mapset without going through the
GRASS startup script?

I'd like to be able to split it up simulation results into different
mapsets depending on the parameter variables and allow the simulation
to create them as needed.

Thanks
--
-Joel

"Wish not to seem, but to be, the best."
                -- Aeschylus

Joel Pitt wrote:

Is there any way to create a new mapset without going through the
GRASS startup script?

Yes.

I'd like to be able to split it up simulation results into different
mapsets depending on the parameter variables and allow the simulation
to create them as needed.

To make a new mapset, just mkdir the dirname in the location and copy
over the WIND file from the current mapset.

Then change mapsets with g.mapset (without an "s" at the end).

eval `g.gisenv`
cd "$GISDBASE/$LOCATION_NAME"
mkdir $newmapset
cp "$GISDBASE/$LOCATION_NAME/$MAPSET/WIND" $newmapset/
g.mapset $newmapset

Hamish

Thanks Hamish.

I was going to essentially do something similar, but wasn't sure what
the minimal required files/dirs in a location were.

Perhaps g.mapset should have a '-a' flag to add a new mapset? I know
it is pretty simple to carry out creating a dir and copying the file -
but for usability I think having this flag would be a good idea.

I'm happy to code it myself if people are happy with this change, so
long as someone can add it to cvs...

-J

On 10/13/06, Hamish <hamish_nospam@yahoo.com> wrote:

Joel Pitt wrote:
> Is there any way to create a new mapset without going through the
> GRASS startup script?

Yes.

> I'd like to be able to split it up simulation results into different
> mapsets depending on the parameter variables and allow the simulation
> to create them as needed.

To make a new mapset, just mkdir the dirname in the location and copy
over the WIND file from the current mapset.

Then change mapsets with g.mapset (without an "s" at the end).

eval `g.gisenv`
cd "$GISDBASE/$LOCATION_NAME"
mkdir $newmapset
cp "$GISDBASE/$LOCATION_NAME/$MAPSET/WIND" $newmapset/
g.mapset $newmapset

--
-Joel

"Wish not to seem, but to be, the best."
                -- Aeschylus

--
-Joel

"Wish not to seem, but to be, the best."
                -- Aeschylus

Joel Pitt wrote:

Perhaps g.mapset should have a '-a' flag to add a new mapset? I know
it is pretty simple to carry out creating a dir and copying the file -
but for usability I think having this flag would be a good idea.

I'm happy to code it myself if people are happy with this change, so
long as someone can add it to cvs...

That would be a very nice addition. For consistency you might use
"-c" instead of "-a" (from g.proj).

or -n from "v.digit -n", but I think g.proj is closer.

see lib/gis/make_loc.c

consider adding a new lib fn G_make_mapset() there.

$newmapset/WIND should be copied from PERMANET/DEFAULT_WIND, not the
current region settings (??)

thanks,
Hamish