[GRASS5] [bug #1075] (grass) bug in r.mapcalc

Glynn Clements glynn.clements at virgin.net
Fri May 31 10:55:27 EDT 2002


Request Tracker wrote:

> I have found that r.mapcalc doesn't work properly in a
> prompt/interactive mode:
> 
> GRASS:~ > r.mapcalc
> mapcalc> newmap=2 * 3
> mapcalc> exit
> mapcalc>
> 
> GRASS:~ > d.rast newmap
> ERROR: Raster map [newmap] not available
> 
> Problem #1: "exit" doesn't work, I had to use Ctrl-c

Ctrl-C sends SIGINT to the foreground process, which kills it. If you
want to generate an end-of-file condition under Unix, type Ctrl-D. 
This will work for r.mapcalc, as does typing a blank line (this is the
method which is documented in the r.mapcalc manpage).

> Problem #2: newmap was not created 

You killed r.mapcalc while it was still reading the expression.

> Problem #3 (or just a note): in a command mode, r.mapcalc behaves
> differently than a few months ago. Now you must have a command
> without spaces around "=" while in the past this command worked OK:
> 
> GRASS:~ > r.mapcalc flow.dx = "flow * cos(aspect)"

I can implement that easily enough.

However, given that you have to quote most of the command (e.g. to
prevent '*' being expanded by the shell), you may as well just quote
the whole thing, i.e.

	r.mapcalc "flow.dx = flow * cos(aspect)"

[Actually, single quotes are preferable.]

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-dev mailing list