hmp.run()#

run(
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,
)[source]#

Run a simulation or an overview.

What comes back follows the workflow of the configuration:

  • a simulation gives its RunOutcome, whose open() gives the run, or None when no directory was claimed;

  • an overview gives a OverviewResult;

  • dry_run=True gives a PlanDraft, with nothing run and nothing written.

A calibration is refused, calibrate() runs it. A [sites] project is refused too, Project.launch runs 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 in identical_to and a warning says so. force=True computes it anyway.

Parameters:
  • source (Source) – A TOML file, a JSON run request, a document as a mapping or JSON text, a HydroModPyConfig, or a RunRequest.

  • 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 of hmp config targets. Sealed in lineage.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.toml of 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. None builds 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 without base.

  • 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.

KeywordDefaultCommand-line flagAccepted by
baseNone--baseevery form
setNoneno flagevery form
nameNoneno flagevery form
forceFalse--forceevery form
freshFalse--freshevery form
resumeNone--resumeevery form
from_stepNone--fromevery form
until_stepNone--untilevery form
dry_runFalse--dry-runevery form
frozenFalse--frozenevery form
no_displayFalse--no-displayevery form
headlessFalseno flagevery form
environmentNoneno flagevery form
lineageNoneno flagTOML path, simulation workflow; configuration object
calibrated_byNoneno flagTOML path, simulation workflow; configuration object
replay_ofNoneno flagTOML path, simulation workflow
strictFalseno flagTOML 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.