R-sig-geo'ers:

I'm trying to figure out an efficient way to upsample (from higher rez to
lower rez) a *categorical* raster using a function where the output pixel
value is the ID of the class that would have had the highest cover within
the output, given the resampling.  This is NOT the same as a nearest
neighbor function. Right now, the best I can think of is:
1) Generate a set of binary masks, one per class, of the input image, where
for class X, the image X will be 0 if class X is not present, and 1 if it
is.
2) Run aggregate() with a function mean() on these images.
3) Pick the max value across the aggregated, lower rez images, which should
be the class with the highest cover.

Is there any easier way to do this?

--j


-- 
Jonathan A. Greenberg, PhD
Assistant Professor
Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
Department of Geography and Geographic Information Science
University of Illinois at Urbana-Champaign
607 South Mathews Avenue, MC 150
Urbana, IL 61801
Phone: 217-300-1924
http://www.geog.illinois.edu/~jgrn/
AIM: jgrn307, MSN: jgrn307@hotmail.com, Gchat: jgrn307, Skype: jgrn3007

	[[alternative HTML version deleted]]

