log in r.mapcalc

Michael Shapiro shapiro at zorro.cecer.army.mil
Tue Oct 20 16:27:32 EDT 1992


EVERYTHING in an expression is evaluated, even all the  arguments
to an if(). (The reason is that if() isn't a logic operaion but a
function that happens to be named if and happens  to  behave  the
way it is described in the manual).  You have stumbled onto a bug
in r.mapcalc.  The bug is log(0) or exp(0,x)  should  detect  the
zero  and  not  call log() and exp() but set the result to NODATA
(which is 0). If the floating  point  exeception  messages  don't
actually  abort  r.mapcalc, see if the result map has zeros where
there are zeros in the imput (ie, see if r.mapcalc does the right
thing).

The floating-point exception messages I hope will  be  benign  in
this regard.  However, I will report this as a bug in r.mapcalc.

|
|Hi
|
|In an attempt to overcome a domain error problem encountered while using r.mapcalc's exp(x,y) function I tried to use the log and exp functions together.
|
|	r.mapcalc 'file=if(file.??,log(file.??)'
|
|When I use these funtions I get the message that an overflow has occured during the calculations. I have used an if statement to protect the log from the zero's in the data file and the rest of the data is well within the acceptable range. The values obta|ined are correct and no strange occurances exist.
|In trying to track this down I converted all the zero values to 1 and ran the routine again. No overflow occured. It appears that the presence of the 0 data is not being dealt with by the if statement.
|
|Does anyone have an insight into how r.mapcalc is operating in this reguard?
|
|Steve
|
|*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=**=*=*=*=*=*=*=*=*=*=*=*
|Steve Huddle, Graduate Student
|School of Engineering, University of Guelph, Guelph, ON, Canada, N1G 2W1
|E-Mail InterNet: HUDDLE at Net2.EOS.UoGuelph.Ca
|Telephone: (519) 824-4120 ext 4323                   FAX: (519) 836-0227
|
|
|


-----------------------------------------------------------------
Michael Shapiro                        U.S. Army CERL                  
email:   shapiro at zorro.cecer.army.mil  Environmental Division          
phone:   (217) 373-7277                P.O. Box 9005                   
fax:     (217) 373-7222                Champaign, Ill. 61826-9005
-----------------------------------------------------------------




More information about the grass-user mailing list