I have a set of files that have been mosaiced into a global VRT in a particular projection and resolution. However, I have a need to report statistics on a (say) one degree grid, where the reported statistics will be e.g. count, mean, mode or some percentile of the input pixels that fall within the grid cell. To make things more fun, there are NODATA instances too.
My solution is to create the mosaiced VRT in WGS84 Lat/Long, enforcing an output pixel size so that 1.0 % output_pixel_size == 0
(in other words, I can get an integer number of pixels into a 1 degree cell). Then, you run gdaladdo
on the VRT and extract what you want. This should work for averages, but percentiles and some other things are a bit more complicated.
I could do it in Python, but I was wondering if there's an off-the-shelf solution I could use?