Description Usage Arguments Value Examples
Function used to linearly subsample data at new depth values
1 |
data |
A vector of data to be interpolated |
old_depth |
A vector containing the depth values belonging to |
new_depth |
A vector containing depth values at which the |
AV |
Should the subsampling take into account the mean value within the
sample interval? |
plot |
Should the result be plotted? |
A vector listing the values interpolated from data
at the
positions of new_depth
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # Create test data (= ideal case)
# Set boundary conditions
Td <- seq(1, 12 * 365, 1) # Create timeline of 12 years in days
Ty <- Td / 365 # Convert to years
MAT <- 20 # Set mean annual temperature
Amp <- 10 # Set seasonal amplitude
Sext <- 2 * Amp # Calculate extent of seasonal variability
TSD <- 1.5 # Set the degree of random non–seasonal noise on the SST curve
# ("weather")
SST <- rnorm(length(Ty), MAT + Amp * sin(2 * pi * Ty), TSD) # Create virtual
# daily SST data
GR <- rep(10 / 365, length(Ty)) # Set growth rate to 10 mm/yr and create daily
# GR vector
SR <- 0.75 # Set sampling resolution to 0.75 mm
# Create vector for all samples along entire shell length by applying constant
# sampling resolution
D <- seq(SR, sum(GR), SR)
D_cum <- cumsum(GR) # Create cumulative depth vector for all values
new_data <- subsample(SST, D_cum, D, AV = TRUE, plot = FALSE) # Interpolate
# SST values at the positions of D while calculating sample averages
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.