[gdal-dev] gdal_calc.py: produce median raster

Mike Toews mwtoews at gmail.com
Wed Nov 26 01:38:38 PST 2014


Hi Simen,

Try this:

gdal_calc.py -A rgb.tif --outfile ouput.tif --calc "median(A, axis=0)"

The "axis=0" parameter is to perform a median calculation along the
first dimension, which is the band dimension. Lean more here:
http://docs.scipy.org/doc/numpy/reference/generated/numpy.median.html

-Mike

On 24 November 2014 at 23:14, Simen Langseth <simlangen at gmail.com> wrote:
> I have one GeoTiff file with 3 bands. I want to produce a raster file
> computing pixel wise median value for the three raster bands. How can I do
> that?
>
> I tried as follows:
>
> gdal_calc.py -A infile --allBands --outfile outfile --calc median(A)
>
> But could not get any out file.


More information about the gdal-dev mailing list