Skip to main content

Sp3

Struct Sp3 

Source
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 file order; exact-product consumers can use validate_exact_sp3 to require a strictly increasing, regular requested-cadence grid. 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: Sp3Header

The parsed header.

§epochs: Vec<Instant>

Epochs in file order, tagged with the header time scale.

§comments: Vec<String>

Free-form /* comment lines (notice retained for provenance).

§skipped_records: usize

Count 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

Source

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 uses for parsed record nodes, 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 unmodified parsed product returns one value per epoch.

Source

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.

  • position is always returned (interpolated from all position nodes of sat), in meters, ITRF/IGS ECEF.
  • clock_s is Some when sat has at least two clock nodes in the clock sub-arc containing epoch (after clock-event splitting); None otherwise.
  • velocity / clock_rate_s_s are None (this API interpolates the position/clock product; velocity products are a separate concern).
  • flags are defaulted (an interpolated state is synthetic, not a record).

Errors:

Source

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. The real-product decimation hold-out oracle pins the parsed-text versus sample-backed 3D difference at no more than 4.020965667248365e-8 m over interior held-out 5-minute records bracketed by 15-minute nodes.

Errors:

Source§

impl Sp3

Source

pub fn precise_interpolant_store_bytes( &self, ) -> Result<Vec<u8>, PreciseInterpolantStoreError>

Build the fitted precise-ephemeris interpolant artifact for this product.

Source

pub fn write_precise_interpolant_store( &self, output_path: impl AsRef<Path>, ) -> Result<(), PreciseInterpolantStoreError>

Build and write the fitted precise-ephemeris interpolant artifact for this product.

Source§

impl Sp3

Source

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

pub fn precise_ephemeris_state_samples( &self, ) -> Vec<PreciseEphemerisStateSample>

Extract this product as ECEF position and velocity samples.

Samples are emitted only for epochs where the parsed product carries a real velocity record. Position-only SP3 products therefore return an empty vector rather than fabricating zero velocity.

Source§

impl Sp3

Source

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

Source

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.

Source

pub fn parse_str(text: &str) -> Result<Self>

Parse from a &str (the UTF-8 fast path used by Sp3::parse).

Source

pub fn satellites(&self) -> &[GnssSatelliteId]

The satellites present in this product (from the header satellite list).

Source

pub fn epoch_count(&self) -> usize

Number of parsed epochs.

Source

pub fn declared_epoch_count(&self) -> u64

Epoch count written in SP3 header line 1.

This can differ from Sp3::epoch_count when a truncated or otherwise inconsistent file is parsed through the deliberately permissive base parser. Use validate_exact_sp3 when those fields must agree.

Source

pub fn declared_start_j2000_s(&self) -> Option<f64>

Start epoch written in SP3 header line 1, as seconds since J2000 in the product time scale.

The base parser historically ignored these civil fields, so malformed values are represented as None rather than changing Sp3::parse compatibility. Exact product validation requires Some and checks it against both the request and the first parsed epoch.

Source

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.

Source

pub fn states_at( &self, epoch_index: usize, ) -> Result<&BTreeMap<GnssSatelliteId, Sp3State>>

All (satellite, state) pairs recorded at epoch_index, in ascending satellite order.

Source

pub fn prediction_summary(&self) -> Sp3PredictionSummary

Aggregate the per-record SP3 orbit/clock prediction flags by epoch and compute the contiguous observed-through boundary.

This uses the actual P flags carried by position records; it never assumes a fixed ultra-rapid observed duration. Individual cell flags remain available through Sp3::state and Sp3::states_at.

Trait Implementations§

Source§

impl Clone for Sp3

Source§

fn clone(&self) -> Sp3

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Sp3

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl EphemerisSource for Sp3

Source§

fn position_clock_at_j2000_s( &self, sat: GnssSatelliteId, t_j2000_s: f64, ) -> Option<([f64; 3], f64)>

ECEF position (m) and satellite clock offset (s) for sat at t_j2000_s.
Source§

impl FromStr for Sp3

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
Source§

impl ObservableEphemerisSource for Sp3

Source§

fn observable_state_at_j2000_s( &self, sat: GnssSatelliteId, t_j2000_s: f64, ) -> Result<ObservableState, ObservablesError>

ECEF position and optional satellite clock at seconds since J2000.
Source§

fn observable_states_at_j2000_s( &self, satellites: &[GnssSatelliteId], epochs_j2000_s: &[f64], ) -> Result<ObservableStateBatch, ObservablesError>

ECEF states for parallel satellite and epoch arrays. Read more
Source§

fn observable_states_at_shared_j2000_s( &self, satellites: &[GnssSatelliteId], epoch_j2000_s: f64, ) -> ObservableStateBatch

ECEF states for many satellites at one shared epoch. Read more
Source§

impl PartialEq for Sp3

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl RinexSppAssemblySource for Sp3

Source§

fn rinex_spp_broadcast_corrections(&self) -> RinexSppBroadcastCorrections

Broadcast correction metadata available to RINEX SPP assembly.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.