Patrick S. wrote:

> I am still trying to understand the output of shaded.relief to compare 
> to results of collegues created with other tools.
> When getting through the script I found the following calculation
> 
> /r.mapcalc << EOF//
> //$elev_out = eval( \\//

> // cang = sin($alt)*sin(slope) + cos($alt)*cos(slope) * cos($az-aspect), 
> \\//
> // if(cang < 0.,0.,100.*cang), \\//
> // if(isnull(cang), null(), 100.*cang))//
> //EOF/
> 
> How can it be that I have negative values in my output raster? Shouldn't 
> the line /if(cang < 0.,0.,100.*cang)/ prevent negative values and 
> multiply the result with 100?

No. That line does nothing.

eval() evaluates all arguments then returns the last argument. Prior
arguments are only meaningful if they have side effects, and the line
"if(cang < 0.,0.,100.*cang)" doesn't have any side effects.

-- 
Glynn Clements <[email protected]>
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to