Skip to content

Obs80Reader: dispatch two-line records by type + guard blank lines (Closes #402, #407) - #411

Closed
matthewholman wants to merge 1 commit into
mainfrom
issue/402-407/obs80-reader-robustness
Closed

Obs80Reader: dispatch two-line records by type + guard blank lines (Closes #402, #407)#411
matthewholman wants to merge 1 commit into
mainfrom
issue/402-407/obs80-reader-robustness

Conversation

@matthewholman

Copy link
Copy Markdown
Collaborator

Summary

Two Obs80DataReader robustness bugs the MPC full-catalogue fitting surfaced.

#402 — roving-observer (V/v) records

The reader routed every two-line record (S/R/V) through the satellite parser. But a roving-observer v line carries geodetic longitude/latitude (deg) + altitude (m) on WGS84, not a geocentric position — so it mis-read the fields and crashed. Now it dispatches on the first line's note2:

  • S → geocentric ICRF position (km/AU), unchanged
  • V → geodetic WGS84 longitude / latitude / altitude. (Capturing the position + its frame here; the geodetic→geocentric-ICRF conversion belongs to the observatory — Implement Additional ADES Observatory Formats as Needed #282, whose WGS84 half this feeds.)
  • R → radar; raise a clear error (radar is ingested via ADES delay/doppler, not the obs80 reader)

#407 — blank / short lines

two_line_row_start and _is_header_row indexed columns (line[14], line[3]) with no length check, so a blank or truncated line raised IndexError and aborted the entire read. Both are now length-guarded, and the read loop skips blank/short lines.

Tests

New fixture tests/data/obs80_two_line_records.txt (single optical + satellite + roving + interspersed blank lines) plus tests:

  • roving parses to WGS84 with the correct lon/lat/alt
  • radar raises a clear error
  • blank lines are skipped and the mixed file reads 3 records cleanly
  • satellite parsing unchanged (existing test still passes)

All 10 test_Obs80Reader tests pass; validated end-to-end on real (433) satellite+roving data.

Closes #402. Closes #407.

🤖 Generated with Claude Code

, #407)

#402 -- roving observer records: the reader sent every two-line record (S/R/V)
through the *satellite* parser, but a roving-observer ``v`` line carries geodetic
longitude/latitude (deg) + altitude (m) on WGS84, not a geocentric position, so
it mis-parsed and crashed. Dispatch on the first line's note2:
  * S -> geocentric ICRF position (km/AU), as before;
  * V -> geodetic WGS84 longitude/latitude/altitude (the geodetic->geocentric-ICRF
    conversion belongs to the observatory, issue #282);
  * R -> radar; raise a clear error (radar is ingested via ADES delay/doppler).

#407 -- blank/short lines: ``two_line_row_start`` and ``_is_header_row`` indexed
columns without a length check, so a blank or truncated line raised IndexError
and aborted the whole read. Guard both, and skip blank/short lines in the read
loop.

Adds a two-line-records fixture (single optical + satellite + roving + blank
lines) and tests: roving parses to WGS84 lon/lat/alt, radar raises, blank lines
are skipped, and satellite parsing is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@matthewholman
matthewholman requested a review from kjnapier July 2, 2026 17:14
matthewholman added a commit that referenced this pull request Jul 6, 2026
Reconcile with PR #411 (issue/402-407 Obs80Reader robustness), which overlaps
this branch's Obs80Reader rewrite. #411's structural pairing is superseded by the
_iter_records consolidation here, but its convert_obs80 by-type dispatch is
complementary and kept:

- S -> satellite geocentric ICRF position (km/AU), as before;
- V -> roving observer, parsed as WGS84 geodetic lon/lat (deg) + altitude (m)
  instead of mis-read as a satellite position (issue #402 / #282);
- R -> radar, raise a clear 'ingest via ADES' error instead of mis-parsing.

Also adds #411's _is_header_row length guard. Brings over #411's tests (roving,
radar, blank-line mixed file) and its obs80_two_line_records.txt fixture. With
this, #411 can be closed as superseded. 18 Obs80Reader tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@matthewholman

Copy link
Copy Markdown
Collaborator Author

Superseded by #425. That PR consolidates all three obs80 read paths (get_row_count, read_rows, read_objects/_build_id_map) into a single _iter_records generator, and folds in this PR's convert_obs80 by-type dispatch (S → satellite ICRF, V → roving-observer WGS84 geodetic, R → clear 'use ADES' error), the _is_header_row/#407 blank-line guards, and this branch's roving/radar/blank-line tests + the obs80_two_line_records.txt fixture. #425 additionally fixes deleted-observation (X/x) skipping and S/s orphan mis-pairing found in the full MPC-catalog run. Closing in favor of #425.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant