Hello all,
I have rasters in a fine resolution, with values of 1 and null. I need to create, in a coarser resolution, new rasters where each cell gets the total number of non-null pixels from the fine resolution raster that are within the coarse pixel.
The clunky method I worked out uses r.out.xyz and r.in.xyz. Starting in the fine resolution, I export all (non-null) cell locations with r.out.xyz. Then I switch to the coarse resolution and do r.in.xyz with method=n. Seems to work, but is there anything better, more elegant?
You can use r.resamp.stats with aggregation method the sum
Paulo
···
On 15-04-16 09:02, Micha Silver wrote:
Hello all,
I have rasters in a fine resolution, with values of 1 and null. I need to create, in a coarser resolution, new rasters where each cell gets the total number of non-null pixels from the fine resolution raster that are within the coarse pixel.
The clunky method I worked out uses r.out.xyz and r.in.xyz. Starting in the fine resolution, I export all (non-null) cell locations with r.out.xyz. Then I switch to the coarse resolution and do r.in.xyz with method=n. Seems to work, but is there anything better, more elegant?
On Fri, Apr 15, 2016 at 9:20 AM, Paulo van Breugel
[<p.vanbreugel@gmail.com>](mailto:p.vanbreugel@gmail.com) wrote:
You can use r.resamp.stats with aggregation method the sum
Yes - for details see also
[https://grasswiki.osgeo.org/wiki/Interpolation#Resampling_of_raster_maps_to_coarser_resolution](https://grasswiki.osgeo.org/wiki/Interpolation#Resampling_of_raster_maps_to_coarser_resolution)
Markus