Calculate ww3_bounc geographic distances with haversines and utilize verbose=2 output #1392
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.
Pull Request Summary
Bug fix for #1344
Description
When assigning NetCDF spectra to input boundary nodes, ww3_bounc uses an iterative method to identify the two nearest neighbor spectra in spec.list. Custom diagnostic output in ww3_bounc reveals that points even one kilometer apart can be calculated as having a separation distance of zero. Moreover, some input point - boundary point pairs result in a returned distance of NaN. As a result, assignment of spectra to boundary nodes is sensitive to the ordering of the boundary nodes and to the ordering of the provided spectra in a manner that is not explicit in the code.
This fix replaces usage of DIST_SPHERE in ww3_bounc with a new function, DIST_HAVERSINE, that is more robust when distances are on the order of 1 km or less. Both DIST_SPHERE and DIST_HAVERSINE are defined in w3servmd.
This fix additionally includes the option for more detailed diagnostic output from ww3_bounc that is triggered with the VERBOSE=2 namelist value in ww3_bounc.nml.
There are expected changes to regression tests tp2.8 and tp2.17 owing to modifications to the weight assignments of the linearly interpolated boundary spectra.
Issue(s) addressed
Commit Message
Calculate ww3_bounc geographic distances with haversines and utilize verbose=2 output
Check list
Testing
matrixCompSummary.txt
matrixDiff.txt
matrixCompFull.txt