hmp.run()#
- Command line
hmp run - Returns
RunOutcome,PlanDraft,OverviewResult - Defined in
hydromodpy/project/api.py
-
run(
)[source]#source,*,base=None,set=None,name=None,force=False,fresh=False,resume=None,from_step=None,until_step=None,dry_run=False,frozen=False,no_display=False,headless=False,environment=None,
Run a simulation or an overview.
What comes back follows the workflow of the configuration:
a simulation gives its
RunOutcome, whoseopen()gives the run, orNonewhen no directory was claimed;an overview gives a
OverviewResult;dry_run=Truegives aPlanDraft, with nothing run and nothing written.
A calibration is refused,
calibrate()runs it. A[sites]project is refused too,Project.launchruns it. A simulation identical to a completed run of the project (same resolved configuration, same name) is not computed again: its outcome names the completed run inidentical_toand a warning says so.force=Truecomputes it anyway.- Parameters:
source (Source) – A TOML file, a JSON run request, a document as a mapping or JSON text, a
HydroModPyConfig, or aRunRequest.base (PathLike | None) – The folder the relative paths of the document are read from, and the project the run is written in. A file reads them from the project root above it. A mapping, JSON text or a request object is refused without one.
set (Mapping[str, Any] | None) – Changes of the configuration, by dotted path (
--set) or by a name ofhmp config targets. Sealed inlineage.overrides.name (str | None) – Name of the run.
force (bool) – Compute a run identical to a completed one, and claim a stale case.
fresh (bool) – File what a previous attempt left under
attempts/<k>/and start over.resume (str | None) – Name of an interrupted case to continue in place,
<chain>_w<N>for a window of a chain.from_step (str | None) – Bounds of a partial run, names of pipeline steps.
until_step (str | None) – Bounds of a partial run, names of pipeline steps.
dry_run (bool) – Say what this configuration would run, and run nothing.
frozen (bool) – Require frozen input data references: a project TOML answers to its lockfile, the
config.tomlof a run to the record of that run.no_display (bool) – Draw no figure. Neither enters the identity of the run.
headless (bool) – Draw no figure. Neither enters the identity of the run.
environment (Environment | None) – The environment of the call.
Nonebuilds the default of the machine.
- Returns:
RunOutcome or PlanDraft or OverviewResult or None – See above.
- Raises:
FileNotFoundError – If the TOML path does not exist.
hydromodpy.core.exceptions.ConfigError – If the document fails validation, declares a calibration or a
[sites]project, takes an option its workflow refuses, or comes in memory withoutbase.hydromodpy.core.exceptions.PipelineError – If a step raises.
hydromodpy.core.exceptions.SolverError – If the solver fails.
- Return type:
RunOutcome | PlanDraft | OverviewResult | None
Examples
>>> import hydromodpy as hmp >>> outcome = hmp.run("run_transient_nwt.toml", name="baseline") >>> run = outcome.open() >>> plan = hmp.run("run_transient_nwt.toml", dry_run=True)
Keyword arguments and command-line flags#
The twin command is hmp run.
| Keyword | Default | Command-line flag | Accepted by |
|---|---|---|---|
base | None | --base | every form |
set | None | no flag | every form |
name | None | no flag | every form |
force | False | --force | every form |
fresh | False | --fresh | every form |
resume | None | --resume | every form |
from_step | None | --from | every form |
until_step | None | --until | every form |
dry_run | False | --dry-run | every form |
frozen | False | --frozen | every form |
no_display | False | --no-display | every form |
headless | False | no flag | every form |
environment | None | no flag | every form |
lineage | None | no flag | TOML path, simulation workflow; configuration object |
calibrated_by | None | no flag | TOML path, simulation workflow; configuration object |
replay_of | None | no flag | TOML path, simulation workflow |
strict | False | no flag | TOML path, simulation workflow |
Flags of hmp run with no keyword: --only, --parallel, --case. To get their effect from Python, build the configuration object with the values you want, or write them in the TOML file.