Struct TimeLoad

Source
pub struct TimeLoad {
    pub time: Vec<DateTime<FixedOffset>>,
    pub load: Vec<f64>,
}
Expand description

The main struct for the load time series.

Fields§

§time: Vec<DateTime<FixedOffset>>§load: Vec<f64>

Implementations§

Source§

impl TimeLoad

Source

pub fn new(capacity: usize) -> TimeLoad

Initiate a new TimeLoad instance using the given capacity for the time and load vectors

Source

pub fn from_csv<P>(fin: P) -> TimeLoad
where P: AsRef<Path>,

Initiate a TimeLoad from csv setting load to NAN in case of load parsing errors, but panic for datatime errors. Do not check the continuity of the time series and presence of error flags, these are checked separately afterwards

Source

pub fn is_ordered(&self)

Source

pub fn is_ordered_and_continuous(&self)

Source

pub fn fill_missing_with_nan(&self) -> TimeLoad

Fill the datetime gaps with NAN to have continuous datetime. Take a reference to the read TimeLoad and return a new continuous TimeLoad. In fact, build a continuous datetime Vec and then match it with the load Vec? Use the minimum time interval in the data to determine the desired time step for the output.

Source

pub fn replace_bad_datetimes_with_nan( &mut self, bad_datetimes: Vec<DateTime<FixedOffset>>, )

Replace all values measured at the bad datetimes nan. Need to be given as DateTime for correct and easier comparison.

Source

pub fn replace_bad_time_interval_with_nan( &mut self, time_init: NaiveTime, time_stop: NaiveTime, )

Replace all values measured within the time interval with nan. Given in standard time, fixed offset for the chosen timezone.

Source

pub fn replace_outliers_with_nan(&mut self, min_load: f64, max_load: f64)

Set to NAN all the load values that are out of the expected range.

Source

pub fn replace_errors_with_nan(&mut self, max_value: f64)

Consider all the values > max_value as invalid and replace them with NAN. These high values are used for the errors.

Source

pub fn to_csv<P>(self, fout: P)
where P: AsRef<Path>,

Write the datetime and load columns to a csv file at the given path. Use RFC 3339 - ISO 8601 for datetime.

Source

pub fn plot_datetime<P>(&self, fout: P) -> Result<(), Box<dyn Error>>
where P: AsRef<Path>,

Plot the load time series to svg.

Trait Implementations§

Source§

impl Clone for TimeLoad

Source§

fn clone(&self) -> TimeLoad

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TimeLoad

Source§

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

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

impl Display for TimeLoad

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.