hydromodpy.workflow.internals.dependencies#

Compute which pipeline step is the earliest affected by a set of overrides.

When a calibration overrides a field deep in the config (e.g. flow.param.K.field.value), only the steps whose config_sections consume that part of the tree need to re-run. The earlier (setup) steps give the same result for every trial and can be executed once, then shared across the ask/tell loop.

earliest_affected_step performs a longest-prefix match between every override path and every step’s declared config_sections. The first step (lowest index) that owns a matching section wins.

All steps in steps[earliest:] must re-run, even those with empty config_sections, because they consume the output state produced by the re-run predecessor.

Functions

earliest_affected_step(override_paths, steps)

Return the lowest step index affected by any of override_paths.