r.mapcalc (GRASS5.0beta)

Stephan Eickschen eicksch at uni-muenster.de
Thu Feb 11 12:06:56 EST 1999


Hi all,

I have some problems with r.mapcalc: I have imported several images with
r.in.bin. The data are 2 byte ints - everything went fine. I want to
calculate an average image by using r.mapcalc. It is not as simple as it
sounds first, since there are some gaps in the data (every day has an
image, but not all pixels in the images are "not zero", and the "non
zero" cells are not at constant places). So I thought to set up a
routine that

- adds all images together, resulting in an image "sum"
	(r.mapcalc sum=day1+day2+day3+...)

- creates an image of a sum of all "if(image)" resulting in "count"
	(r.mapcalc count=if(day1)+if(day2)+if(day3)+...)

- calculate the avarege by division "sum/count"
	(r.mapcalc average=sum/count)

Unfortunatly, it seems that every summation "implicitly" carries out
some masking, because the result is:

	sum=(day1+day2+day3+...)*(day1&&day2&&day3&&...)
	count=(if(day1)+if(day2)+if(day3)+...)*(day1&&day2&&day3&&...)

How can I "tell" GRASS5.0beta e.g. to take the NULL cells as 0???

Any suggestion will be highly appreciated :)

	Stephan

-- 
------------------------------------------------------------------------

Stephan Eickschen                     Tel. : +49 (0)251 83-34704
Westfaelische Wilhelms-Universitaet   Fax. : +49 (0)251 83-36100
Institute for Geophysics
Research Unit of Physical Glaciology  email: eicksch at uni-muenster.de
Corrensstrasse 24
48149 Muenster
Germany
		http://earth.uni-muenster.de/~eicksch/
------------------------------------------------------------------------



More information about the grass-user mailing list