Title: | Ocean Wave Statistics |
---|---|
Description: | Calculate ocean wave height summary statistics and process data from bottom-mounted pressure sensor data loggers. Derived primarily from MATLAB functions provided by U. Neumeier at <http://neumeier.perso.ch/matlab/waves.html>. Wave number calculation based on the algorithm in Hunt, J. N. (1979, ISSN:0148-9895) "Direct Solution of Wave Dispersion Equation", American Society of Civil Engineers Journal of the Waterway, Port, Coastal, and Ocean Division, Vol 105, pp 457-459. |
Authors: | Luke Miller [aut, cre] , Urs Neumeier [aut], Travis Mason [ctb], Magali Lecouturier [ctb], George Voulgaris [ctb] |
Maintainer: | Luke Miller <[email protected]> |
License: | GPL-3 |
Version: | 0.2.6999 |
Built: | 2024-11-16 03:19:16 UTC |
Source: | https://github.com/millerlp/oceanwaves |
Test whether elements in vector x are effectively zero, within the square root of machine tolerance for a floating point number.
almostZero(x, y = 0, tolerance = sqrt(.Machine$double.eps))
almostZero(x, y = 0, tolerance = sqrt(.Machine$double.eps))
x |
Numeric vector of values to compared against 0 |
y |
Value to be compared against. Default is 0. |
tolerance |
The maximum difference between x and y necessary to call a value non-zero |
Returns TRUE for all vector elements that are within rounding error of zero.
TRUE or FALSE for each element of the vector x.
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.
detrendHeight(pt)
detrendHeight(pt)
pt |
A vector of numeric values to be detrended |
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).
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.
data(wavedata) detrended <- detrendHeight(wavedata$swDepth.m) pt <- detrended[['pt']] plot(pt, type = 'l') abline(h = 0)
data(wavedata) detrended <- detrendHeight(wavedata$swDepth.m) pt <- detrended[['pt']] plot(pt, type = 'l') abline(h = 0)
Plot a basic spectrum
plotWaveSpectrum(freqspec, Fs)
plotWaveSpectrum(freqspec, Fs)
freqspec |
A data frame containing a column of frequencies 'freq' and a column of spectral power values 'spec' |
Fs |
Frequency of sampled surface heights, units of Hz |
Bottom-mounted pressure transducers suffer from pressure signal attenuation when attempting to estimate surface wave heights. This function corrects water surface elevation time series based on the depth of the water column and height of the sensor above the bottom.
prCorr(pt, Fs, zpt, M = 512, CorrLim = c(0.05, 0.33), plot = FALSE)
prCorr(pt, Fs, zpt, M = 512, CorrLim = c(0.05, 0.33), plot = FALSE)
pt |
A vector of sea surface elevations (units of meters). |
Fs |
Sampling frequency (units of Hz). Normally 4 Hz for an OWHL logger. |
zpt |
Height of the pressure sensor above the seabed (units of meters). |
M |
Length of time series segments that will be used in the detrending and attenuation correction operations. 512 samples is the default, should be an even number. |
CorrLim |
[min max] frequency for attenuation correction (Hz, optional, default [0.05 0.33], which translate to periods of 20 sec to 3 sec). |
plot |
Logical value TRUE or FALSE. Displays a plot of the original and corrected time series. |
A vector of the depth-corrected surface elevations (units of meters usually). Any original trend in the input data (such as tide change) is present in the output data. The returned surface elevation fluctuations will typically be more extreme than the raw input surface elevations.
Based on original MATLAB function by developed by Travis Mason, M. Lecouturier & Urs Neumeier http://neumeier.perso.ch/matlab/waves.html
Each segment of pt will be linearly detrended, corrected for attenuation, and the linear trend will be added back to the returned data.
data(wavedata) corrected = prCorr(wavedata$swPressure.mbar, Fs = 4, zpt = 0.1) # Plot the results corrected = prCorr(wavedata$swPressure.mbar, Fs = 4, zpt = 0.1, plot=TRUE)
data(wavedata) corrected = prCorr(wavedata$swPressure.mbar, Fs = 4, zpt = 0.1) # Plot the results corrected = prCorr(wavedata$swPressure.mbar, Fs = 4, zpt = 0.1, plot=TRUE)
A dataset containing pressure records and derived sea surface height from a bottom-mounted pressure transducer data logger deployed at Marguerite Reef near Los Angeles, CA, USA. The device was deployed at a depth of approximately 10 meters, and sea level air pressure was 1014 mbar at the time of deployment. The pressure data logger was mounted approximately 10 cm above the benthos. Sampling rate was 4 Hz, so the total record represents 30 minutes of time.
wavedata
wavedata
A data frame with 7200 rows and 4 variables:
Date and time, with fractional seconds. UTC time zone.
Absolute pressure recorded by the data logger, in units of millibar (1 mbar = 100 Pascal). This value includes pressure due to the atmosphere above the sea surface, which was 1014 mbar during the deployment.
Pressure produced by the column of seawater above the data logger. The pressure due to the atmosphere above the sea surface has been subtracted off of the absolute pressure value absPressure.mbar to produce this value. Units of mbar.
Estimated depth in meters of the seawater column above the pressure data logger, converted from the swPressure.mbar value.
2016 Provided by Kristin Elsmore, UC Davis Bodega Marine Laboratory
A function to calculate wave number.
waveNumL(f, h)
waveNumL(f, h)
f |
A numeric vector of wave frequencies |
h |
A numeric vector of water depths (usually in units of meters) |
The wave number.
Modified from MATLAB function by Urs Neumeier: http://neumeier.perso.ch/matlab/waves.html Based on polynomial approximation from Hunt, J. N. 1979. “Direct Solution of Wave Dispersion Equation,” ASCE Journal of the Waterway, Port, Coastal and Ocean Division., Vol 105, pp 457-459 suggested by George Voulgaris, University of South Carolina
Calculate ocean wave parameters using spectral analysis methods
waveStatsSP( data, Fs, method = c("welchPSD", "spec.pgram"), plot = FALSE, kernel = NULL, segments = NULL, ... )
waveStatsSP( data, Fs, method = c("welchPSD", "spec.pgram"), plot = FALSE, kernel = NULL, segments = NULL, ... )
data |
A vector of surface heights that constitute a time series of observations. Typical units = meters. |
Fs |
Sampling frequency of the surface heights data. Units = Hz, i.e. samples per second. |
method |
A character string indicating which spectral analysis method
should be used. Choose one of |
plot |
A logical value denoting whether to plot the spectrum. Defaults
to |
kernel |
An object of class |
segments |
Numeric value indicating the number of windowing segments to
use with |
... |
Additional arguments to be passed to spectral analysis functions,
such as the |
Carries out spectral analysis of ocean wave height time series to estimate common wave height statistics, including peak period, average period, and significant wave height.
List of wave parameters based on spectral methods.
h
Average water depth. Same units as input surface heights
(typically meters).
Hm0
Significant wave height based on spectral moment 0. Same
units as input surface heights (typically meters).
This is approximately equal to the average of the highest 1/3 of the waves.
Tp
Peak period, calculated as the frequency with maximum power
in the power spectrum. Units of seconds.
m0
Estimated variance of time series (moment 0).
T_0_1
Average period calculated as , units seconds. Follows National
Data Buoy Center's method for average period (APD).
T_0_2
Average period calculated as , units seconds. Follows
Scripps Institution of Oceanography's method for calculating average period
(APD) for their buoys.
EPS2
Spectral width parameter.
EPS4
Spectral width parameter.
Original MATLAB function by Urs Neumeier: http://neumeier.perso.ch/matlab/waves.html, based on code developed by Travis Mason, Magali Lecouturier and Urs Neumeier.
waveStatsZC
for wave statistics determined using a
zero-crossing algorithm.
data(wavedata) waveStatsSP(wavedata$swDepth.m, Fs = 4, method = 'spec.pgram', plot = TRUE)
data(wavedata) waveStatsSP(wavedata$swDepth.m, Fs = 4, method = 'spec.pgram', plot = TRUE)
Calculate ocean wave summary statistics, including significant wave height and period.
waveStatsZC(data, Fs, threshold = NULL, plot = FALSE)
waveStatsZC(data, Fs, threshold = NULL, plot = FALSE)
data |
A numeric vector of water surface height data. The data do not need to be detrended prior to use. Typical units = meters |
Fs |
Sampling frequency of the data, in Hz. |
threshold |
The minimum height necessary for a zero-crossing event to be considered a wave. |
plot |
Set to TRUE if summary histograms of wave heights and wave periods are desired. |
Based on an upward zero-crossing algorithm originally provided by Urs Neumeier, v1.06. However, by default the algorithm is run as a downward zero-crossing process by inverting the data.
A list object containing summary statistic values.
Hsig
Mean of the highest 1/3 of waves in the data set. Units =
same as input surface heights.
Hmean
Overall mean wave height, for all waves (bigger than
threshold).
H10
Mean height of the upper 10% of all waves.
Hmax
Maximum wave height in the input data.
Tmean
Mean period of all waves (bigger than threshold).
Units = seconds.
Tsig
Mean period of Hsig
(highest 1/3 of waves).
Original MATLAB function by Urs Neumeier: http://neumeier.perso.ch/matlab/waves.html
waveStatsSP
for wave statistics determined using
spectral analysis methods.
data(wavedata) waveStatsZC(data = wavedata$swDepth.m, Fs = 4, plot = TRUE)
data(wavedata) waveStatsZC(data = wavedata$swDepth.m, Fs = 4, plot = TRUE)