Add funwave writer for the WK_NEW_DATA2D wavemaker format#157
Merged
Conversation
New to_funwave_new method to write spectra as individual wave components in the WaveCompFile format expected by the FUNWAVE-TVD WK_NEW_DATA2D wavemaker. The file layout (NumFreq, PeakPeriod, then blocks of frequencies, directions, amplitudes and optional phases) follows the reader implementation in FUNWAVE-TVD src/wavemaker.F and the official examples in simple_cases/wave_coherence. The existing single-file / zip dispatch and direction conversion are factored out of to_funwave into a shared helper. Co-Authored-By: Claude Fable 5 <[email protected]>
New read_funwave_new function to reconstruct gridded spectra from FUNWAVE-TVD WK_NEW_DATA2D wave component files, by summing component energies a^2/2 over the frequency-direction bins defined by the unique frequencies and directions in the file. The reader lives in its own input module as required by the read function discovery mechanism, and is also registered as the funwave_new engine for xr.open_dataset. The official two-wave example file from the FUNWAVE-TVD repository is added as a sample file and tested against its analytical Hs. Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New
to_funwave_newoutput method on thespecaccessor to write spectra as individual wave components in theWaveCompFileformat expected by the FUNWAVE-TVDWK_NEW_DATA2Dwavemaker (Salatin et al. 2021). Unlike the griddedWK_DATA2Dformat written by the existingto_funwave, this format describes one wave component per spectral bin.Details
NumFreq,PeakPeriod, then blocks of frequencies, directions, amplitudes and an optional block of phases) was verified against the reader implementation in FUNWAVE-TVDsrc/wavemaker.Fand the official examples insimple_cases/wave_coherence, in addition to the manual section.a = sqrt(8 E df dd) / 2), which FUNWAVE consumes identically in both the WK_DATA2D and WK_NEW_DATA2D wavemakers.phases=Falseomits the phase block so FUNWAVE generates random phases itself.to_funwave; the single-file/zip dispatch and direction conversion are factored into a shared_write_funwavehelper.Test plan
hs(tail=False)), direction clipping, phase omission, multi-spectra zip output and 1D spectraruff formatclean🤖 Generated with Claude Code