I have a large number of rasters (300+) I would like to average using Raster Calculator as is explained at Averaging set of rasters using Raster Calculator of ArcGIS Desktop? I know I can manually select each raster by double-clicking, hitting the '+' key, and then dividing by the total number of files.
Is there a less tedious way to get the average raster, without having to double-click and hit "+" hundreds of times? (or typing each raster's filename into the box, or something similarly tedious)
Answer
As @FelixIP said, use Cell Statistics. You'll need the Spatial Analyst license, however.
Alternatively, if you don't have access to Spatial Analyst, and you're familiar with python, you could use arcpy. What I would do is:
- Loop through each raster and convert them to numpy arrays using RasterToNumpyArray.
- As you're looping through the rasters, store each numpy array into another numpy array (an array of arrays).
- Calculate the mean of that array.
- Convert that back to a raster using NumpyArrayToRaster.
I haven't tried this, but I'm pretty sure it should work.
No comments:
Post a Comment