CssiData
Defined in: cssi.rs:90
Available on crate feature
alloconly.
pub struct CssiDataParsed CSSI space weather data.
Non-empty, at most one record per calendar day, ascending by date. Days may
be missing: a hand-trimmed file (like this repository’s own test fixture)
covers a few disjoint intervals, so CssiSpaceWeather resolves the 3-hour
Ap history and the previous day’s F10.7 by calendar date rather than by array
position. Every constructor, including CssiData::truncate_after, goes
through CssiData::from_records.
Methods
Section titled “Methods”parse()
Section titled “parse()”fn parse(text: &str) -> [Result<Self, CssiParseError>](https://doc.rust-lang.org/std/result/enum.Result.html)
Parse CSSI space weather data from text content.
Accepts the full content of SW-Last5Years.txt or SW-All.txt. Parses OBSERVED and DAILY_PREDICTED sections. Records are sorted by date after parsing; duplicates from overlapping sections are resolved in favor of OBSERVED data.
fn len(&self) -> usize
Number of daily records.
is_empty()
Section titled “is_empty()”fn is_empty(&self) -> bool
Whether the dataset is empty.
date_range()
Section titled “date_range()”fn date_range(&self) -> [Option<(Epoch, Epoch)>](https://doc.rust-lang.org/std/option/enum.Option.html)
Date range as (first_epoch, last_epoch).
records()
Section titled “records()”fn records(&self) -> &[CssiDailyRecord]
Access the underlying records.
truncate_after()
Section titled “truncate_after()”fn truncate_after(&self, epoch: &Epoch) -> [Result<Self, CssiParseError>](https://doc.rust-lang.org/std/result/enum.Result.html)
Return a new CssiData containing only records up to (and including)
the given epoch’s calendar day.
Useful for simulating “what data was available at time T” by discarding
future observations. When used with CssiSpaceWeather in Clamp mode,
queries after the cutoff will repeat the last available day’s values.
Returns CssiParseError::NoData when the cutoff precedes the whole
dataset: an empty dataset would make every subsequent query panic, so it
is not representable as a CssiData.