[GRASS5] shade.rel.sh broken

Hi,

it seems that
shade.rel.sh
(and more?)
are broken due to the r.mapcalc change. Can anyone confirm?

Markus

Markus Neteler 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.

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

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@virgin.net>

On Mon, Apr 22, 2002 at 05:41:52PM +0100, Glynn Clements wrote:

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.

Thanks for the fix. I also discovered that I could not make a
binary map from a FCELL map, but now it seems to be working after your
recent fix to r.mapcalc.

Markus