0

I want do generate for each pixel the average and standard deviation or better the variance coefficient for raster with 57 bands. The average should be average of the value for all bands. The result should be one raster, text file or something similar.

I tried a lot of tools. so far I have not been able to solve my problem.

I have no experience with Python, which is maybe my main problem. Have you some ideas? If you recommend me solutions with Python could you do it foolproof?

The similar post from 2014 couldn't help me.

2
2

Basic python is likely to run out of memory if you have a large image. I therefore recommand that you use gdal or OTB. You will need to install the apps, but they will manage the memory better than Pyhon (I don't say that it is not possible to manage the memory with Python, but you'll need more skills).

Since my previous post, OTB has a new band calculator with a much easier syntax for this kind of work, BandMathX. The OTB applications can be installed on all operating system and embedded in Python if you like, but here is the command line to give you the syntax (I don't know what is your working environment).

otbcli_BandMathX -il "your_multi_band_image" -out "your_output_mean" -exp "mean(im1)"

otbcli_BandMathX -il "your_multi_band_image" -out "your_output_mean" -exp "var(im1)"

In this syntax, there can be multiple images listed in "-il", so "im1" means that you work on the first image (operations are determined at the pixel level) for all bands (you can use a selected band with its index, e.g. im1b4 would be the fourth band of the first image in your list).

if your output is a large file, you should use extended filenames to optimize the storage, e.g. your_output.tif?&gdal:co:COMPRESS=LZW&gdal:co:TILED=YES&gdal:co:BIGTIFF=YES"

1

Thank you!

But i solved my problem in google engine. here is my solution.

// create new raster with the required information
var sd_inputraster = inputraster.reduce(ee.Reducer.stdDev());
var mean_inputraster = inputraster.reduce(ee.Reducer.mean());
var vco_inputraster = inputraster.expression('vco = sd / x',{'sd':sd_inputraster,'x':mean_inputraster});

//in case you want to filter directly by pixels, for example to classify
var Classname = (mean_inputraster.gte(0.24)).and(mean_inputraster.lte(0.73)).and(vco_inputraster.lte(0.4));

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