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-3669 Migrate SP3 transform and trim, introduce minimal SP3 creation utility script #63

Merged
merged 9 commits into from
Jan 8, 2025

Conversation

treefern
Copy link
Collaborator

@treefern treefern commented Dec 23, 2024

Also adds an additional SP3 trimming option, on top of what existed in the original version.
The new utility script is primarily intended for making minimal SP3 files for unit tests.

Speaking of unit tests:

  • filter_by_svs(): test now done
  • transform_sp3(): not practical to unit test. It's a wrapper for file read (including parse) / transform / write (including generate), so we should test the parse, generate and various transforming functions in isolation.

…r codebase), add more trimming options, introduce utility script for making minimal SP3 files, primarily intended for unit tests
@treefern treefern requested a review from ronaldmaj December 23, 2024 06:21
@treefern treefern self-assigned this Dec 23, 2024
@treefern
Copy link
Collaborator Author

treefern commented Dec 23, 2024

It turns out the approach taken to store the SV counts in the header, isn't currently compatible with the way we merge header attributes when combining DataFrames. This needs working through.
Update: this has been resolved.

@treefern
Copy link
Collaborator Author

After this PR is merged, we should make another dev release (probably 57.dev4), and update the downstream codebase in turn.

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.

As always, great PR. I've just chucked in a couple comments to extend the doc-strings for the new functions coming in. After that I think this is good to go in

@@ -226,6 +228,65 @@ def remove_offline_sats(sp3_df: _pd.DataFrame, df_friendly_name: str = ""):
return sp3_df


def filter_by_svs(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Very useful function and I've tested it now on a sample SP3 file - works great!

gnssanalysis/gn_io/sp3.py Show resolved Hide resolved
gnssanalysis/gn_io/sp3.py Show resolved Hide resolved
gnssanalysis/gn_io/sp3.py Show resolved Hide resolved
gnssanalysis/test_file_creation_util.py Outdated Show resolved Hide resolved
@treefern treefern requested a review from ronaldmaj January 7, 2025 06:32
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.

Just a couple minor things to fix up with docStrings

gnssanalysis/gn_io/sp3.py Outdated Show resolved Hide resolved
def sp3_hlm_trans(
a: _pd.DataFrame,
b: _pd.DataFrame,
) -> tuple[_pd.DataFrame, list]:
"""
Rotates sp3_b into sp3_a.

:param DataFrame a: The sp3_a DataFrame.
Copy link
Collaborator

Choose a reason for hiding this comment

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

DataFrame --> _pd.DataFrame

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, I changed this one to be more generic because that seemed more readable (given the renamed import is an internal thing). If it's parsed by an IDE I can see that backfiring.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In other parts of the code, we have pandas.DataFrame. We should standardise on one format for docstrings. One of:

  • DataFrame
  • pandas.DataFrame
  • _pd.DataFrame (looks non-standard for human use but may have the benefit of being resolvable in our context by an IDE.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These have now been updated to fit the convention applied to the majority of code in this codebase, which is using the imported module name, e.g. _pd.DataFrame

gnssanalysis/gn_io/sp3.py Outdated Show resolved Hide resolved
gnssanalysis/gn_io/sp3.py Show resolved Hide resolved
gnssanalysis/gn_io/sp3.py Outdated Show resolved Hide resolved
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 pushing those changes through - I think it is good to go in now 👍

@ronaldmaj ronaldmaj merged commit 8cadd2e into main Jan 8, 2025
4 checks passed
@ronaldmaj ronaldmaj deleted the NPI-3669-utility-func-for-minimal-sp3-generation branch January 8, 2025 03:31
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