relative.position: Relative Topographic Position

relative.positionR Documentation

Relative Topographic Position

Description

relative.position and relative.rank are used with focal.function() to determine the relative value of a grid cell compared to its surroundings, either on a metric scale or based on ranks.

Usage

relative.position(x)

relative.rank(x, ties.method = "average")

Arguments

x

a square matrix with the grid data from the moving window, possibly containing NA values

ties.method

see rank()

Value

If x is provided, a numeric value in the interval [0,1] is returned.

If x is missing, a character vector of same length giving suggested variable (or file) names, here "relpos" and "relrank", respectively. See focal.function() for details.

See Also

focal.function(), rank(), centervalue()

Examples

m = matrix( round(runif(9,1,10)), ncol=3 )
print(m)
relative.position(m)
relative.rank(m)
## Not run: 
focal.function("dem",fun=relative.rank,radius=5)
focal.function("dem",fun=relative.position,radius=5)
relrank = as.vector(read.ascii.grid("relrank")$data)
relpos  = as.vector(read.ascii.grid("relpos")$data)
plot(relpos,relrank,pch=".")
cor(relpos,relrank,use="complete.obs",method="pearson")

## End(Not run)

RSAGA documentation built on Dec. 10, 2022, 1:12 a.m.