hmp example#

Uses hmp.example().

$ hmp example [-h] <action> ...

List the shipped examples and install one, several or all into a workspace

CommandWhat it does
hmp example listList the examples this build ships, and what is missing from the cache
hmp example showShow one example file by file, each marked cached or missing
hmp example addFetch one, several or every example, verify the files, and write them into a workspace

hmp example list#

$ hmp example list [-h] [-w WORKSPACE] [--format {table,json,csv}]

List the examples this build ships, and what is missing from the cache

Also takes the shared options --workspace --format.

Examples

$ hmp example list
$ hmp example list --format json

hmp example show#

$ hmp example show [-h] [-w WORKSPACE] [--format {table,json,csv}] example_id

Show one example file by file, each marked cached or missing

ArgumentWhat it does
example_idExample id, as listed by 'hmp example list'

Also takes the shared options --workspace --format.

Example

$ hmp example show example_id

hmp example add#

$ hmp example add [-h] [-w WORKSPACE] [--format {table,json,csv}] [--all] [--ref REF] [--force] [example_id ...]

Fetch one, several or every example, verify the files, and write them into a workspace

ArgumentWhat it does
example_idOne or more example ids, as listed by 'hmp example list'
--allInstall every example this build ships
--ref REFGit ref to fetch from (default: v2.0.1)
--forceGo past the refusal: overwrite files whose content differs from the manifest

Also takes the shared options --workspace --format.

Each example becomes a project of the workspace, projects/<NN>_<name>/, with its TOML files, its Python script and its README. Its data go to the shared data/ folder of the workspace. Every id is checked before the first download.

-w takes a workspace root or a project inside it; without it, the workspace that holds the current directory. It has to exist: run `hmp workspace init` first.

Files are cached by content under <cache>/examples/blobs/, so the 90 MiB regional DEM is downloaded once and every later example that reads it costs nothing. A command stopped halfway can be run again: it fetches only what is still missing.

Fetched from https://raw.githubusercontent.com/HydroModPy/HydroModPy/<ref>/<path>, with <ref> defaulting to v<version> of the installed HydroModPy. Set HMP_EXAMPLES_SOURCE to replace that whole prefix with another URL or a local directory, for an offline install or a test against a checkout; when it is set, --ref no longer applies.

Examples

$ hmp example add 04
$ hmp example add 00 07 08 -w ~/hydromodpy
$ hmp example add --all

Exit codes it sets itself: 2 10. An exception it does not catch ends with the code of its class. All exit codes.