hydromodpy.project.facade#
High-level Project API for interactive Python usage.
Construct cheap, simulate many. Project(config) only validates the config;
the heavy model phase (geographic delineation, data download, mesh) runs lazily
on the first Project.simulate() (or the first access to a runtime
accessor), or eagerly via Project.prepare() / the per-phase verbs. The
TOML-driven workflow (hmp run) is unchanged; this module is its
programmatic equivalent.
Project is intentionally not the execution engine. Ordered execution and
resume live in hydromodpy.workflow.runner.Pipeline. Both routes use the
same workflow.steps helpers so interactive notebooks and full pipeline runs
do not fork the scientific logic.
The facade is composed of three cohesive helpers:
hydromodpy.project.runner.ProjectRunner(project._runner): internal runner backingsimulate/calibrate.hydromodpy.project.catalog.ProjectCatalog(project._catalog): catalog access (store,runs,data) and lifecycle (close).hydromodpy.project.phases: model-phase verbs that mutate the project directly (configure,setup_workspace,build_geographic,load_data,build_mesh).
Example#
import hydromodpy as hmp
project = hmp.Project("hydromodpy.toml") # cheap: validates config
run = project.simulate(Sy=0.05, K=5e-5, name="baseline") # builds, then runs
wt = run.field("watertable_depth", timestep=12)
# Parameter sweep: one simulate() per value
for sy in (0.01, 0.05, 0.1):
project.simulate(name=f"sy_{sy}", Sy=sy)
project.close()
Classes
|
Setup-once, run-many interface for HydroModPy simulations. |