[GRASSLIST:931] RE: Basic volume calculation question

Patton, Eric epatton at nrcan.gc.ca
Thu Apr 27 10:26:03 EDT 2006


Thanks for that idea, Wolf. I just tried it using > 0.0 as the test case,
with the same results. It does seem like some kind of integer rounding is
going on.

Can anyone comment on the datatype output from an if(x,a,b) statement in
r.mapcalc when input maps are type float?

~ Eric.

-----Original Message-----
From: Wolf Bergenheim
To: Patton, Eric
Cc: GRASS Users
Sent: 4/27/2006 10:15 AM
Subject: Re: [GRASSLIST:928] RE: Basic volume calculation question

On Thu, 27 Apr 2006, Patton, Eric wrote:

> Thanks for that nice overview. I tried using r.volume with a mask in
place,
> as in your example. Here's how I created the mask:
>
> r.info -r Diff_Nov1998_May1998_5m   # This map is a surface
difference;
> min=-2.400000                       # accumulation is between 0 and
1.65
> max=1.650000
>
> r.info -t Diff_Nov1998_May1998_5m   # Yes, we are dealing with float
data
> datatype=FCELL
>
> r.mapcalc MASK = 'if(Diff_Nov1998_May1998_5m > 0,
Diff_Nov1998_May1998_5m,
> null())'
> 100%
> [Raster MASK present]

Hmm to me it sound like it is rounding your map to integers. have you
tried:
r.mapcalc MASK = 'if(Diff_Nov1998_May1998_5m > 0.0,
Diff_Nov1998_May1998_5m, null())'

--Wolf

-- 

<:3 )---- Wolf Bergenheim ----( 8:>




More information about the grass-user mailing list