The :class:`~waveresponse.WaveBinSpectrum` class provides an interface for handling 2-D directional wave spectra. :class:`~waveresponse.WaveSpectrum` extends :class:`~waveresponse.DirectionalBinSpectrum`, and contains spectrum density as a function of frequency, binned by direction.
\sum_{i=0}^n{S_{\zeta, i}(\omega, \delta\left(\theta - \theta_i\right))}
The :class:`~waveresponse.WaveSpectrum` is initialized with a frequency list (1-D array), a direction list (1-D array) and corresponding spectrum density values, binned by direction (2-D array).
import numpy as np
import waveresponse as wr
freq = np.linspace(0.0, 1.0, 50)
dirs = np.linspace(0.0, 360.0, endpoint=False)
vals = np.random.random((len(freq), len(dirs)))
wave = wr.WaveBinSpectrum(
freq,
dirs,
vals,
freq_hz=True,
degrees=True,
clockwise=False,
waves_coming_from=False,
)The :class:`~waveresponse.WaveBinSpectrum` class extends the :class:`~waveresponse.DirectionalBinSpectrum` class with the following:
Calculate the significant wave height, Hs:
wave.hsCalculate the wave peak period, Tp:
wave.tpCalculate the wave peak direction:
wave.dirp()Calculate the mean wave direction:
wave.dirm()