| detrend {starsExtra} | R Documentation |
Detrend a Digital Elevation Model
Description
Detrends a Digital Elevation Model (DEM) raster, by subtracting a trend surface. The trend is computed using mgcv::gam or mgcv::bam (when parallel>1) with formula z ~ s(x, y).
Usage
detrend(x, parallel = 1)
Arguments
x |
A two-dimensional |
parallel |
Number of parallel processes. With |
Value
A two-dimensional stars object, with two attributes:
resid- the detrended result, i.e., "residual"trend- the estimated "trend" which was subtracted from the actual elevation to obtainresid
Examples
# Small example
data(dem)
dem1 = detrend(dem)
dem1 = st_redimension(dem1)
dem1 = st_set_dimensions(dem1, 3, values = c("resid", "trend"))
plot(round(dem1), text_values = TRUE, col = terrain.colors(11))
# Larger example 1
data(carmel)
carmel1 = detrend(carmel, parallel = 2)
carmel1 = st_redimension(carmel1)
carmel1 = st_set_dimensions(carmel1, 3, values = c("resid", "trend"))
plot(carmel1, col = terrain.colors(11))
# Larger example 2
data(golan)
golan1 = detrend(golan, parallel = 2)
golan1 = st_redimension(golan1)
golan1 = st_set_dimensions(golan1, 3, values = c("resid", "trend"))
plot(golan1, col = terrain.colors(11))
[Package starsExtra version 0.2.8 Index]