r.mapcalc question
Chuck Ehlschlaeger
chuck at roberts.GEOG.UCSB.EDU
Mon Jun 20 19:28:43 EDT 1994
>I am trying to extract out certain ranges of values from one of my map
>layers and apply a formula to it to produce a new one. From my
>understanding of r.infer and r.mapcalc, it would seem that I need a
>combination of both modules, so that I could essentially come up with the
>following
>
> IFMAP temperature x-y
> THEN r.mapcalc newtemp='(temperature*2)-50'
It is possible to use the following r.mapcalc command:
/* temp == temperature */
r.mapcalc newtemp = 'if(temp >= x && temp <= y , temp * 2 - 50)'
note that if temp < x || temp > y, then r.mapcalc will give it a value of 0.
If you want it to be a different value (i.e., if outside range, then -9999):
r.mapcalc newtemp = 'if(temp >= x && temp <= y , temp * 2 - 50 , -9999)'
More information about the grass-user
mailing list