#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Season {
NorthernSpring,
NorthernSummer,
NorthernAutumn,
NorthernWinter,
}
pub struct SeasonalState {
pub ls_deg: f64,
pub season_north: Season,
pub season_south: Season,
pub solar_declination_deg: f64,
pub sub_solar_latitude_deg: f64,
}
pub fn season_at(ls_deg: f64) -> SeasonalState {
let ls = ls_deg % 360.0;
let season_north = match ls {
l if l < 90.0 => Season::NorthernSpring,
l if l < 180.0 => Season::NorthernSummer,
l if l < 270.0 => Season::NorthernAutumn,
_ => Season::NorthernWinter,
};
let season_south = match season_north {
Season::NorthernSpring => Season::NorthernAutumn,
Season::NorthernSummer => Season::NorthernWinter,
Season::NorthernAutumn => Season::NorthernSpring,
Season::NorthernWinter => Season::NorthernSummer,
};
let decl = super::solar_position::solar_declination_deg(ls_deg);
SeasonalState {
ls_deg: ls,
season_north,
season_south,
solar_declination_deg: decl,
sub_solar_latitude_deg: decl,
}
}
pub fn northern_vernal_equinox_ls() -> f64 {
0.0
}
pub fn northern_summer_solstice_ls() -> f64 {
90.0
}
pub fn northern_autumnal_equinox_ls() -> f64 {
180.0
}
pub fn northern_winter_solstice_ls() -> f64 {
270.0
}
pub fn perihelion_ls() -> f64 {
251.0
}
pub fn aphelion_ls() -> f64 {
71.0
}
pub fn irradiance_season_ratio() -> f64 {
let e = crate::ECCENTRICITY;
let ratio = (1.0 + e) / (1.0 - e);
ratio * ratio
}
pub fn dust_storm_season_start_ls() -> f64 {
180.0
}
pub fn dust_storm_season_end_ls() -> f64 {
360.0
}
pub fn is_dust_storm_season(ls_deg: f64) -> bool {
let ls = ls_deg % 360.0;
ls >= 180.0
}