dycove.sim.simulation_data.SimulationTimeState

class dycove.sim.simulation_data.SimulationTimeState(eco_year: int, ets: int, sim_time: float, sim_time_unit: str, n_ets: int, veg_interval: int, hydro_interval: int, veg_active: bool, morfac: int | None = None, ecofac: int | None = None, refdate: datetime = <factory>, hydrotime_seconds: int = 0)[source]

Tracks and manages simulation time state variables.

This class handles both the hydrodynamic and eco-morphodynamic time scales, including conversions between them.

eco_year

Current ecological year in the simulation.

Type:

int

ets

Current ecological time step.

Type:

int

sim_time

Simulation time in units given by sim_time_unit.

Type:

float

sim_time_unit

Unit of sim_time. Must be either ‘hydrodynamic days’ or ‘eco-morphodynamic years’.

Type:

str

n_ets

Number of ecological time steps per year.

Type:

int

veg_interval

Time interval (in seconds) between vegetation updates.

Type:

int

hydro_interval

Time interval (in seconds) between hydrodynamic updates (updates to HydrodynamicStats).

Type:

int

veg_active

Flag if vegetation is active.

Type:

bool

morfac

Morphological acceleration factor from the morphodynamic model.

Type:

int

vegfac

Vegetation acceleration factor. If None, it is computed automatically.

Type:

int, optional

refdate

Reference start date of the simulation.

Type:

datetime

hydrotime_seconds

Accumulated hydrodynamic simulation time in seconds.

Type:

int

Computed Attributes
-------------------
days_per_year

Implied number of days per ecological year.

Type:

float

hydro_sim_days

Total hydrodynamic days elapsed in the simulation.

Type:

float

veg_sim_years

Total eco-morphodynamic years elapsed.

Type:

float

time_0

Wall-clock timestamp of simulation start.

Type:

float

times_elapsed

List of elapsed wall-clock times at updates.

Type:

list

n_veg_steps

Total number of ecological steps in the simulation.

Type:

int

n_hydro_substeps

Number of hydrodynamic steps per ecological step.

Type:

int

n_hydro_steps

Number of loops for non-vegetation simulations.

Type:

int

hydrotime_date

Current simulation date based on hydrodynamic time.

Type:

datetime

__init__(eco_year: int, ets: int, sim_time: float, sim_time_unit: str, n_ets: int, veg_interval: int, hydro_interval: int, veg_active: bool, morfac: int | None = None, ecofac: int | None = None, refdate: datetime = <factory>, hydrotime_seconds: int = 0) None

Methods

__init__(eco_year, ets, sim_time, ...)

advance_time(seconds)

compute_days_per_year()

Compute the implied 'days per year' from ecofac, veg_interval, and n_ets.

compute_ecofac()

Determine ecological acceleration factor, prioritizing: model morfac > input value > derived value.

compute_step_counts()

compute_time_conversions()

Convert between hydrodynamic days and eco-morphodynamic years.

update_ets()

Attributes

ecofac

hydrotime_seconds

morfac

vegtime_date

eco_year

ets

sim_time

sim_time_unit

n_ets

veg_interval

hydro_interval

veg_active

refdate

days_per_year

hydro_sim_days

veg_sim_years

time_0

times_elapsed

n_veg_steps

n_hydro_substeps

n_hydro_steps

hydrotime_date

__post_init__()[source]

Initialize computed attributes and validate inputs.

compute_days_per_year()[source]

Compute the implied ‘days per year’ from ecofac, veg_interval, and n_ets. Validate that the result is reasonable (350-380 days).

compute_ecofac()[source]

Determine ecological acceleration factor, prioritizing: model morfac > input value > derived value.

compute_time_conversions()[source]

Convert between hydrodynamic days and eco-morphodynamic years.