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 3430 Fix SP3 header parsing to more robustly handle orbit accuracy values #38

Merged
merged 2 commits into from
Aug 2, 2024

Conversation

treefern
Copy link
Collaborator

@treefern treefern commented Aug 2, 2024

Previous implementation searched for a slightly incorrect length of data (50 instead of 51 chars), and did this instead of explicitly specifying the expected format (three char chunks which always end with a digit). It also did not allow for -, leading negative values to crash the SP3 header parser.

@treefern treefern requested a review from ronaldmaj August 2, 2024 04:04
@treefern
Copy link
Collaborator Author

treefern commented Aug 2, 2024

Further commentary, more minor fixes, and unit tests to be added in another PR.

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 looks good, change is mostly around fixing a regex that impacts the read_sp3 function. With the pipeline passing, and therefore the unit-test for read_sp3 passing too, happy to push this through

@ronaldmaj ronaldmaj merged commit 7fa3c1a into main Aug 2, 2024
1 check passed
@treefern treefern deleted the NPI-3430-fix-sp3-header-parse-accuracy-codes branch August 2, 2024 05:15
treefern added a commit that referenced this pull request Aug 14, 2024

# Regex for orbit accuracy codes (E.g. ' 15' - space padded, blocks are three chars wide).
# Note: header is padded with ' 0' entries after the actual data, so empty fields are matched and then trimmed.
_RE_SP3_HEADER_ACC = _re.compile(rb"^\+{2}[ ]+((?:[\-\d\s]{2}\d){17})$", _re.MULTILINE)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It turns out the use of the trailing $ here was a mistake. Not all SP3 files have the line ending immediately after the orbit accuracy codes. Some pad with spaces. This is resolved in #45

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