[GRASS-user] Resampling with percent cover
Glynn Clements
glynn at gclements.plus.com
Wed Apr 29 10:56:32 EDT 2009
Ned Horning wrote:
> Hi � I am still working on creating a percent shrub cover map using GRASS
> and R and have a question regarding resampling. I have
> shrub/non-shrub/cloud maps at 1m resolution and I want to resample those
> to 30m pixels using the following logic.
>
> The value of each output 30m pixel will be the percentage of shrub pixels
> that make up the corresponding 30 x 30 pixel area from the
> shrub/non-shrub/cloud map and if any of the pixels in the 30 x 30 pixel
> area has a cloud value the value of the resulting 30m pixel will be NULL.
>
> Is there a way to do this in GRASS? R.resamp.stats seems like it is close
> but that might be too difficult for me to modify.
There shouldn't be any need to modify it.
Create a reclass of the input such that shrub=1, non-shrub=0 and
cloud=null, then resample that with "r.stats -n method=average ...".
The value of each output cell will be the proportion of shrub cells in
the corresponding 30x30 block of input cells, in the range 0.0 to 1.0
(if you want 0-100, use r.rescale or r.mapcalc). With the -n flag, if
one or more of the input cells in a 30x30 block are null, the
corresponding output cell will be null.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list