detrendHeight {oceanwaves}R Documentation

Remove trend from a time series

Description

Fits a straight line to a vector of values using lm(), and uses the regression coefficients to subtract off the linear trend from the values.

Usage

detrendHeight(pt)

Arguments

pt

A vector of numeric values to be detrended

Details

Typically this is used to remove a tidal trend from a ocean surface height time series before attempting to calculate statistics for waves, which are variations above and below the mean surface height. Returns a series of residuals around the linear trend, in the original units of measurement (typically meters).

Value

A list containing the following:

pt A vector of detrended values

seg_len The segment length used

h The mean height of the water column

trend A two element vector of the intercept and slope from the linear regression.

Examples

data(wavedata)
detrended <- detrendHeight(wavedata$swDepth.m)
pt <- detrended[['pt']]
plot(pt, type = 'l')
abline(h = 0)

[Package oceanwaves version 0.2.0 Index]