Skip to main content

EopData

Struct EopData 

Source
pub struct EopData {
    pub rows: Vec<EopDataRow>,
    pub strip_offset_leaps: bool,
    pub epoch_scale: Scale,
}
Expand description

Sorted orientation-parameter table for a body.

Interpolate with eop_offset. On Earth, load IERS data and use Dt::to_ut1. For other bodies, load custom rows and call Dt::to_eop / Dt::from_eop with the epoch you computed for that instant.

Fields§

§rows: Vec<EopDataRow>

Sample rows, sorted by ascending EopDataRow::epoch.

Loaders and from_rows keep this order. eop_offset and merge assume it.

§strip_offset_leaps: bool

When true, a ~1 s jump between neighboring offset samples is removed before interpolation (leap-second days on Earth UT1−UTC tables).

Finals2000A / C04 loaders set this true; JplEop2 and Custom set false.

§epoch_scale: Scale

Time scale of each row’s EopDataRow::epoch MJD.

Dt::to_ut1 converts the Dt to this scale before lookup. C04 / Finals2000A → Scale::UTC; JplEop2 and from_rowsScale::TAI. Override with with_epoch_scale.

Implementations§

Source§

impl EopData

Source

pub fn from_rows(rows: Vec<EopDataRow>, strip_offset_leaps: bool) -> Self

Build a table from already-parsed rows (sorted by epoch).

Set strip_offset_leaps true for Earth UT1−UTC-style leap days. epoch_scale defaults to Scale::TAI; chain with_epoch_scale for UTC-indexed tables.

Source

pub fn with_strip_offset_leaps(self, on: bool) -> Self

Source

pub fn with_epoch_scale(self, scale: Scale) -> Self

Source§

impl EopData

Source

pub fn data_from_reader<R: BufRead>( reader: R, format: EopFormat, separator: Separator, ) -> Result<Vec<EopDataRow>, DtErr>

Parse EOP data from any std::io::BufRead (file, network stream, etc.).

Lines starting with # or longer than EopData::MAX_LINE_LEN are skipped. The returned vector is always sorted by epoch.

Source

pub fn data_from_text_file<P: AsRef<Path>>( path: P, format: EopFormat, separator: Separator, ) -> Result<Vec<EopDataRow>, DtErr>

Returns a Vec of EopDataRow from a text file on disk.

§Examples
use deep_time::eop::{EopData, EopFormat, Separator};

let path = "tests/assets/finals.all.iau2000.txt";
let rows = EopData::data_from_text_file(path, EopFormat::Finals2000A, Separator::Whitespace).unwrap();
§See also
Source

pub fn from_text_file<P: AsRef<Path>>( path: P, format: EopFormat, separator: Separator, ) -> Result<Self, DtErr>

Create an EopData by loading from a text file on disk.

§Examples
use deep_time::eop::{EopData, EopFormat, Separator};

let path = "tests/assets/finals.all.iau2000.txt";
let provider = EopData::from_text_file(path, EopFormat::Finals2000A, Separator::Whitespace).unwrap();
Source§

impl EopData

Source

pub const MAX_LINE_LEN: usize = 8192

Maximum accepted length of a single input line when parsing EOP text.

Source

pub fn data_from_str( s: &str, format: EopFormat, separator: Separator, ) -> Result<Vec<EopDataRow>, DtErr>

Parse EOP data from a &str.

Useful when the data is already in memory (embedded resource, downloaded string, etc.).

Source

pub fn data_from_bytes( bytes: &[u8], format: EopFormat, separator: Separator, ) -> Result<Vec<EopDataRow>, DtErr>

Parse EOP data from raw bytes.

The bytes are interpreted as UTF-8. Invalid UTF-8 sequences result in an empty string (and therefore an error).

Source

pub fn from_str( s: &str, format: EopFormat, separator: Separator, ) -> Result<Self, DtErr>

Create an EopData from a string slice.

Source

pub fn from_bytes( bytes: &[u8], format: EopFormat, separator: Separator, ) -> Result<Self, DtErr>

Create an EopData from raw bytes.

Source

pub fn merge(&mut self, other: &EopData, add_rows: bool, overwrite_rows: bool)

Merge rows from other into self by epoch.

For each row in other:

  • Same epoch already in self: if overwrite_rows, replace offset / pm_x / pm_y; otherwise leave self’s row as-is.
  • Epoch not in self: if add_rows, insert the row (table stays sorted by epoch); otherwise skip it.

Both flags may be true or only one. If both are false, this is a no-op. strip_offset_leaps and epoch_scale on self are unchanged.

§Example
use deep_time::eop::{EopData, EopFormat, Separator};

let mut eop = EopData::from_text_file(
    "tests/assets/EOP_20u24_C04_one_file_1962-now.txt",
    EopFormat::C04,
    Separator::Whitespace,
).unwrap();
let finals = EopData::from_text_file(
    "tests/assets/finals.all.iau2000.txt",
    EopFormat::Finals2000A,
    Separator::Whitespace,
).unwrap();
// Keep C04 on overlap; append Finals prediction days only.
eop.merge(&finals, true, false);
Source

pub fn with_merge( self, other: &EopData, add_rows: bool, overwrite_rows: bool, ) -> Self

Convenience: merge consuming self.

Source

pub fn eop_offset(&self, epoch: Real) -> Option<EopOffset>

Interpolated orientation parameters at epoch.

Linear blend between neighboring samples. If strip_offset_leaps is set, a ~1 s jump in offset between those samples is removed before blending. Outside the table range the nearest endpoint is held. Returns None if empty.

Trait Implementations§

Source§

impl Clone for EopData

Source§

fn clone(&self) -> EopData

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 EopData

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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 = !

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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more