Skip to content

Commit

Permalink
NPI-3388 add clearer exception for failing to extract a V from a data…
Browse files Browse the repository at this point in the history
…frame index while reading an sp3 file with velocities. I have never seen this in practice, but demonstrated it in testing.
  • Loading branch information
treefern committed Jan 13, 2025
1 parent 572ff8e commit e31466d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gnssanalysis/gn_io/sp3.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,14 @@ def read_sp3(
else:
# DF contains interlaced Position & Velocity measurements for each sat. Split the data based on this, and
# recombine, turning Pos and Vel into separate columns.

pv_flag_values = sp3_df.index.get_level_values("PV_FLAG").unique().values
if "V" not in pv_flag_values:
raise ValueError(
"SP3 header PV flag was not P, but no V (velocity) index appears to exist! "
f"Unique PV flag values seen: {pv_flag_values}"
)

position_df = sp3_df.xs("P", level="PV_FLAG")
velocity_df = sp3_df.xs("V", level="PV_FLAG")

Expand Down

0 comments on commit e31466d

Please sign in to comment.