# Averaging a big number of pixels within a several km radius

I work with ArcMap software and now I have the aim to average individual pixels within a several km radius from daily data for at least 1 month. So I made the grid with 4 km step (the step size is not important for the question) and now I have to average pixels according to the described method. How do you think what the tool from ArcTools window I should use for this?

• Averaging for very large windows...this is exactly what the integral image transform is for. After performing this quick transform, you can extract the average of any sized (rectangular) shaped neighbourhood in linear time (three operations). It's how this particular problem is handled in the field of computer vision and graphics. Jun 5 '15 at 15:07

you can use focal statistics if you have the spatial analyst extension. This will compute the average of pixels in a moving window. if necessary, you can then resample at a lower resolution with nearest neighbour interpolation.

• Thank you, but the problem is I work with a large amount of images and have to analyze them simultaneously so I tried to find the tool which could help to load at least few files to obtain a statistically significant signal, but focal statistics works just with one. Jun 5 '15 at 8:44
• you can batch process all your images without adding them to ArcMap, this will speed up your process. Jun 5 '15 at 9:53
• Sorry, but how I can batch process my images without ArcMap? Do you mean another software? Jun 5 '15 at 11:40
• there are of course other software even or more efficient than ArcGIS for raster data (e.g. OTB, IDL), but what I mean is that you can use ArcGIS tools without adding the data in the data frame (which takes a long time, especially if you buil pyramids). for instance, right click on the tool and select "batch", or use an iterator in model builder, or use arcpy inPython script. Jun 5 '15 at 12:08
• O my God, you are right with batch process, it seems it's the same I hoped to find out! Thank you very much! I also wanted to make specific - is Focal Statistics suitable for the averaging pixel values near the nodal points of the grid for the chosen area? Jun 5 '15 at 12:51

After ReSample to a larger pixel size (which, by the sounds of it, you have already done), then use CellStatistics (in spatial analyst toolbox/Local), which will derive a statistic from multiple raster inputs.

Maybe I am misunderstanding your problem. CellStatistics will give you the average for a whole pile of rasters per pixel. Perhaps your problem is in the re-sampling or allocation of pixels to locations. If the latter, would buffer (of the source locations), feature -> raster (with a unique id, OID(?) perhaps), then zonal stats to get averages per zone, then cellstats to average the pile of rasters....

• You are right, it's necessary to use Resample to enhance the spatial resolution, but CellStatistics gives just mean values for pixels but I need to get averaged ones for some radius to indicate the source of emission. Jun 5 '15 at 11:38

I hope my answer can be helpful for you, first of all you need know what is Focal Statistics (Spatial Analyst)

The Focal Statistics tool performs a neighborhood operation that computes an output raster where the value for each output cell is a function of the values of all the input cells that are in a specified neighborhood around that location. The function performed on the input is a statistic, such as the maximum, average, or sum of all values encountered in that neighborhood.

Conceptually, on execution, the algorithm visits each cell in the raster and calculates the specified statistic with the identified neighborhood. The cell for which the statistic is being calculated is referred to as the processing cell. The value of the processing cell, as well as all the cell values in the identified neighborhood, is included in the neighborhood statistics calculation.

The neighborhoods can overlap so that cells in one neighborhood may also be included in the neighborhood of another processing cell.

after that I think this example that described in ArcMAP Manual can be useful also,

moreover if you have more than two raster and you'll run Focal Statistical in Batch mode follow this way shown below images: [step1] []3

[Step2]

Finally when finished process you can by reclassify (spatial analyst) get table form result rater, I think you need to do reclassify.