Fix errors in RINEX reading function #22
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The existing rinex reading functions unfortunately atrophied over time and there was an failure in the line that extracted the expected column count from the signal header information (maybe due to changes in pandas versions) and then also failed using datetime2j2000 due to the runtime type checking in that function.
I reworked the column detection and then removed the type checking in the datetime2j2000 function (that function still might need love and updated type hints but I started by just deleting the branching because it seemed to have the same code on both branches).
This go the function working on the data I originally cared about but testing on further random data revealed it failed for /LGOW00AUS_S_20212590000_01D_30S_MO.rnx obtained from GA's gnss-data and more generally wouldn't work for any RINEX file with more than two lines of signals in the header.
I entirely reworked the way the header reading code works and I think simplified it overall. I also did a little tidy-up in the code generally and it seems to work for a large random sampling of rinex (3) files pulled from gnss-data.
This code still doesn't handle rinex 2, it is a bit brittle in places, and a little funky and maybe slow in implementation (it does a lot of weird fiddling with strings to do the parsing process and I think it can probably all be replaced with block-by-block read_fwf with some post-processing) but it's better than it started.