[GRASS-user] Tip on using r.mapcalcl

Hamish hamish_b at yahoo.com
Fri Jul 8 16:19:31 EDT 2011


Helena Herrera wrote:
> Greetings
> I have 4 bands (B1;B2,B3;B4) all with values >0 except in a few
> pixels where I have nulls.I want to create a layer where I have
> 1 if at least I have 1 number and nulls where I don't have a
> single value
> I have tried thisif (B1>=0 || B2>=0 || B3>=0 || B4>=0, 1,null())
> but I got null in pixels where I have information for at least 2
> bands.any tip on how can I do this? Thanks

two ideas:

use r.patch then r.mapcalc if(!isnull(patch_map),1,null())
or maybe 'r.series method=count' then r.reclass.


have a look at r.mapcalc's "|||" instead of "||".


Hamish



More information about the grass-user mailing list