On 31/03/16 10:32, patrick s. wrote:
Following Anna's suggestion I had to find out that r.mode has to option
to handle NULL values, i.e. exclude it from calculation? I need to
aggregate rasters to polygons, with rasters covering only a small part
of the polygon. As I realized now r.mode returns NULL in such case.


I cannot reproduce this issue with grass7. Try the following in the NC demo dataset:

g.region vector=census_wake2000@PERMANENT res=500 -a
v.random -a output=points npoints=5 restrict=census_wake2000@PERMANENT column_type=integer --o
v.kcv map=points@user1 npartitions=3
v.to.rast input=census_wake2000@PERMANENT output=census use=attr attribute_column=ID --o v.to.rast input=points@user1 output=points use=attr attribute_column=part --o
r.mode base=census@user1 cover=points@user1 output=census_points_rmode --o

The results seem correct: even though there are just 5 points in each census area, and most pixels are thus NULL in the points map, the mode corresponds to 1, 2 or 3.

> Setting NULL with r.null null=9999 it will return 9999 for all of these.

If you have more NULL cells than others, and you replace the NULL value by an integer value, you will obviously get that value as mode...

Moritz
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to