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 <[email protected]> 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 > [email protected] <mailto:[email protected]>
_______________________________________________ gdal-dev mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/gdal-dev
