[GRASSLIST:4486] Re: r.mapcalc and alternate mapsets.

Glynn Clements glynn.clements at virgin.net
Thu Sep 12 20:38:19 EDT 2002


Gordon Keith wrote:

> I can'te get r.mapcalc to work with maps from different mapsets.
> 
> > r.mapcalc viz=gabo_bath at gabo
> viz = (gabo_bath[0,0])
> ERROR: open_map: map [gabo_bath] not found
> 
> 
> Which is different from the error it gives if the map doesn't exist:
> 
> > r.mapcalc viz=gabo_Bath at gabo
> WARNING: unable to find [gabo_Bath at gabo] in [(null)]
> viz = (gabo_Bath at gabo[0,0])
> ERROR: open_map: map [gabo_Bath at gabo] not found
> 
> 
> So it look like it's finding the map but can't open it.
> 
> Any suggestions as to what is going on?

What's going on is that G_raster_map_type() uses G_find_file(), which
"helpfully" strips the "@mapset" part from its argument. Damn.

Given that GRASS comprises around 400 programs, there's a non-zero
chance that one or both of the following are true:

1. Other programs also call G_raster_map_type() without allowing for
the fact that it strips the mapset from the name (i.e. this bug may
well exist in other programs).

2. One or more programs rely upon it behaving this way, so we can't
just change the call to use G_find_file2 (which doesn't do this)
instead of G_find_file (which does) without analysing every single
program which uses it.

Damn. Damn. Damn. Damn. Damn. Damn.

Some days I look forward to being able to clean up all of this sort of
cruft in 5.1/6.0. And other days I wonder if the rot is too deep and
that the only solution is to raze the whole damn thing to the ground
and start again. Today is in the second category.

I can develop a fix for r.mapcalc fairly quickly. Either I can send
you a patch, or you can grab an update from CVS (or the web-CVS
interface), or you can wait for 5.0.1.

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



More information about the grass-user mailing list