# Calculating average pixel value for each band across multiple raster layers? I have a set of raster files that are essentially data sets of precipitation across a region. I have multiple raster files that are the outputs of different climate models. Each pixel in the raster file has 365 bands that represent the precipitation value for each day. I want to calculate the mean for each pixel for each band across the different raster files.

I tried converting the raster to point files and extracting multiple values to the point, extracting the data to excel and then averaging them for each raster. I was wondering if there is a more efficient way to do this.

• the mean for each pixel for each band has no sense for me – aldo_tapia Mar 22 '18 at 17:30
• So each raster (of which there are many) has 365 "bands" which represent the rainfall for that pixel for each day of the year. So you are looking to get the average rainfall for a pixel per model (raster)? – Keagan Allan Mar 22 '18 at 18:28
• Some illustration, a table, a graphic would sure help to make the question clearer. – Techie_Gus Mar 22 '18 at 21:06
• @Techie_Gus Ive updated the question witha figure.... Is the question clearer? – Mukunth Natarajan Mar 22 '18 at 22:10
• R: raster::calc(x, mean) – mdsumner Jul 20 '18 at 21:48

## 1 Answer

There are many raster calculators available. Depends, what software you are familiar with.

E.g. you can use GRASS GIS `r.series` module (the module is also accessible via QGIS toolbox).

As @mdsumner commented, you can also use R.

A programatic approach is to read data by Python Numpy and calculate desired statistics. Numpy methods are also implemented in the command line by gdal_calc.py.

If data is in NetCDF (typical format for climate/meteo time-series data), you can process with some of these tools (I can mention e.g. NCO)

In case of precipitation, maybe there is some purpose of averaging of daily data (compare 3 different datasources?). Maybe some other statistics (e.g. sum, max) could be considered.