wavespectra.SpecDataset.to_orcaflex

SpecDataset.to_orcaflex(model, minEnergy=1e-06)

Writes the spectrum to an Orcaflex model

Uses the orcaflex API (OrcFxAPI) to set the wave-data of the provided orcaflex model.

The axis system conversion used is: - Orcaflex global X = Towards East - Orcaflex global Y = Towards North

This function creates a wave-train for each of the directions in this spectrum using a user-defined spectrum.

Calculation of wave-components in orcaflex is computationally expensive. To save computational time: 1. Use the minEnergy parameter of this function to define a treshold for the amount of energy in a wave-train. 2. In orcaflex itself: limit the amount of wave-components 3. Before exporting: regrid the spectrum to a lower amount of directions.

Orcaflex theory: - https://www.orcina.com/webhelp/OrcaFlex/Content/html/Wavetheory.htm - https://www.orcina.com/webhelp/OrcaFlex/Content/html/Directionconventions.htm

Example:
>>> from OrcFxAPI import *
>>> from wavespectra import read_triaxys
>>> m = Model()
>>> spectrum = read_triaxys("triaxys.DIRSPEC")).isel(time=0)  # get only the fist spectrum in time
>>> spectrum.spec.to_orcaflex(m)
Args:
  • model : orcaflex model (OrcFxAPI.model instance)

  • minEnergy [1e-6] : threshold for minimum sum of energy in a direction before it is exported

Note:
  • an Orcaflex license is required to work with the orcaflex API.

  • Only 2D spectra E(f,d) are currently supported.

  • The DataArray should contain only a single spectrum. Hint: first_spetrum = spectra.isel(time=0)