<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Markus, <br>
<br>
I understand your arguments, but "A" is the slope of
r.slope.aspect and has floating point values as input for the
formula. I just created a testcase to be able to report on the
behavior in detail. As you can see below the results are truncated
to integer as soon as I add a term to "A" before the devision, but
it remains unclear to me why adding a float-value reduces the
attributes to integer-level as well. <br>
<br>
This is a somewhat tricky behavior as it is usual to add a small
constant to all values to avoid log(0)-errors.<br>
<br>
Patrick<br>
<br>
<small>####TESTING<br>
#algorithm:<br>
param<-list(amap="r_slope_perc", formula=##varies in
testing-see below##", outfile="r_test_logit") ###formula has
been replaced for each <br>
execGRASS("r.mapcalculator", parameters=param,
flags=c("overwrite"))<br>
x_perc<-readRAST6("r_slope_perc")<br>
x_log<-readRAST6("r_test_logit")<br>
xperc<-x_perc$r_slope_perc<br>
xlog<-x_log$r_test_logit<br>
<br>
summary(xperc)<br>
summary(xlog)<br>
<br>
sum(xperclog(((A+1)/100)/(1-(A+1/100)))==0, na.rm=T)<br>
<br>
<br>
###Testcase1: formula= log(((A/100)/(1-(A/100))<br>
> summary(xperc)<br>
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's <br>
0.000 3.162 8.602 13.540 18.440 229.800 9852 <br>
> summary(xlog)<br>
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's <br>
-4.9 -3.1 -2.2 -2.2 -1.4 9.5 564240 <br>
> sum(xperc==0, na.rm=T)<br>
[1] 550958<br>
<br>
<br>
###Testcase2: formula= log(((A+1)/100)/(1-(A+1/100)))<br>
> summary(xperc)<br>
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's <br>
0.000 3.162 8.602 13.540 18.440 229.800 9852 <br>
> summary(xlog)<br>
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's <br>
-5 -5 -5 -4 -5 -3 5369270 <br>
> sum(xperc==0, na.rm=T)<br>
[1] 550958<br>
<br>
<br>
<br>
###Testcase3: formula= log(((A+0.01)/100)/(1-(A+0.01/100)))<br>
> summary(xperc)<br>
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's <br>
0.000 3.162 8.602 13.540 18.440 229.800 9852 <br>
> summary(xlog)<br>
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's <br>
-9 -9 -9 -8 -9 -4 5369270<br>
<br>
> sum(xperc==0, na.rm=T)<br>
[1] 550958</small><br>
<br>
<br>
<br>
<br>
On 11/09/2012 10:22 AM, Markus Metz wrote:<br>
</div>
<blockquote
cite="mid:CAG+h=FHy7Ru=fY6Er+ModcQYyXaBsdCiVtNRBHQWqAiio6CrDQ@mail.gmail.com"
type="cite"><br>
<pre wrap="">The documentation is correct. The problem arose because
((A/100)/(1-(A/100)) returns an integer value if A is an integer, i.e.
the truncation happened before log() is called.
Markus M
</pre>
</blockquote>
<br>
</body>
</html>