<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Dear list, <br>
<br>
I am still trying to understand the output of shaded.relief to
compare to results of collegues created with other tools.<br>
When getting through the script I found the following calculation<br>
<br>
<i>r.mapcalc << EOF</i><i><br>
</i><i>$elev_out = eval( \\</i><i><br>
</i><i> x=($zmult*$elev[-1,-1] + 2*$zmult*$elev[0,-1] +
$zmult*$elev[1,-1] \\</i><i><br>
</i><i> -$zmult*$elev[-1,1] - 2*$zmult*$elev[0,1] -
$zmult*$elev[1,1])/(8.*ewres()*$scale) , \\</i><i><br>
</i><i> y=($zmult*$elev[-1,-1] + 2*$zmult*$elev[-1,0] +
$zmult*$elev[-1,1] \\</i><i><br>
</i><i> -$zmult*$elev[1,-1] - 2*$zmult*$elev[1,0] -
$zmult*$elev[1,1])/(8.*nsres()*$scale) , \\</i><i><br>
</i><i> slope=90.-atan(sqrt(x*x + y*y)), \\</i><i><br>
</i><i> a=round(atan(x,y)), \\</i><i><br>
</i><i> a=if(isnull(a),1,a), \\</i><i><br>
</i><i> aspect=if(x!=0||y!=0,if(a,a,360.)), \\</i><i><br>
</i><i> cang = sin($alt)*sin(slope) + cos($alt)*cos(slope) *
cos($az-aspect), \\</i><i><br>
</i><i> if(cang < 0.,0.,100.*cang), \\</i><i><br>
</i><i> if(isnull(cang), null(), 100.*cang))</i><i><br>
</i><i>EOF</i><br>
<br>
How can it be that I have negative values in my output raster?
Shouldn't the line <i>if(cang < 0.,0.,100.*cang)</i> prevent
negative values and multiply the result with 100? Is this a bug in
my results? I also wonder on the value-range: My values range from
-66 to 92<i>, </i>but as far as I understand the next line <i>if(isnull(cang),
null(), 100.*cang)</i>) will multiply the values again. So the
factor of multiplication is 10000 in total in my understanding? Is
that right?<i><br>
</i><br>
<br>
Hope someone is able to help and to comment on this.<br>
<br>
Thanks very much in advance!<br>
<br>
Patrick Schirmer<br>
<br>
</body>
</html>