hydromodpy.core.time.window#

Canonical simulation-time utilities for launcher workflows.

This module is intentionally a single authority for temporal behavior driven by [simulation.time] so launchers, data loaders, and solver builders do not reimplement similar logic with subtle differences.

Key conventions#

  • User input is an inclusive window: [start_datetime, end_datetime].

  • Internal period math is computed on half-open bounds: [start_datetime, end_exclusive).

  • Stress-period lengths are exported in seconds for solver-facing lenper.

  • Coverage checks can enforce one of three policies: error / warn / ignore.

The functions below are pure helpers around these conventions, with explicit validation errors intended to be user-facing.

Functions

apply_explicit_time_window_to_tgrids(cfg)

Apply resolved simulation.time to flow-solver tgrid sections.

build_simulation_time_boundaries(window)

Return half-open simulation boundaries [t0, ..., tN] from one window.

has_flow_simulation_process(cfg)

Return True when the simulation plan declares at least one flow process.

require_flow_simulation_time_grid(cfg)

Return canonical launcher time-grid, enforcing it for flow runs.

resolve_simulation_time_grid(cfg)

Resolve canonical stress periods from simulation.time.

resolve_simulation_time_window(cfg)

Resolve and validate the canonical simulation window.

resolve_simulation_time_window_dates(cfg, *)

Resolve canonical simulation date bounds as YYYY-MM-DD strings.

simulation_time_pandas_frequency(window, *)

Return a pandas-compatible frequency alias for one simulation window.

validate_recharge_coverage(recharge, window)

Validate that recharge covers the canonical simulation window.

Classes

ResolvedSimulationTimeGrid(window, ...[, ...])

Canonical stress-period mesh derived from one resolved window.

ResolvedSimulationTimeWindow(start, end, ...)

Normalized runtime representation of [simulation.time].

ResolvedSteadySimulationTimeGrid([...])

Dedicated steady launcher time representation when [simulation.time] is absent.