Skip to content

Fix ship/underway instrument sampling trajectories#299

Merged
j-atkins merged 8 commits intomainfrom
adcp_bug
Mar 3, 2026
Merged

Fix ship/underway instrument sampling trajectories#299
j-atkins merged 8 commits intomainfrom
adcp_bug

Conversation

@j-atkins
Copy link
Collaborator

@j-atkins j-atkins commented Mar 3, 2026

Following #298 and the issues identified in class, this PR fixes the the path that the ship takes (and therefore the measurement locations for ADCP and Underwater_ST instruments) to be the actual shortest path between waypoints on the spherical globe.

As a reminder (and summarised in the plot below), the ship was 'missing' waypoints previously by going straight along a bearing, without curving, and this effect was enhanced when there are larger gaps between waypoints. Hence, the ship could overshoot a waypoint and leave the fieldset domain, causing out of bounds errors. Now, the logic is changed so that first an array of all locations on the forward propagation on the globe are accessed by geod.fwd_intermediate() and the number of spacings between each waypoint is determined by the distance and time between waypoints and the period associated with ADCP/Underwater_ST sampling. These are then added to the list storing where to take measurements.

Summary:

image

Closes #298

@j-atkins j-atkins marked this pull request as draft March 3, 2026 07:28
@j-atkins j-atkins marked this pull request as ready for review March 3, 2026 07:44
@j-atkins j-atkins requested a review from erikvansebille March 3, 2026 07:44
Copy link
Member

@erikvansebille erikvansebille left a comment

Choose a reason for hiding this comment

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

Code looks good, but would be useful to also add a test that failed under the old code and passes now. In general, I think that we should adopt a more test-driven development flow. In general, every change/fix would need to be tested, to make sure there's no regression?

@j-atkins
Copy link
Collaborator Author

j-atkins commented Mar 3, 2026

Test now also added to check that the ship path/underway ADCP measurement sites sit within the domain bounds determined by the waypoints and that the trajectory matches the waypoints.

@erikvansebille
Copy link
Member

Thanks for adding the tests; these look good! I assume you tested that the old code fails on them?

@j-atkins
Copy link
Collaborator Author

j-atkins commented Mar 3, 2026

I assume you tested that the old code fails on them?

Oops yes I should have indeed mentioned. The old code fails and the new passes 👍

@j-atkins j-atkins merged commit fcd130c into main Mar 3, 2026
9 of 10 checks passed
@j-atkins j-atkins deleted the adcp_bug branch March 3, 2026 13:38
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.

ADCP out of bounds errors

2 participants