Dear list
Is it possible to get the "mode" (most common occurring value) in a polygon for discrete classes? It appears that v.rast.stats does not have this option.
Thanks for a short feedback,
Patrick
Dear list
Is it possible to get the "mode" (most common occurring value) in a polygon for discrete classes? It appears that v.rast.stats does not have this option.
Thanks for a short feedback,
Patrick
On Wed, Mar 16, 2016 at 6:23 AM, patrick s. <patrick_gis@gmx.net> wrote:
Dear list
Is it possible to get the "mode" (most common occurring value) in a
polygon for discrete classes? It appears that v.rast.stats does not have
this option.
v.rast.stats uses r.univar and r.univar doesn't have mode implemented (it's
a TODO in manual). You can look at r.mode but it returns raster map, not
one number.
Anna
Thanks for a short feedback,
Patrick_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
Thanks, Anna. That helps!
Cheers, Patrick
On 16.03.2016 13:59, Anna Petrášová wrote:
On Wed, Mar 16, 2016 at 6:23 AM, patrick s. <patrick_gis@gmx.net> wrote:
Dear list
Is it possible to get the “mode” (most common occurring value) in a polygon for discrete classes? It appears that v.rast.stats does not have this option.
v.rast.stats uses r.univar and r.univar doesn’t have mode implemented (it’s a TODO in manual). You can look at r.mode but it returns raster map, not one number.
Anna
Thanks for a short feedback,
Patrick
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
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. Setting NULL with r.null null=9999 it will return 9999 for all of these.
Is there a solution to that problem?
Patrick
On 16.03.2016 13:59, Anna Petrášová wrote:
On Wed, Mar 16, 2016 at 6:23 AM, patrick s. <patrick_gis@gmx.net> wrote:
Dear list
Is it possible to get the “mode” (most common occurring value) in a polygon for discrete classes? It appears that v.rast.stats does not have this option.
v.rast.stats uses r.univar and r.univar doesn’t have mode implemented (it’s a TODO in manual). You can look at r.mode but it returns raster map, not one number.
Anna
Thanks for a short feedback,
Patrick
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
On Thu, Mar 31, 2016 at 4:32 AM, patrick s. <patrick_gis@gmx.net> 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. Setting NULL with r.null
null=9999 it will return 9999 for all of these.Is there a solution to that problem?
I am not sure I understand, is this related to this?
https://lists.osgeo.org/pipermail/grass-dev/2015-October/076654.html
Could you provide more details?
Thanks
Anna
Patrick
On 16.03.2016 13:59, Anna Petrášová wrote:
On Wed, Mar 16, 2016 at 6:23 AM, patrick s. <patrick_gis@gmx.net> wrote:
Dear list
Is it possible to get the "mode" (most common occurring value) in a
polygon for discrete classes? It appears that v.rast.stats does not have
this option.v.rast.stats uses r.univar and r.univar doesn't have mode implemented (it's
a TODO in manual). You can look at r.mode but it returns raster map, not one
number.Anna
Thanks for a short feedback,
Patrick_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
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