hmp.open()#

open(path)[source]#

Open what a path stands for: a project, a run, a session or a workspace.

  • a project directory, its project.toml or any folder inside it gives a Project, read only;

  • a run directory gives a Run, partial before its seal (record, checks, inputs and label() refuse);

  • a session directory (sessions/<name>) gives a Session;

  • a workspace root (workspace.toml or projects/) gives a Workspace.

A run and a session are given hydromodpy.project.show.render(), so run.figure(name) draws. They are opened by open_run_dir(path, *, read_config, render) and Session(path, *, read_config, render).

Parameters:

path (PathLike) – The directory or file.

Returns:

Project or Run or Session or Workspace – What the path stands for.

Raises:
  • FileNotFoundError – If the path does not exist, or stands for none of the above.

  • hydromodpy.results.errors.RunNotSealedError – If the path is a run directory that wrote no facts.

Return type:

Project | Run | Session | Workspace

Examples

>>> import hydromodpy as hmp
>>> proj = hmp.open("~/ws/projects/bretagne_k")
>>> run = hmp.open("~/ws/projects/bretagne_k/runs/J0014010-base")