Accessors#

A hydromodpy.project.Project exposes two accessor properties that scope catalog queries and data introspection to the current project. They keep the facade surface small while staying explicit at the call site.

project.data#

Project.data returns a hydromodpy.project.accessors.ProjectDataAccessor. It lists the input-data variables already loaded for the project and reports the ones still missing from the declared plan.

import hydromodpy as hmp

with hmp.Project("hydromodpy.toml") as p:
    df = p.data.list()          # variables loaded in cache
    todo = p.data.missing()     # variables declared but not loaded

Use this when a workflow step complains about a missing variable, or to confirm that a manual project.load_data(types=...) covered the expected set.

project.runs#

Project.runs returns a hydromodpy.project.accessors.ProjectRunsAccessor. It wraps the project’s SimulationCatalog and pre-filters every query by the current project name.

The accessor exposes four common queries:

  • list() returns a DataFrame summary of every persisted run for the project.

  • find() filters by metadata (solver, status, run name, etc.) and returns a list of Run.

  • latest() returns the most recent Run or None when the project has no recorded run yet.

  • best() selects the run that minimises a metric stored in the catalog.

with hmp.Project("hydromodpy.toml") as p:
    p.simulate(Sy=0.05, name="probe-1")
    p.simulate(Sy=0.08, name="probe-2")

    last = p.runs.latest()
    baselines = p.runs.find(name="probe-1")
    best = p.runs.best("nse")

The accessor returns full Run objects, not just identifiers, so the caller can chain into run.field(...), run.timeseries(...) or hmp.read(run, "head").

See Also#

  • hydromodpy.results.run.Run – per-simulation result view.

  • Catalog patterns – workspace-wide catalog access without a Project.