[GRASSLIST:4533] Re: r.mapcalc and environment variables - BINGO
daniel_victoria at yahoo.com
Wed Sep 18 16:53:44 EDT 2002
Thanks for all the help...
If anyone is interested I'm just about finishing a
bash/perl script to filter out clouds in AVHRR imagery
based on a paper called "Improved Cloud Detection for
Daytime AVHRR Scenes over land"
Again, many thanks
--- Glynn Clements <glynn.clements at virgin.net> wrote:
> Daniel Victoria wrote:
> > Thanks for all the help, now I can output from a
> > script to r.mapcalc. But now I bumped into a new
> > problem.
> > In my formula line I have two integer constants
> > are calculated during the bash script but in the
> > formula I need the result of the division on a
> > floating point form. Since I don't think there is
> > way to do floating point calculations in bash I
> > put on my formula line something like ($m1/$m2)
> > I'd get (13/18).
> > The problem now is this. When I run r.mapcalc like
> > this
> > r.mapcalc output=blabla(13/18)blabla
> > I get different result from
> > r.mapcalc output=blabla(0.722223)blabla
> > Is this an illigal thing in r.mapcalc (13/18)??
> > How should I go about this???
> r.mapcalc will treat "13/18" as integer division,
> with a result of
> zero. You need to explicitly convert one of the
> values to
> floating-point, e.g.:
> r.mapcalc "output=blabla($m1.0/$m2)blabla"
> r.mapcalc "output=blabla(float($m1)/$m2)blabla"
> The first will expand to:
> r.mapcalc "output=blabla(13.0/18)blabla"
> resulting in the numerator being treated as a
> floating-point value.
> The second will expand to:
> r.mapcalc "output=blabla(float(13)/18)blabla"
> resulting in the integer value being converted to a
> value by r.mapcalc's float() function.
> Glynn Clements <glynn.clements at virgin.net>
Do you Yahoo!?
Yahoo! News - Today's headlines
More information about the grass-user