[GRASS-user] order large pixel layer

Tord Snäll Tord.Snall at slu.se
Fri Nov 16 06:00:32 PST 2012


Dear all,

I would greatly appreciate advice on how to rank and standardize a raster layer with 6841*15411 pixels.



If the raster layer was instead a matrix, and I would use R, this is what I would do:

Say the raster had 12 pixels

rast = matrix(rnorm(12,mean=0.7,sd=0.1),ncol=4,nrow=3)

rast

> rast

          [,1]      [,2]      [,3]      [,4]

[1,] 0.6695254 0.7046706 0.7089812 0.6998835

[2,] 0.6497284 0.6999004 0.6743091 0.8738022

[3,] 0.8441623 0.7493160 0.7420391 0.6824722



Next, order

> matrix(order(rast),ncol=4,nrow=3)

     [,1] [,2] [,3] [,4]

[1,]    2   12    4    6

[2,]    1   10    7    3

[3,]    8    5    9   11



Next standardize in relation to the highest value

> matrix(order(rast),ncol=4,nrow=3)/12



           [,1]      [,2]      [,3]      [,4]

[1,] 0.16666667 1.0000000 0.3333333 0.5000000

[2,] 0.08333333 0.8333333 0.5833333 0.2500000

[3,] 0.66666667 0.4166667 0.7500000 0.9166667



Solutions using R, GRASS or something else will do as fine!



Best regards,

Tord

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20121116/80a7a1d5/attachment.html>


More information about the grass-user mailing list