Re: Rasterio read outshape resample does not give correct array
Hobart, Geordie (NRCan/RNCan)
Hello. I think that your problem is a little more complex than just resampling. The bilinear interpolation averages the surrounding cells to create a smooth image. You need to sum the four surrounding cells, and populate the new grid with the result. Not sure exactly how to do it but a clever google should find what you need. Good Luck.
From: main@rasterio.groups.io <main@rasterio.groups.io>
On Behalf Of tinak.contact@...
Sent: March 16, 2021 14:26 To: main@rasterio.groups.io Subject: [rasterio] Rasterio read outshape resample does not give correct array
[Edited Message Follows] Hi all, I have a population grid and want to decrease the resolution by a factor 2. So I would like to get a raster that has 2 times less rows and columns, a resolution that is 2 times as large as the original one, while retaining the same overall number of population.
This should be a straightforward operation, but the population numbers change incorrectly if I follow the documentation. When the resampled array is written to file, the numbers are incorrect. I have a population grid and want to decrease the resolution by a factor 2. So I would like to get a raster that has 2 times less rows and columns, a resolution that is 2 times as large as the original one, while retaining the same number of population.
Shouldn't the resample method yield an array with resampled cell values to get the same number of total population? Any tips and hints would be appreciated!

