[GRASSLIST:5528] Using "maskmap" on raster data

Have a nice day,

    I'd like to ask about using some "maskmap" on existing map. I've got
binmary mask describing some important area. How can I "thinner" some
raster to contain only data from this area? (other data should be NULL or
zero)

               Thanks for help

                        Honza

---------------------------------------------------------------------
                           HoK Honza Kohout
student Fakulty Informatiky MU clen 137. NRS Klubu Bludny koren
http://www.fi.muni.cz/~xkohout2 http://www.koren.cz/
  honza@koren.cz klub@koren.cz

On Wed, Feb 12, 2003 at 06:48:06PM +0100, Jan Kohout wrote:

Have a nice day,

    I'd like to ask about using some "maskmap" on existing map. I've got
binmary mask describing some important area. How can I "thinner" some
raster to contain only data from this area? (other data should be NULL or
zero)

r.mask
echo "copy = original" | r.mapcalc

BTW, "Have a nice day" is usually used as a closing/farewell. I think
you want "Good Day", for a opening/greeting :wink:

--
echo ">gra.fcw@2ztr< eryyvZ .T pveR" | rot13 | reverse

I'd like to ask about using some "maskmap" on existing map. I've
got binmary mask describing some important area. How can I
"thinner" some raster to contain only data from this area? (other
data should be NULL or zero)

r.mapcalc new_rast="if((mask_rast, old_rast, null())"

(translated: if raster cell exists in 'mask_rast', use value from
'old_rast', otherwise NULL.)

mind the logic of "if(NULL, , )" ...
use if(isnull(mask_rast), null(), old_rast) instead..

The r.mapcalc help page is pretty helpful, anyway.