pub struct Sp3 {
pub header: Sp3Header,
pub epochs: Vec<Instant>,
pub comments: Vec<String>,
pub skipped_records: usize,
/* private fields */
}Expand description
A parsed SP3 precise-ephemeris product.
Construct with Sp3::parse. Epochs are stored in ascending order; each
epoch maps satellite -> Sp3State. Per-satellite/per-epoch access is via
Sp3::state; arbitrary-epoch interpolation is built separately to match
the parity reference and is not part of this parser.
Fields§
§header: Sp3HeaderThe parsed header.
epochs: Vec<Instant>Epochs in ascending time order, tagged with the header time scale.
comments: Vec<String>Free-form /* comment lines (notice retained for provenance).
skipped_records: usizeCount of entries skipped because their satellite token did not parse to a
representable GnssSatelliteId (e.g. an extended GLONASS slot like R28
beyond the engine’s PRN cap): position/velocity records, plus +-header
satellite declarations. Lets callers tell a clean file
(skipped_records == 0) apart from one carrying unsupported satellites,
without aborting the whole parse on one such entry. Mirrors
crate::astro::sgp4::TleFile::skipped.
Implementations§
Source§impl Sp3
impl Sp3
Sourcepub fn epochs_j2000_seconds(&self) -> Vec<f64>
pub fn epochs_j2000_seconds(&self) -> Vec<f64>
The product’s parsed epochs as seconds since J2000, in the file’s own time scale, ascending.
This is the exact query axis Sp3::position_at_j2000_seconds interpolates
against (each epoch converted by the same [instant_to_j2000_seconds] used
for the spline nodes, NOT floored), so a caller can read the grid here, form
query times on it, and feed them straight back without a Julian-date
round-trip. An epoch whose representation cannot be mapped to J2000 seconds
is skipped (SP3 epochs are always Julian-date, so on real data this returns
one value per epoch).
Sourcepub fn position(&self, sat: GnssSatelliteId, epoch: Instant) -> Result<Sp3State>
pub fn position(&self, sat: GnssSatelliteId, epoch: Instant) -> Result<Sp3State>
Interpolate the state of sat at an arbitrary epoch.
Reproduces the pinned scipy.interpolate.CubicSpline recipe (see module
docs) bit-for-bit: a per-axis not-a-knot cubic spline over the
J2000-integer-second node axis, evaluated at epoch, with the unit
conversion as a single final multiply.
positionis always returned (interpolated from all position nodes ofsat), in meters, ITRF/IGS ECEF.clock_sisSomewhensathas at least two clock nodes in the clock sub-arc containingepoch(after clock-event splitting);Noneotherwise.velocity/clock_rate_s_sareNone(this API interpolates the position/clock product; velocity products are a separate concern).flagsare defaulted (an interpolated state is synthetic, not a record).
Errors:
Error::UnknownSatelliteifsathas no position nodes.Error::EpochOutOfRangeif fewer than two position nodes exist (a spline needs at least two points) or the epoch is not representable.Error::InvalidInputifepochis tagged with a different time scale than the SP3 product.
Sourcepub fn position_at_j2000_seconds(
&self,
sat: GnssSatelliteId,
query: f64,
) -> Result<Sp3State>
pub fn position_at_j2000_seconds( &self, sat: GnssSatelliteId, query: f64, ) -> Result<Sp3State>
Interpolate the state of sat at an arbitrary J2000-second epoch
supplied directly as an f64.
Identical to Sp3::position except the query is the seconds-since-J2000
value as already computed by the caller, rather than derived from an
Instant. The transmit-time iteration of the SPP residual carries the
epoch as a J2000-second f64 (t_tx = t_rx - rho/c) and must feed that
exact value to the spline, with no Julian-date round-trip in the loop, so
the interpolated position/clock match the reference recipe bit-for-bit.
Errors:
Error::InvalidInputifqueryis NaN or infinite.
Source§impl Sp3
impl Sp3
Sourcepub fn precise_ephemeris_samples(&self) -> Vec<PreciseEphemerisSample>
pub fn precise_ephemeris_samples(&self) -> Vec<PreciseEphemerisSample>
Extract this product as the canonical precise-ephemeris samples, in SI units, one per real position record in ascending epoch order.
Round-tripping PreciseEphemerisSamples::from_samples(sp3. precise_ephemeris_samples()) rebuilds the same interpolatable source
(byte-identical for samples whose meters are the faithful image of the fit
km; see the module docs).
Source§impl Sp3
impl Sp3
Sourcepub fn to_sp3_string(&self) -> String
pub fn to_sp3_string(&self) -> String
Serialize this product to standard SP3 text (the format named by its
header version, c or d).
Pure and deterministic. See this module’s docs for the round-trip and missing-satellite guarantees.
Source§impl Sp3
impl Sp3
Sourcepub fn parse(bytes: &[u8]) -> Result<Self>
pub fn parse(bytes: &[u8]) -> Result<Self>
Parse an SP3-c or SP3-d byte buffer into a typed product.
bytes is the full file content (already decompressed; this crate does
not do gzip - that is a caller-layer I/O concern). Returns
Error::Parse with a human-readable reason on malformed input.
Sourcepub fn parse_str(text: &str) -> Result<Self>
pub fn parse_str(text: &str) -> Result<Self>
Parse from a &str (the UTF-8 fast path used by Sp3::parse).
Sourcepub fn satellites(&self) -> &[GnssSatelliteId]
pub fn satellites(&self) -> &[GnssSatelliteId]
The satellites present in this product (from the header satellite list).
Sourcepub fn epoch_count(&self) -> usize
pub fn epoch_count(&self) -> usize
Number of parsed epochs.
Sourcepub fn state(
&self,
sat: GnssSatelliteId,
epoch_index: usize,
) -> Result<Sp3State>
pub fn state( &self, sat: GnssSatelliteId, epoch_index: usize, ) -> Result<Sp3State>
The state of sat at the parsed epoch with index epoch_index.
Returns Error::EpochOutOfRange if the index is past the end, or
Error::UnknownSatellite if the satellite has no record at that epoch.
Trait Implementations§
Source§impl EphemerisSource for Sp3
impl EphemerisSource for Sp3
Source§fn position_clock_at_j2000_s(
&self,
sat: GnssSatelliteId,
t_j2000_s: f64,
) -> Option<([f64; 3], f64)>
fn position_clock_at_j2000_s( &self, sat: GnssSatelliteId, t_j2000_s: f64, ) -> Option<([f64; 3], f64)>
sat at t_j2000_s.Source§impl ObservableEphemerisSource for Sp3
impl ObservableEphemerisSource for Sp3
Source§fn observable_state_at_j2000_s(
&self,
sat: GnssSatelliteId,
t_j2000_s: f64,
) -> Result<ObservableState, ObservablesError>
fn observable_state_at_j2000_s( &self, sat: GnssSatelliteId, t_j2000_s: f64, ) -> Result<ObservableState, ObservablesError>
Source§fn observable_states_at_j2000_s(
&self,
satellites: &[GnssSatelliteId],
epochs_j2000_s: &[f64],
) -> Result<ObservableStateBatch, ObservablesError>
fn observable_states_at_j2000_s( &self, satellites: &[GnssSatelliteId], epochs_j2000_s: &[f64], ) -> Result<ObservableStateBatch, ObservablesError>
impl StructuralPartialEq for Sp3
Auto Trait Implementations§
impl Freeze for Sp3
impl RefUnwindSafe for Sp3
impl Send for Sp3
impl Sync for Sp3
impl Unpin for Sp3
impl UnsafeUnpin for Sp3
impl UnwindSafe for Sp3
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.