Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve surface_elevation internal method selection #340

Conversation

simmsa
Copy link
Contributor

@simmsa simmsa commented Jul 9, 2024

Updated the surface_elevation calculation method to default to sum_of_sines when zero frequency is absent in the input spectrum. A warning is issued to inform users of this change. This ensures users benefit from the fastest computation method without needing to understand the underlying calculations.

This is a better version of PR #309 and provides a fix for Issue #308

simmsa added 5 commits July 9, 2024 08:43
This change allows `surface_elevation` to return a result if the user
inputs a spectrum with a frequency index that does not have a zero
frequency.

If the non zero frequency index condition is found when the method is
`ifft` we warn the user and change the method to `sum_of_sines`
S.index may not exist for some input datasets, but f[0] does and we
should use the value of f[0] here.
@simmsa simmsa marked this pull request as ready for review July 9, 2024 15:39
@simmsa simmsa requested a review from akeeste July 9, 2024 15:39
Copy link
Contributor

@akeeste akeeste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @simmsa. We previously addressed my one comment on approach in #309. No further changes from me

@akeeste akeeste merged commit cf877b6 into MHKiT-Software:develop Jul 10, 2024
17 checks passed
@ssolson ssolson mentioned this pull request Aug 12, 2024
ssolson pushed a commit that referenced this pull request Aug 13, 2024
* Test: Determine method using input frequency index

* Feat: Use sum of sines if ifft is not computable

This change allows `surface_elevation` to return a result if the user
inputs a spectrum with a frequency index that does not have a zero
frequency.

If the non zero frequency index condition is found when the method is
`ifft` we warn the user and change the method to `sum_of_sines`

* Fix: Use previously found frequency index

S.index may not exist for some input datasets, but f[0] does and we
should use the value of f[0] here.

* Test: Warn when using ifft with a non zero frequency

* Lint
@ssolson ssolson mentioned this pull request Dec 4, 2024
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