Learn R Programming

eseis (version 0.7.3)

aux_hvanalysis: Perform H-V-spectral ratio analysis of a seismic data set

Description

This function cuts a three component seismic data set into time windows that may or may not overlap and calculates the spectral ratio for each of these windows. It returns a matrix with the ratios for each time slice. Thus, it is a wrapper for the function signal_hvratio. For further information about the technique and function arguments see the description of signal_hvratio.

Usage

aux_hvanalysis(
  data,
  time,
  window,
  overlap = 0,
  dt,
  method = "periodogram",
  kernel,
  order = "xyz",
  plot = FALSE,
  ...
)

Value

A matrix with the h-v-frequency ratios for each time slice.

Arguments

data

List, data frame or matrix, seismic componenents to be processed. If data is a matrix, the components must be organised as columns. Also, data can be a list of eseis objects.

time

POSIXct vector with time values. If omitted, an synthetic time vector will be created, based on dt.

window

Numeric scalar, time window length in seconds used to calculate individual spectral ratios. Set to 10 percent of the time series length by default.

overlap

Numeric value, fraction of window overlap.

dt

Numeric value, sampling period.

method

Character value, method for calculating the spectra. One out of "periodogram" , "autoregressive" and "multitaper", default is "periodogram".

kernel

Numeric value, window size (defined by number of samples) of the moving window used for smoothing the spectra. By default no smoothing is performed.

order

Character value, order of the seismic components. Describtion must contain the letters "x","y" and "z" in the order according to the input data set. Default is "xyz" (NW-SE-vertical).

plot

Logical value, toggle plot output. Default is FALSE.

...

Additional arguments passed to the plot function.

Author

Michael Dietze

Examples

Run this code
## load example data set
data(earthquake)

## ATTENTION, THIS EXAMPLE DATA SET IS FAR FROM IDEAL FOR THIS PURPOSE

## detrend data
s <- signal_detrend(data = s)

## calculate the HV ratios straightforward
HV <- aux_hvanalysis(data = s,
                     dt = 1 / 200,
                     kernel = 100)

## calculate the HV ratios with plot output, userdefined palette
plot_col <- colorRampPalette(colors = c("grey", "darkblue", "blue", "orange"))
HV <- aux_hvanalysis(data = s,
                     dt = 1 / 200,
                     kernel = 100,
                     plot = TRUE,
                     col = plot_col(100))

## calculate the HV ratios with optimised method settings
HV <- aux_hvanalysis(data = s, 
                     time = t,
                     dt = 1 / 200, 
                     window = 10, 
                     overlap = 0.9, 
                     method = "autoregressive",
                     plot = TRUE,
                     col = plot_col(100),
                     xlab = "Time (UTC)",
                     ylab = "f (Hz)")
                     
## calculate and plot stack (mean and sd) of all spectral ratios
HV_mean <- apply(X = HV, MARGIN = 1, FUN = mean)
HV_sd <- apply(X = HV, MARGIN = 1, FUN = sd)
HV_f <- as.numeric(rownames(HV))

plot(x = HV_f, y = HV_mean, type = "l", ylim = c(0, 50))
lines(x = HV_f, y = HV_mean + HV_sd, col = 2)
lines(x = HV_f, y = HV_mean - HV_sd, col = 2)              

Run the code above in your browser using DataLab