open#

hydromodpy.open(workspace, *, create=False)[source]#

Open a HydroModPy project catalog.

The single door to a workspace catalog: returns a hydromodpy.results.catalog.SimulationCatalog backed by catalog.duckdb. It exposes object access (latest, best, find, cat[ref]), tabular access (frame, sql, list_simulations), schema discovery (describe, tables, columns, variables, metrics, stations), per-id reads (read), and the simulation writers used by the workflow engine.

Return type:

Any

Parameters:

Parameters#

workspace

Project directory holding catalog.duckdb (or a direct path to the .duckdb file).

create

False (default) raises FileNotFoundError when no catalog exists yet (no phantom catalog is created). True opens and initialises an empty catalog.

Returns#

hydromodpy.results.catalog.SimulationCatalog

Catalog handle for the project.

Raises#

FileNotFoundError

If no catalog.duckdb is found and create is False.

hydromodpy.core.exceptions.CatalogError

If the DuckDB catalog file is locked, corrupted, or unreadable.

Examples#

>>> import hydromodpy as hmp
>>> cat = hmp.open("~/ws/projects/naizin")  
>>> cat.latest()  

See Also#

hydromodpy.index

Machine-wide federation across registered workspaces.

param workspace:

type workspace:

Any

param create:

type create:

bool