# Weighted Average of several raster “zones”

thanks for the visit!

Suppose I have two rasters, A and B. I want to determine the value of a certain "zone" in raster A by taking the weighted average of several other zones from raster B, that partially overlay onto that zone of raster A.

I think its much better if I show you a picture to try to explain:

• The "certain 'zone' in raster A" is shown as the teal polygon in the border, suppose it is rasterized and is made up of 1000 cells.
• The red grids are the "several other zones from raster B." In this case, there are four denoted by g1, g2, g3, g4 (these are some values).
• The weight will be determined by the number of pixels lying within the respective zones in raster B.
• The value of that certain 'zone' in raster A will be determined by this:

value of zone in A = (50/1000)g1 + (300/1000)g2 + (150/1000)g3 + (500/1000)g4

I've thought of employing the Combine tool in ArcMap and then bringing it into excel.. but it is a fairly manual process. I have a lot of data to get through (like 50+ raster B's that I must aggregate through)..

Is there an easier way to do this? Is there a specific function you think may help? I have little experience in writing a python script but if you point me to some packages+functions in arcpy or numpy or whatnot, I'd greatly appreciate it.

====

edit: Similar, previous questions have suggested things like "dasymmetric mapping" like this thread: How to use NASS county level crop data to estimate crop acreage in hydrologic regions?.. which suggests the use of the Intersect tool, but I'd generally prefer to rely on using weights from the counts of defined cell sizes of a raster rather than have arcgis calculate the area proportions from vector data.

I also found a helpful tip on this question, Obtain normalized raster average per polygon?, suggesting Zonal Statistics. Is the "mean" of Zonal Statistics the same as what I'm trying to do? I'll try it and report back...

-
Couldn't you clip the polygon out and calculate the average? – gm70560 Apr 27 '13 at 20:36
..hmm, but I have much more than one polygon – M.g. Apr 27 '13 at 21:34
Could you describe the desired output in more detail? Is Raster B simply defining the zones, or are you interested in the pixel values of raster B too? Can't you complete this analysis using Zonal statistics via your teal polygon and raster B? Thanks for clearing this up. – Aaron Apr 27 '13 at 22:41