wecopttool.waves.irregular_wave

irregular_wave(efth, nrealizations, seed=None)[source]

Create a complex frequency-domain wave elevation from a spectrum.

The spectrum is a xarray.DataArray in the format used by wavespectra.SpecArray.

Note

The frequencies must be evenly-spaced with spacing equal to the first frequency. This is not always the case when e.g. reading from buoy data. Use interpolation as da.interp(freq=[...]).

Note

The wave directions must also be evenly spaced.

Parameters:
  • efth (DataArray) – Wave spectrum in units of m^2/Hz/deg, in the format used by wavespectra.SpecArray.

  • nrealizations (int) – Number of wave phase realizations to be created for the irregular wave.

  • seed (float | None) – Seed for random number generator. Used for reproducibility. Generally should not be used except for testing.

Return type:

DataArray