Skip to main content

SeasonMap

Struct SeasonMap 

Source
pub struct SeasonMap {
    pub cycle_type: SeasonCycleType,
    pub seasons: Vec<SeasonDefinition>,
}
Expand description

Complete season definitions including cycle type and all season entries.

The SeasonMap is the resolved representation of the season_definitions section in stages.json. It provides the season-to-calendar mapping consumed by the PAR model and inflow history aggregation.

Source: stages.json season_definitions. See Input Scenarios §1.1.

Fields§

§cycle_type: SeasonCycleType

Cycle type controlling how season IDs map to calendar periods.

§seasons: Vec<SeasonDefinition>

Season entries sorted by id. Length depends on cycle_type: 12 for Monthly, 52 for Weekly, user-defined for Custom.

Implementations§

Source§

impl SeasonMap

Source

pub fn season_for_date(&self, date: NaiveDate) -> Option<usize>

Resolve a calendar date to a season ID using the cycle definition.

This mapping is purely calendar-based and does not depend on the study horizon — a date from 1931 maps to the same season as a date from 2026 if they share the same calendar position. This is essential for PAR model estimation from historical inflow data that predates the study.

Returns None only for Custom cycle types where the date does not fall within any defined season range.

Trait Implementations§

Source§

impl Clone for SeasonMap

Source§

fn clone(&self) -> SeasonMap

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 SeasonMap

Source§

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

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

impl PartialEq for SeasonMap

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for SeasonMap

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