[GRASS5] [bug #4368] (grass) r.blend: overwrites the output instead of 'Error: map exists.'

this bug's URL: http://intevation.de/rt/webrt?serial_num=4368
-------------------------------------------------------------------------

Subject: r.blend: overwrites the output instead of 'Error: map exists.'

Platform: GNU/Linux/x86
grass obtained from: CVS
grass binary for platform: Compiled from Sources
GRASS Version: 2006-04-23

As the title reads. Also, r.blend GUI misses the neat green progress bar.

Maciek

-------------------------------------------- Managed by Request Tracker

On Sat, Apr 29, 2006 at 06:27:36PM +0200, Request Tracker wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=4368
-------------------------------------------------------------------------

Subject: r.blend: overwrites the output instead of 'Error: map exists.'

This happens because r.mapcalc is used which is not testing for
existing maps.

As the title reads. Also, r.blend GUI misses the neat green progress bar.

AFAIK the progress bar is related to G_percent() output. No idea
how solve that...

Markus

this bug's URL: http://intevation.de/rt/webrt?serial_num=4368
---------------------------------------------------------------------

Subject: r.blend: overwrites the output instead of 'Error: map
exists.'

..

GRASS Version: 2006-04-23

As the title reads.

fixed in cvs. As map name is created dynamically the parser doesn't
catch it with "gisprompt = new,cell,raster" ("new," not "old,"!)

I used g.findfile as the test,

for MAP in r g b ; do
   g.findfile elem=cell file=${GIS_OPT_OUTPUT}.$MAP > /dev/null
   if [ $? -eq 0 ] ; then
      echo "Raster map <${GIS_OPT_OUTPUT}.$MAP> already exists." 1>&2
      exit 1
   fi
done

a few other cleanups, metadata tweaks done as well.

Also, r.blend GUI misses the neat green progress bar.

This is because the module that creates the 100% is r.mapcalc which is
called by the script, not the GUI. The GUI parses G_percent(), not output
to stderr. No obvious solution.

Changing this bug to a wish:

g.parser should set (but not export) $GIS_OVERWRITE if the --o option
is passed to the script. Then we could test within the script.

alt, maybe better, we could test if

`g.gisenv get=OVERWRITE` -n && -eq 1 and then skip "exit 1" but keep the
warning. (be sure to read-only g.gisenv OVERWRITE)

see http://grass.ibiblio.org/grass61/manuals/html61_user/variables.html

Hamish

Markus Neteler wrote:

> Subject: r.blend: overwrites the output instead of 'Error: map exists.'

This happens because r.mapcalc is used which is not testing for
existing maps.

This happens because the r.blend script uses the "old" tag for its
output maps, so G_parser() doesn't check whether they already exist.

FWIW, I can add an explicit check to r.mapcalc to prevent overwriting,
if that is considered desirable.

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

Hamish wrote:

> Also, r.blend GUI misses the neat green progress bar.

This is because the module that creates the 100% is r.mapcalc which is
called by the script, not the GUI. The GUI parses G_percent(), not output
to stderr. No obvious solution.

Huh? It shouldn't make any difference whether r.mapcalc is called
directly or via a script.

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