Etienne,<br><br>You can find a lot of sample code in the gdal test scripts[1]. There is a test script for regenerating overviews in gcore/tiff_ovr.py [2].<br><br>You can apply a filter using a VRT file[3]. It supports filters of various sizes.<br>
<br>[1]: <a href="http://trac.osgeo.org/gdal/browser/trunk/autotest/">http://trac.osgeo.org/gdal/browser/trunk/autotest/</a><br>[2]: <a href="http://trac.osgeo.org/gdal/browser/trunk/autotest/gcore/tiff_ovr.py#L1046">http://trac.osgeo.org/gdal/browser/trunk/autotest/gcore/tiff_ovr.py#L1046</a><br>
[3]: <a href="http://www.gdal.org/gdal_vrttut.html">http://www.gdal.org/gdal_vrttut.html</a><br><br><div class="gmail_quote">On Sat, Aug 6, 2011 at 5:15 AM, Etienne <span dir="ltr">&lt;<a href="mailto:etiennesky@yahoo.com">etiennesky@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Thanks Anton<br>
<br>
This might seem obvious to many of you, but how could I go about applying a filter using the gdal utilities/functions/python code?<br>
<font color="#888888"><br>
Etienne<br>
</font><div class="im"><br>
<br>
----- Original Message -----<br>
From: Anton Korosov &lt;<a href="mailto:anton.korosov@nersc.no">anton.korosov@nersc.no</a>&gt;<br>
To: <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
Cc:<br>
</div><div class="im">Sent: Friday, August 5, 2011 3:27:41 AM<br>
Subject: Re: [gdal-dev] help resampling raster to coarser scale<br>
<br>
</div><div><div></div><div class="h5">Hi Etienne!<br>
<br>
What if you first process the original fine resolution image with a<br>
filter (low-pass, median, or manually created pixel function). Then the<br>
result, which is a fine resolution image but smoothed, could be<br>
resampled with the nearest neighbor.<br>
<br>
Anton<br>
<br>
On 08/05/2011 03:57 AM, Etienne wrote:<br>
&gt; Hi all,<br>
&gt;<br>
&gt;<br>
&gt; I am trying to resample a raster with categorical data (land surface vegetation/cover) from a high resolution (500m) to a coarser resolution.<br>
&gt;<br>
&gt; I would like to do something similar to what the GRASS operator r.resamp.stats does, using the modal category present in the higher resolution dataset to pick the value in the lower-resolution map.<br>
&gt; It seems that my only option using gdal_warp is nearest neighbor, which will pick the value nearest to the coarser pixel center (regardless of the most present category within the region).<br>
&gt;<br>
&gt; I would also like have a low-resolution map with the proportions of all land types (from the high resolution map).<br>
&gt;<br>
&gt; Any idea on how to accomplish what I want using gdal?  I am not familiar with GRASS, and would prefer to stick with GDAL if I can.  However, I am open to any suggestions.<br>
&gt;<br>
&gt; Many Thanks<br>
&gt; Etienne<br>
&gt; _______________________________________________<br>
&gt; gdal-dev mailing list<br>
&gt; <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
&gt; <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br><br>+91-9494447584<br>17.2416N 80.1426E<br>