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.
| Object | What it is | You get it from |
|---|---|---|
Catalog | Read-only view of a project index. | built by the other objects |
Run | Read 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() |
RunSet | Collection view over several simulations from one catalog. | Catalog.find(), Catalog.rank() |
Project | Setup-once, run-many interface for HydroModPy simulations. | hmp.open() |
Lab | Build, look at, change and solve a model in memory, one step at a time. | built by the other objects |
Session | One calibration session, read from its directory. | hmp.open(), RunOutcome.open() |
Workspace | Read-only view of a workspace: its projects and the sealed runs they hold. | hmp.open() |
RunOutcome | What a finished run says, read from its directory. | hmp.run(), hmp.replay(), hmp.status(), hmp.status() |
PlanDraft | A plan before it is written: its cases, and what is wrong with them. | hmp.run(), Project.plan(), Project.simulate() |
OverviewResult | What an overview drew, and where it sealed it. | hmp.run() |
Diagnostic | One finding of a check, at one key of the document. | hmp.check() |
CalibrationReport | What one calibration found, with or without phases. | hmp.calibrate() |
CalibrationPlan | What a calibration declares, with nothing run and nothing written. | hmp.calibrate() |
SpinupResult | Outcome of a spin-up loop. | hmp.spinup(), Project.spinup() |
StatusReport | The status of every case of the current plan. | hmp.status(), Project.status() |
Comparison | The tables of one comparison and the data of its figures. | hmp.compare() |
PublishedLine | One line of published.jsonl: where a copy went, or where a file goes. | hmp.export() |
PublishedProject | What publish_project wrote, and the runs it left out with the reason. | hmp.publish() |
ExampleEntry | One cataloged example: what it is, and every file it needs. | hmp.example(), hmp.example() |
InstallReport | What one hmp example add actually did. | hmp.example(), hmp.example() |
DoctorReport | The 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:
| Nature | Type | Reading 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 |
|---|---|---|
|
A |
|
|
Text that names a run: an id, a unique prefix, a name or a selector such as |
|
|
The name of a field, a series or a feature. |
|
|
The stress period or periods to read: an index, a date, |
|
|
A window of dates: |
|
|
An inclusive range of period indexes, |
|
|
A layer index, 0 for the top layer. |
|
|
Changes of a configuration: a dotted path, the grammar of |
|
|
Names of pipeline steps. The names are frozen: |
|
|
One |
|
|
The table of the parameters of a run, or of a set of runs. |
|