I needed to resample and resize one larger array (call it arr_src) to the
extent and post of a smaller array (arr_trgt). Using a mesh grid approach,
I initially looped through the x and y grids of arr_trgt, extracting indicies
of points from the arr_src grids that were within a distance of the x and y
values representaed at a given arr_trgt position. I then averaged the z values
of arr_src at these indicies, using the mean to populate a given cell of the
resultant out grid (with an extent of arr_trgt).
The development code looked like this:
I was able to calculate my index positions using this function (with a bit of help):
However, with an arr_src of 19665 x 31573 pixels, the search in the main loop was taking ages - a result of my implemented exhasutive search approach.
Alas, I then found this post and was able to get my code to compile and complete in seconds - thanks gdal.