Objects and how they relate#

A run is a folder on disk: field arrays in Zarr, tables in Parquet, under <project>/runs/<name>/. The DuckDB index of the project is derived from those folders and can be rebuilt with hmp catalog reindex. The objects below are the ways Python looks at that folder.

ObjectWhat it isYou get it from
CatalogRead-only view of a project index.built by the other objects
RunRead one persisted simulation from a HydroModPy catalog.hmp.open(), Project.rerun(), Project.simulate(), Lab.run(), RunSet.best(), RunSet.worst(), Catalog.best(), Catalog.latest(), Catalog.worst(), RunOutcome.open()
RunSetCollection view over several simulations from one catalog.Catalog.find(), Catalog.rank()
ProjectSetup-once, run-many interface for HydroModPy simulations.hmp.open()
LabBuild, look at, change and solve a model in memory, one step at a time.built by the other objects
SessionOne calibration session, read from its directory.hmp.open(), RunOutcome.open()
WorkspaceRead-only view of a workspace: its projects and the sealed runs they hold.hmp.open()
RunOutcomeWhat a finished run says, read from its directory.hmp.run(), hmp.replay(), hmp.status(), hmp.status()
PlanDraftA plan before it is written: its cases, and what is wrong with them.hmp.run(), Project.plan(), Project.simulate()
OverviewResultWhat an overview drew, and where it sealed it.hmp.run()
DiagnosticOne finding of a check, at one key of the document.hmp.check()
CalibrationReportWhat one calibration found, with or without phases.hmp.calibrate()
CalibrationPlanWhat a calibration declares, with nothing run and nothing written.hmp.calibrate()
SpinupResultOutcome of a spin-up loop.hmp.spinup(), Project.spinup()
StatusReportThe status of every case of the current plan.hmp.status(), Project.status()
ComparisonThe tables of one comparison and the data of its figures.hmp.compare()
PublishedLineOne line of published.jsonl: where a copy went, or where a file goes.hmp.export()
PublishedProjectWhat publish_project wrote, and the runs it left out with the reason.hmp.publish()
ExampleEntryOne cataloged example: what it is, and every file it needs.hmp.example(), hmp.example()
InstallReportWhat one hmp example add actually did.hmp.example(), hmp.example()
DoctorReportThe state of the machine: versions, packages and solver executables.hmp.doctor()

hmp.open gives what a path stands for: a Project, a Run, a Session or a Workspace. A Run reads the folder it names, and the seal in it says what the run is; the index only finds it.

A Lab is the exception: it holds a Project and builds and tries a model in memory, step by step. It writes no run folder while you work, and lab.run keeps the result as a run like any other.

What Run.read returns#

run.read(name) looks for name among the fields of the run, then among its time series, then among its geographic features. Each nature of variable gives one type, and time= never changes it:

NatureTypeReading it
a field gives an xarray.DataArray with the dimensions time, layer and cell it has. One period in time removes time.
a time series gives a pandas.Series indexed by date. It takes sel and no time.
a geographic feature gives a geopandas.GeoDataFrame, one row per shape. It takes no time.
"particles" gives a pandas.DataFrame, one row per recorded position. It takes no time.

To read by reference (id, unique prefix or name) instead of from a Run, call proj.store.read(ref, name) on the Catalog of the project.

Going from one object to the next#

proj = hmp.open("path/to/project")  # Project
run = proj["baseline"]              # Run
runs = proj.runs(site="nancon")     # RunSet: the completed runs of one site
best = runs.best("nse")             # Run, by a metric

The words of the API#

Each word has one meaning, in every function and every object.

Word

Means

Where

run

A Run: one sealed directory under runs/.

run.read(...), run.figure(...), hmp.export(run, ...)

ref

Text that names a run: an id, a unique prefix, a name or a selector such as @latest.

hmp.compare([a, b]).table, proj[ref], proj.store.read(ref, ...)

variable

The name of a field, a series or a feature.

run.read(variable), run.field(variable), run.timeseries(variable)

time

The stress period or periods to read: an index, a date, "first", "last", or for Run.read a slice of indexes.

Run.read, run.field, Run.figure, hmp.export

period

A window of dates: (start, end), or a year as text.

run.timeseries, run.observed, run.budget, hmp.export, sel={"period": ...}

steps

An inclusive range of period indexes, (first, last).

run.budget, proj.store.query_budget

layer

A layer index, 0 for the top layer.

Run.read, run.field, hmp.export

set

Changes of a configuration: a dotted path, the grammar of --set, or a name of hmp config targets.

hmp.run, proj.simulate, proj.plan, hmp.Project.rerun

from_step, until_step

Names of pipeline steps. The names are frozen: hydromodpy.core.pipeline_steps.STEP_NAMES.

hmp.run, proj.simulate

best

One Run, the best by a metric. proj.best_runs gives the table of the best run of each site.

runset.best, session.best, proj.runs().best, proj.store.best

parameters

The table of the parameters of a run, or of a set of runs.

run.parameters, runset.parameters