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

NPI-3060 Remove duplicated epochs in SP3 reader (with warning) #7

Merged
merged 2 commits into from Jan 15, 2024

Conversation

treefern
Copy link
Collaborator

Duplicated epochs should not be present in SP3 files. A warning is now logged if any are found. Detecting and removing duplicates also allows comparisons to be run on less compliant data.

The actual duplicate check is done on the Pandas DataFrame with Index.duplicated(). A quick test suggests this executes in less than 1ms on a typical SP3 file, so is not a performance concern.

@treefern treefern self-assigned this Jan 15, 2024
ronaldmaj
ronaldmaj previously approved these changes Jan 15, 2024
Copy link
Collaborator

@ronaldmaj ronaldmaj left a comment

Choose a reason for hiding this comment

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

We have had a chat about this already, I think this is good to go in. There is one comment I've put in, but I think we can change things around in future if we feel we need knowledge on the number of duplicate entries

# Check for duplicate epochs, dedupe and log warning
duplicated_indexes = sp3_df.index.duplicated()
if duplicated_indexes.sum() > 0: # We have dupes
first_dupe = sp3_df.index.get_level_values(0)[duplicated_indexes][0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if it is worth it to list out all indexes or rows that are copied out (to show the scale of the problem?)
Perhaps doing something like sp3_df.index.get_level_values(0)[duplicated_indexes].sum() / 2 should reveal the number of entries that are copied? Not entirely sure on this so it would need to be tested

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated to output the count in the warning. By the doc, it's by default the number of entries which duplicate something already there. So a (possibly repeated) list of duplicated values. I've worded the warning to try and capture that.

Copy link
Collaborator

@ronaldmaj ronaldmaj left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for putting the count in - good to go 👍

@treefern treefern merged commit 1006846 into main Jan 15, 2024
@ronaldmaj ronaldmaj deleted the NPI-3060-warn-and-dedupe-epochs-in-SP3-reader branch January 29, 2024 04:34
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.

None yet

2 participants