fix: deduplicate time values in add_location instead of raising ValueError#1627
fix: deduplicate time values in add_location instead of raising ValueError#1627beatfactor wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1627 +/- ##
==========================================
+ Coverage 85.58% 85.59% +0.01%
==========================================
Files 79 79
Lines 6998 7031 +33
==========================================
+ Hits 5989 6018 +29
- Misses 1009 1013 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
LOCEANlloydizard
left a comment
There was a problem hiding this comment.
Hi @beatfactor, nice! thx for the PR! Just small thoughts:
-
Should we rename the function to something like check_and_drop_loc_time_dim_duplicates() to better reflect its new behavior?
-
For the test, should we also assert that latitude/longitude match the ping_time dimension (e.g. same length)? This would confirm the deduplication path still preserves the expected alignment (although I think it's already tested elsewhere? so not sure)
Cheers!
844e080 to
6ac03b6
Compare
|
@LOCEANlloydizard renamed and added the 2 new assertions. Thanks for reviewing! |
There was a problem hiding this comment.
Hi @beatfactor, thx for the changes!
It looks like the PR accidentally includes a local virtual environment (venv/). Could you remove it from the PR?
There are also pre-commit and RTD errors. I’m not sure whether the RTD one is related to the venv or not? lets see if it still raise after! Cheers
f6371dc to
623ef15
Compare
PR updated, sorry for the venv. |
|
Hi @beatfactor, we discussed this with @leewujung and thought it could be useful to make the warning more explicit when deduplicating timestamps, so it’s clear whether duplicate come from mixed NMEA sentence types or from a single one? I tried to push this directly to the PR branch but don’t have permission, so sharing here! I added and that message is passed to the warning: That only requires to change the function signature and calling
That it, just suggestions, happy to hear your thoughts on this, or if you’d prefer another approach! |
|
@LOCEANlloydizard No problem, this make sense, I'll add them in soon. Yeah, it's not possible to push directly to our fork, you'd need to send a PR there instead, and once I merge your change into our branch, it would reflect into this PR automatically. Or you can suggest edits directly in the Changes view, as far as I am aware. |
623ef15 to
c0c4bd5
Compare
|
@LOCEANlloydizard have you had a chance to check the latest? I made the changes. |
Fixes #1478. EK80 data commonly has duplicate timestamps in Platform time dimensions (e.g., from multiple NMEA sentences — GGA, GLL, RMC — at the same timestamp). Previously add_location() raised a ValueError, requiring manual deduplication before use.
Now duplicate time values are automatically removed (keeping the first occurrence) with a UserWarning, and interpolation proceeds normally.