[GRASS5] shade.rel.sh broken

Glynn Clements glynn.clements at virgin.net
Mon Apr 22 12:41:52 EDT 2002


Glynn Clements wrote:

> > it seems that
> > shade.rel.sh
> > (and more?)
> > are broken due to the r.mapcalc change. Can anyone confirm?
> 
> It looks that way to me. I'll look into it now.

Fixed.

The problem was due to re-assigning an existing variable:

 a=round(atan(x,y)), \\
 a=if(isnull(a),1,a), \\

The parser didn't allow this.

Once that was fixed, it highlighted another problem:

 aspect=if(x||y,if(a,a,360.)), \\

Currently, floating-point values aren't accepted as booleans. I chose
to modify shade.rel.sh to use an explicit test:

 aspect=if(x!=0||y!=0,if(a,a,360.)), \\

I can change the behaviour of r.mapcalc if it's felt that FP values
should be allowed as booleans. I'm not so sure; if the user is forced
to write explicit equality checks, they might stop to consider whether
they should really be testing for exact equality, or using a tolerance
setting, e.g. 'abs(x) < EPSILON'.

Changing that indicated a bug in the handling of the neighbourhood
modifier. Once that was fixed, shade.rel.sh seems to work OK.

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



More information about the grass-dev mailing list