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-3388 Pandas deprecation fixes and improved SP3 rendering capability (moon orbit capability 🌚 ) #72

Merged
merged 22 commits into from
Jan 14, 2025

Conversation

treefern
Copy link
Collaborator

This PR has been a while in the making. 😅
The motivation for this work, was fixing deprecation issues which would prevent upgrading to Pandas 3.

One of these issues required changing the way gen_sp3_content() renders values within each epoch.
We previously found and replaced NaNs with string nodata values, within the DataFrame itself. This represented double-handling and is also not allowable in Pandas 3 as it mixed datatypes within a column (we were putting a string nodata value in a numeric column when we found a NaN or +/-inf).

We how handle formatting of inf and NaN values at the point of rendering, using Styler's format(), hide(), and to_string() functions. This means less double-handling and should improve performance and code clarity. ✨

Switching to Styler also had an unexpected bonus 🎉 : Styler's to_string() has a delimiter parameter, and setting this to an empty string allows us to disable padding between columns (which had previously been a bugbear).
This change in turn allows us to format position and clock values at the correct width, removing a known limitation in the SP3 rendering code.
Now we can output a file with an orbit as large as that of the moon. 🌚 But we'd probably never need to.

@treefern treefern requested a review from ronaldmaj January 13, 2025 10:47
@treefern treefern self-assigned this Jan 13, 2025
@treefern
Copy link
Collaborator Author

Further update made to address misalignment of values with full width enabled. It turns out the nodata strings needed updating.

…ation about why a test including gen_sp3_content() does not use a mock file for input.
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.

This is awesome, I've just tested this against the unit-tests and all deprecations warnings are now gone (from what I can see). Very happy for this to go in 👍

@ronaldmaj ronaldmaj merged commit 08f725b into main Jan 14, 2025
4 checks passed
@treefern treefern deleted the NPI-3388-pandas-deprecation-fixes branch January 14, 2025 10:58
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