[gdal-dev] Gdal_warp -r sum not working a expected

Javier Jimenez Shaw j1 at jimenezshaw.com
Mon Jul 4 02:11:53 PDT 2022


That seems to be something wrong in the algorithm or configuration, as it
is not "ignoring" the pixels with nodata value.
Could you dump the output of "gdalinfo" of the original file, and the exact
command line you are using with gdalwarp ?
.___ ._ ..._ .. . ._.  .___ .. __ . _. . __..  ... .... ._ .__
Entre dos pensamientos racionales
hay infinitos pensamientos irracionales.



On Mon, 4 Jul 2022 at 10:20, Ainslie Johnstone <johnstone.ainslie at gmail.com>
wrote:

> Hi All,
>
> Thanks for your comments. I replaced the no data value (which previously
> was -200) with zero and then it all seemed to work!
>
> Best wishes,
> Ainslie
>
> On 1 Jul 2022, at 20:39, Andrew C Aitchison <andrew at aitchison.me.uk>
> wrote:
>
> On Fri, 1 Jul 2022, Ainslie Johnstone wrote:
>
> Hi there,
>
> I am trying to downsample a high-resolution file of gridded
> population estimates (1km res over the whole world). I want the
> downsampled version to give the total population in the new
> lower-resolution grid. However, whenever I downsample using gdalwarp
> -r sum, I don’t seem to be getting this. Instead the new values in
> the lower-resolution grid (no matter what resolution it is) seem to
> be more like the max, rather than the sum, of the old
> high-resolution grid. If I add up the total population across the
> whole grid it is far lower than it should be. How much lower depends
> on how much I have downsampled.
>
> I am making sure to exclude the no data values, and have tried a
> whole variety of different output resolutions and projections. Any
> suggestions as to why this might be?
>
>
> 1. Are your working type -wt and output type -ot big enough to store
> the population of the new pixels ?
>
> 2. If you don't need to record nodata, you could *try* making the
> nodata value 0 and treat them as data.
>
> --
> Andrew C. Aitchison Kendal, UK
> andrew at aitchison.me.uk
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220704/e94ee14a/attachment.htm>


More information about the gdal-dev mailing list