[GRASS-user] Resampling with percent cover

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Wed Apr 29 08:44:29 EDT 2009


Ned:
> 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?

Not sure for an _automatic_ way. You might try to realise/adapt the
following (semi-tested, for one class only):

1. match region to your ma # g.region res=1m rast=classified_map -pa

2. vectorise for example *only* the shrubs # r.to.vect feature=point
in=shrubs out=shrubs_points
# this will give you a point for (the center) of each pixel

3. match region to "shrubs_points" with a low-resolution # g.region
vect=shrubs_points res=30 -pa

4. create a low resolution vector-grid over the current region
# g.region -p # note te number of rows,cols
# v.mkgrid map=30m_grid grid=rows,cols position="region"

5. Follow the wiki to count points-in-polygons [1] and update the
"30m_grid" map with the number of points that fall within each grid-cell

6. Find out the maximum number of pixels that fits in one low-resolution
pixel (well it should be 30^2 / 1^2 = 900 / 2 = 900 in your case)

7. add a column percent and update with "number of counted pixels *
(1/9)"

8. then you can play around with the numbers and create vector/raster
maps of your interest.

Cheers, Nikos
---


[1] http://grass.osgeo.org/wiki/Count_points_in_polygon



More information about the grass-user mailing list