Skip to content

Added orcaflex export function#37

Merged
rafa-guedes merged 5 commits intowavespectra:masterfrom
RubendeBruin:export_orcaflex
Jun 22, 2021
Merged

Added orcaflex export function#37
rafa-guedes merged 5 commits intowavespectra:masterfrom
RubendeBruin:export_orcaflex

Conversation

@RubendeBruin
Copy link
Copy Markdown
Contributor

Adds a function to export a single spectrum to the orcaflex time-domain simulation program.

Note that an orcaflex license is required to do this.
The tests will try to run this test but will not fail if the orcaflex API can not be loaded.

Running the tests on a machine with orcaflex license gives the following output:

Time-domain signal from orcaflex simultation:
image

Comparison oned() input spectrum and spectrum re-calculated from time-domain signal using welch() 👍
image

Screenshot of orcaflex model with exported spectrum:
image

@rafa-guedes
Copy link
Copy Markdown
Collaborator

Thanks @RubendeBruin that will be useful addition to orcaflex users.

A few comments:

  • It would be good dealing with the cases where the SpecDataset will be composed by multiple spectra - either by allowing looping through non-spectral dimensions, or by raising an exception when that happens. If you decide to go for the former, as a suggestion I have just written an export function to funwave spectra (not merged yet) that loops through all spectra in dataset, if more than one spectrum, and writes then into a zip archive.
  • I don't know much about the software, does it have a specific file format for ingesting spectra and would it perhaps make sense to write that model instance as such a file?
  • Is there any published documentation describing this spectra processing / ingestion that you could point to in the docstring?
  • Could you please run black on the code as this is the standard used for the rest of the code base.

Tests and checks on single/multiple spectra
Tests and checks on single/multiple spectra
@RubendeBruin
Copy link
Copy Markdown
Contributor Author

Hi @rafa-guedes

Thanks for your review.

  • Orcaflex is a time-domain simulation. It will only accept a single environmental condition for a simulation. It has its own datafile format which contains all the data needed to run the simulation. As such the wave-spectrum it uses is embedded in the orcaflex datafile.
    The export function in this pull request uses the orcaflex API to inject a single spectrum into an existing model. Exporting more that a single spectrum is not possible using this approach (we would have to deep-copy the whole model, and then export save each one of them, but that feels like a very non-typical usecase).

  • I didn't know about black. Think it is great :-)

  • Added a link to the documentation to the docstring.

  • Added check one single spectrum and tests on that check

…aflex

# Conflicts:
#	tests/io/test_to_orcaflex.py
@RubendeBruin RubendeBruin mentioned this pull request Apr 15, 2021
@RubendeBruin
Copy link
Copy Markdown
Contributor Author

RubendeBruin commented May 20, 2021

PLEASE HOLD

there are some tricks for faster exporting of large amounts of data that I'd like to add to the commit.

@RubendeBruin
Copy link
Copy Markdown
Contributor Author

Ready to be merged

@rafa-guedes rafa-guedes merged commit 63aa4bf into wavespectra:master Jun 22, 2021
rafa-guedes added a commit that referenced this pull request Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants