Dear list,
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( \
x=($zmult*$elev[-1,-1] + 2*$zmult*$elev[0,-1] + $zmult*$elev[1,-1] \
-$zmult*$elev[-1,1] - 2*$zmult*$elev[0,1] - $zmult*$elev[1,1])/(8.ewres()$scale) , \
y=($zmult*$elev[-1,-1] + 2*$zmult*$elev[-1,0] + $zmult*$elev[-1,1] \
-$zmult*$elev[1,-1] - 2*$zmult*$elev[1,0] - $zmult*$elev[1,1])/(8.nsres()$scale) , \
slope=90.-atan(sqrt(xx + yy)), \
a=round(atan(x,y)), \
a=if(isnull(a),1,a), \
aspect=if(x!=0||y!=0,if(a,a,360.)), \
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? Is this a bug in my results? I also wonder on the value-range: My values range from -66 to 92*,* but as far as I understand the next line if(isnull(cang), null(), 100.*cang)) will multiply the values again. So the factor of multiplication is 10000 in total in my understanding? Is that right?
Hope someone is able to help and to comment on this.
Thanks very much in advance!
Patrick Schirmer