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

Chris Yesson chris.yesson.phd at gmail.com
Mon Nov 24 23:59:40 PST 2014


Dear Simen,

You can refer to each band explicitly using the --A_band option.
Try something like this

gdal_calc.py -A infile --A_band 1 -B infile --B_band 2 -C infile --C_band 3
 --outfile outfile --calc median(A,B,C)

- Chris

*Dr Chris Yesson*
*Institute of Zoology, Zoological Society of London*
*Tel: 020 7449 6267*

*email: chris.yesson at ioz.ac.uk <chris.yesson at ioz.ac.uk>**web:
http://www.zsl.org/chrisyesson/
<http://www.zsl.org/chrisyesson/>*
*Note: I work Mon-Thurs and do not check email on Fri*

On 25 November 2014 at 07:44, Simen Langseth <simlangen at gmail.com> wrote:

> Dear Respected Authors:
>
> I would be grateful if you could share any hints on it.
>
>
> On Tue, Nov 25, 2014 at 4:33 PM, Simen Langseth <simlangen at gmail.com>
> wrote:
>
>> Dear Marius Jigmond:
>>
>> Thanks for your attempt.
>>
>> Unfortunately, it is producing 3 band outfile, rather than 1 band median
>> image.
>>
>> I could not figure out what this code computed, all the resulted 3 bands
>> images are also different.
>>
>> I hope someone can help me.
>>
>> On Tue, Nov 25, 2014 at 12:09 PM, Marius Jigmond <
>> mariusjigmond at hotmail.com> wrote:
>>
>>> Does the following work:
>>>
>>> gdal_calc.py -A infile --allBands=A --outfile=outfile --calc="median(A)"
>>>
>>>
>>> ------------------------------
>>> Date: Mon, 24 Nov 2014 19:14:06 +0900
>>> From: simlangen at gmail.com
>>> To: gdal-dev at lists.osgeo.org
>>> Subject: [gdal-dev] gdal_calc.py: produce median raster
>>>
>>>
>>> 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.
>>>
>>>
>>>
>>> _______________________________________________ gdal-dev mailing list
>>> gdal-dev at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>>
>>
>>
>
>
> This message has been scanned for viruses by MailControl
> <http://www.mailcontrol.com/>, a service from BlackSpider Technologies
> <http://www.blackspider.com/>.
>
> Click here <https://www.mailcontrol.com/sr/MZbqvYs5QwJvpeaetUwhCQ==> to
> report this email as spam.
>
>
> The Zoological Society of London is incorporated by Royal Charter
> Principal Office England. Company Number RC000749
> Registered address:
> Regent's Park, London, England NW1 4RY
> Registered Charity in England and Wales no. 208728
>
> _________________________________________________________________________
> This e-mail has been sent in confidence to the named addressee(s).
> If you are not the intended recipient, you must not disclose or distribute
> it in any form, and you are asked to contact the sender immediately.
> Views or opinions expressed in this communication may not be those
> of The Zoological Society of London and, therefore, The Zoological
> Society of London does not accept legal responsibility for the contents
> of this message. The recipient(s) must be aware that e-mail is not a
> secure communication medium and that the contents of this mail may
> have been altered by a third party in transit.
> If you have any issues regarding this mail please contact:
> administrator at zsl.org.
> ___________________________________________________________________________
>
> This message has been scanned for viruses by MailControl
> <http://www.mailcontrol.com/>, a service from BlackSpider Technologies
> <http://www.blackspider.com/>.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20141125/617ab36c/attachment.html>


More information about the gdal-dev mailing list