Description Usage Arguments Details Value Author(s) Examples
View source: R/DiffuseRecord.R
This function diffuses a time series or record with a given depth-dependent diffusion length by convolution with a Gaussian kernel.
1 | DiffuseRecord(rec, sigma, res = 1, debug = FALSE)
|
rec |
Numeric vector containing the record that is to be diffused. |
sigma |
Numeric vector of the diffusion lengths corresponding to the
depths at which |
res |
Resolution of |
debug |
if |
This function expects a numeric vector with the depth-dependent diffusion
lengths of the same length as rec
. To calculate the simple case of a
constant diffusion length sigma.const
, provide
sigma = rep(sigma.const, length(rec))
as input.
The input diffusion length is internally scaled according to the resolution
of the record given by res
. The convolution integral is then
solved by a simple summation over the kernel width set to ~ 10 times the
current diffusion length.
For debug = FALSE
: To avoid NAs
at both ends of the diffused
version of rec
resulting from the kernel extending beyond the record
ends, the kernel is clipped at the upper end to the range below the
surface. At the lower end, the record is extended by ~ 10 times the maximum
of sigma
and filled with the mean average value of rec
.
Numeric vector containing the diffused version of rec
.
Thomas Münch, modified by Thomas Laepple
1 2 3 4 5 6 7 8 9 | ## Diffuse white noise with a linearly increasing diffusion length
rec <- rnorm(n = 1000)
var.sigma <- seq(1, 8, length.out = 1000)
diffused <- proxysnr:::DiffuseRecord(rec = rec, sigma = var.sigma)
plot(rec, type = 'l', las = 1, xlab = "depth in cm", ylab = "data", main =
"white noise diffusion with linearly increasing diffusion length")
lines(diffused, col = "red")
legend('topleft', c("original record", "diffused record"),
lty = 1, col = 1 : 2, bty = "n")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.