data: Numeric matrix or eseis object, seismic signals to cross-correlate.
d_stations: Numeric matrix, inter-station distances. Output of spatial_distance.
d_map: List object, distance maps for each station. Output of spatial_distance.
snr: Numeric vector, optional signal-to-noise-ratios for each signal trace, used for normalisation. If omitted it is calculated from input signals.
v: Numeric value, mean velocity of seismic waves (m/s).
dt: Numeric value, sampling period.
normalise: Logical value, option to normalise stations correlations by signal-to-noise-ratios.
verbose: Logical value, option to show extended function information as the function is running. Default is FALSE.
Returns
A SpatialGridDataFrame-object with Gaussian probability density function values for each grid cell.
Details
With the switch from the package raster to the package terra, the resulting distance maps can no longer be saved in lists as distance maps. Thus, the function re-defines the distance SpatRaster objects by a list of data on crs, extent, resolution and raster values. As a consequence, plotting the data requires turning them into a SpatRaster object, first (see examples).
Examples
## Not run:## create synthetic DEMdem <- terra::rast(nrows =20, ncols =20, xmin =0, xmax =10000, ymin=0, ymax =10000, vals = rep(0,400))## define station coordinatessta <- data.frame(x = c(1000,9000,5000), y = c(1000,1000,9000), ID = c("A","B","C"))## create synthetic signal (source in the center of the DEM)s <- rbind(dnorm(x =1:1000, mean =500, sd =50), dnorm(x =1:1000, mean =500, sd =50), dnorm(x =1:1000, mean =500, sd =50))## plot DEM and stationsterra::plot(dem)text(x = sta$x, y = sta$y, labels = sta$ID)## calculate spatial distance maps and inter-station distancesD <- spatial_distance(stations = sta[,1:2], dem = dem)## restore SpatRaster object for plotting purposeD_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 mapterra::plot(D_map_1)## locate signale <- spatial_migrate(data = s, d_stations = D$matrix, d_map = D$maps, v =1000, dt =1/100)## get most likely location coordinatese_max <- spatial_pmax(data = e)## plot location estimate, most likely location estimate and stationsterra::plot(e)points(e_max[1], e_max[2], pch =20)points(sta[,1:2])## End(Not run)