View source: R/spatial_distance.R
spatial_distance | R Documentation |
The function calculates topography-corrected distances either between seismic stations or from seismic stations to pixels of an input raster.
spatial_distance(
stations,
dem,
topography = TRUE,
maps = TRUE,
matrix = TRUE,
aoi,
verbose = FALSE
)
stations |
|
dem |
|
topography |
|
maps |
|
matrix |
|
aoi |
|
verbose |
|
Topography correction is necessary because seismic waves can only travel on the direct path as long as they are within solid matter. When the direct path is through air, the wave can only travel along the surface of the landscape. The function accounts for this effect and returns the corrected travel distance data set.
List
object with distance maps (list of
SpatRaster
objects from terra
package) and station distance
matrix (data.frame
).
Michael Dietze
## Not run:
data("volcano")
dem <- terra::rast(volcano)
dem <- dem * 10
terra::ext(dem) <- terra::ext(dem) * 10
terra::ext(dem) <-terra::ext(dem) + c(510, 510, 510, 510)
## define example stations
stations <- cbind(c(200, 700), c(220, 700))
## plot example data
terra::plot(dem)
points(stations[,1], stations[,2])
## calculate distance matrices and stations distances
D <- spatial_distance(stations = stations,
dem = dem)
D_map_1 <- terra::rast(crs = D$maps[[1]]$crs,
ext = D$maps[[1]]$ext,
res = D$maps[[1]]$res,
val = D$maps[[1]]$val)
## plot distance map
terra::plot(D_map_1)
## show station distance matrix
print(D$matrix)
## calculate with AOI and in verbose mode
D <- spatial_distance(stations = stations,
dem = dem,
verbose = TRUE,
aoi = c(0, 200, 0, 200))
## plot distance map for station 2
terra::plot(D$maps[[1]])
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.