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: boolWhen 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: ScaleTime 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_rows → Scale::TAI. Override with
with_epoch_scale.
Implementations§
Source§impl EopData
impl EopData
Sourcepub fn from_rows(rows: Vec<EopDataRow>, strip_offset_leaps: bool) -> Self
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.
Sourcepub fn with_strip_offset_leaps(self, on: bool) -> Self
pub fn with_strip_offset_leaps(self, on: bool) -> Self
Set strip_offset_leaps.
Sourcepub fn with_epoch_scale(self, scale: Scale) -> Self
pub fn with_epoch_scale(self, scale: Scale) -> Self
Set epoch_scale.
Source§impl EopData
impl EopData
Sourcepub fn data_from_reader<R: BufRead>(
reader: R,
format: EopFormat,
separator: Separator,
) -> Result<Vec<EopDataRow>, DtErr>
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.
Sourcepub fn data_from_text_file<P: AsRef<Path>>(
path: P,
format: EopFormat,
separator: Separator,
) -> Result<Vec<EopDataRow>, DtErr>
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§impl EopData
impl EopData
Sourcepub const MAX_LINE_LEN: usize = 8192
pub const MAX_LINE_LEN: usize = 8192
Maximum accepted length of a single input line when parsing EOP text.
Sourcepub fn data_from_str(
s: &str,
format: EopFormat,
separator: Separator,
) -> Result<Vec<EopDataRow>, DtErr>
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.).
Sourcepub fn data_from_bytes(
bytes: &[u8],
format: EopFormat,
separator: Separator,
) -> Result<Vec<EopDataRow>, DtErr>
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).
Sourcepub fn from_str(
s: &str,
format: EopFormat,
separator: Separator,
) -> Result<Self, DtErr>
pub fn from_str( s: &str, format: EopFormat, separator: Separator, ) -> Result<Self, DtErr>
Create an EopData from a string slice.
Sourcepub fn from_bytes(
bytes: &[u8],
format: EopFormat,
separator: Separator,
) -> Result<Self, DtErr>
pub fn from_bytes( bytes: &[u8], format: EopFormat, separator: Separator, ) -> Result<Self, DtErr>
Create an EopData from raw bytes.
Sourcepub fn merge(&mut self, other: &EopData, add_rows: bool, overwrite_rows: bool)
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: ifoverwrite_rows, replaceoffset/pm_x/pm_y; otherwise leaveself’s row as-is. - Epoch not in
self: ifadd_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);Sourcepub fn with_merge(
self,
other: &EopData,
add_rows: bool,
overwrite_rows: bool,
) -> Self
pub fn with_merge( self, other: &EopData, add_rows: bool, overwrite_rows: bool, ) -> Self
Convenience: merge consuming self.
Sourcepub fn eop_offset(&self, epoch: Real) -> Option<EopOffset>
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.