[GRASSLIST:2113] [Fwd: re: r.mapcalc]
    Rohan Sadler 
    rsadler at agric.uwa.edu.au
       
    Tue Jul 17 22:47:43 EDT 2001
    
    
  
On Tue, Jul 17, 2001 at 12:04:13PM +0800, Rohan Sadler wrote:
> > Dear GrassList,
> > 
> > I have just started on Grass last week and am using ver 5.0beta11 on 
> > redhat 7.1.
> > 
> > r.mapcalc does not work for me so that any expression such as
> > 
> > test3 = test2 - test1                    (with test2 set as MASK)
> > test3 = if(test2 != test1, 1, 0)
> > 
> > returns just the intersection of test2 and test1,
> > and not what I want - which is that part of test2 that does not include 
> > test1 (i.e. test2 minus the intersection).
> > 
> > If anyone has any ideas before I reinstall GRASS please forward them.
Nothing wrong with r.mapcalc by your description. 
1. Make sure to set the region appropriately "g.region rast=test1,test2"
2. Read the part of the manual page dealing with NULLs and the various
   related functions/tests.
3. Remove the MASK (otherwise you'll get nothing).
4. Try "$ echo 'test3 = if(test1, null(), test2)' | r.mapcalc"
   Which translates to:
      if "test1" is not null, output null
      otherwise output test2.
Alternatively, if I understand correctly, you could set the MASK using
test1 and just "echo 'test3 = test2' | r.mapcalc".  I think that should
work to get all of test2 that doesn't intersect with test1.
-- Eric G. Miller <egm2 at jps.net> <mailto:egm2 at jps.net>
    
    
More information about the grass-user
mailing list