I have HDF images with 365 bands each. Is there a way to compute local standard deviation across all of these bands with results appearing in each cell?

I have tried Zonal Statistics (with polygons converted from each raster cell as the input vector layer) but it does not appear to work for multiple bands. I also tried using SAGA via QGIS but it gave an error stating multi-band functionality was not supported.

Any one know of a way I can compute this using Raster Calculator or GRASS's r.series?

1 Answer 1


Here's an example with an RGB image:

r.in.gdal -e -o input=Overview_Tile322.jp2 output=Overview_Tile322
g.region rast=Overview_Tile322
g.list rast
# lists Overview_Tile322.red,Overview_Tile322.green,Overview_Tile322.blue
r.series input=Overview_Tile322.red,Overview_Tile322.green,Overview_Tile322.blue output=Overview_Tile322_stddev method=stddev

To make it easier, you may want assign the output of g.mlist to a variable and substitute it into the input of r.series:

g.mlist type=rast pattern=Overview_Tile322* separator=,
# prints Overview_Tile322.blue,Overview_Tile322.green,Overview_Tile322.red
  • 1
    There was also a way to do it in raster calculator. Though it still requires typing in all the band names. The following is if I was computing the local standard deviation of across 3 bands. ' First make an image which is the mean of all bands (("HRAC_V2.3.2014@1"+ "HRAC_V2.3.2014@2"+ "HRAC_V2.3.2014@3")/3) = "MeanImage" Then compute the Standard Deviation √((("HRAC_V2.3.2014@1"-"MeanImage")^2 + ("HRAC_V2.3.2014@2"-"MeanImage")^2 + ("HRAC_V2.3.2014@3"-"MeanImage")^2) / (3-1)) ' Thank you 55937!! Using Gdal would likely be easier.
    – ALbutler
    Sep 4, 2015 at 4:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.