[GRASSLIST:8930] Re: statistic mode

Hamish hamish_nospam at yahoo.com
Tue Nov 8 05:18:35 EST 2005


> I have a problem regarding the aspect map...
> I need to obtain the main orientation of some slopes...
> if I use the r.univar module to obtain the everage of the cells
> values, I obtain false results, because, for example:
> a slope degrading towards est is full of cells having values
> comprised
> between 0 and 45 and comprised between 315 and 360... the average is
> probably ~180.... exactly the opposite value I was looking for....
> 
> so I have thougth that I need probably the mode of the distribution,
> i.e. the value of the cells which are more present in the map....
> 
> do you know how I can simply obtain the mode???
> do you have a better solution


devolve angles (assume radius of 1) into cartesian x,y components, find
mean of each, then convert result back to polar coordinates.


cart2pol: [use r.mapcalc]
 x=cos(theta)
 y=sin(theta)

pol2cart:
 magnitude = sqrt(U_map^2 + V_map^2)
 direction = atan(U_map, V_map)


Most likely better solutions are out there.


r.univar doesn't do mode, r.univar.sh does. r.univar.sh still exists
because r.univar has not yet been finished for advanced statistics like
mode and quartiles. (m



Hamish




More information about the grass-user mailing list