hmp data#
$ hmp data [-h] <action> ...Data cache of a workspace and the lockfile of a project
| Command | What it does |
|---|---|
hmp data ls | List the rows of the workspace data cache |
hmp data get | Serve a data request: one file per variable, cut to the extent and period |
hmp data remove | Remove cache rows for a variable/provider/station |
hmp data prune | Drop cache rows older than N days, except the files a run or a lockfile cites |
hmp data lock | Write the lockfile that pins the data of a project, or check the files against it |
hmp data archive | Archive the cache (files, sidecars and lockfile) to a portable file |
hmp data restore | Restore a cache archive into the workspace |
hmp data ls#
$ hmp data ls [-h] [-w WORKSPACE] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] [--variable VARIABLE] [--provider PROVIDER]List the rows of the workspace data cache
| Argument | What it does |
|---|---|
--variable VARIABLE | Filter by variable |
--provider PROVIDER | Filter by provider |
Also takes the shared options --workspace --format --verbosity --quiet --verbose --debug.
Examples
$ hmp data ls $ hmp data ls --variable dem --provider bdalti
Exit codes it sets itself: 10. All exit codes.
hmp data get#
$ hmp data get [-h] [-w WORKSPACE] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] --to DIR [--bbox MINX,MINY,MAXX,MAXY | --mask MASK | --stations STATIONS] [--crs CRS] [--start START] [--end END] [--source SOURCE] [--credentials PATH] [--allow-host HOST] [--max-download-bytes N] REQUEST_OR_VARIABLEServe a data request: one file per variable, cut to the extent and period
| Argument | What it does |
|---|---|
REQUEST_OR_VARIABLE | a request document (.json) or a variable name (e.g. dem, hydrometry) |
--to DIR | folder that receives the files required |
--bbox MINX,MINY,MAXX,MAXY | box in the CRS --crs names. When minx is negative, write '--bbox=-1.17,48.4,-1.0,48.5' (= sign). |
--mask MASK | vector file bounding the request |
--stations STATIONS | comma-separated station codes, for station variables |
--crs CRS | CRS of --bbox, as EPSG:<code> |
--start START | first date of the period (YYYY-MM-DD) |
--end END | last date of the period, kept whole (YYYY-MM-DD) |
--source SOURCE | source to ask, when the variable has several |
Also takes the shared options --workspace --format --verbosity --quiet --verbose --debug --credentials --allow-host --max-download-bytes.
Examples
$ hmp data get dem --source bdalti --to data/dem --bbox 340000,6780000,350000,6790000 --crs EPSG:2154 $ hmp data get precipitation --to data/precipitation --mask catchment.gpkg --start 2015-01-01 --end 2020-12-31 --source sim2
Exit codes it sets itself: 10 14 16. An exception it does not catch ends with the code of its class. All exit codes.
hmp data remove#
$ hmp data remove [-h] [-w WORKSPACE] [-y] [--dry-run] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] [--variable VARIABLE] [--provider PROVIDER] [--station-id STATION_ID] [--delete-files]Remove cache rows for a variable/provider/station
| Argument | What it does |
|---|---|
--variable VARIABLE | Remove the rows of this variable |
--provider PROVIDER | Remove the rows of this provider |
--station-id STATION_ID | Remove the rows of this station |
--delete-files | Also delete the files. Without it only the sidecar goes, and the file is no row |
Also takes the shared options --workspace --yes --dry-run --format --verbosity --quiet --verbose --debug.
Example
$ hmp data remove --variable precipitation --provider sim2 --delete-files -yExit codes it sets itself: 2 10 130. All exit codes.
hmp data prune#
$ hmp data prune [-h] [-w WORKSPACE] [-y] [--dry-run] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] [--older-than OLDER_THAN] [--delete-files]Drop cache rows older than N days, except the files a run or a lockfile cites
| Argument | What it does |
|---|---|
--older-than OLDER_THAN | Age threshold in days (default: 30) |
--delete-files | Also delete the files. Without it only the sidecars go, and the files are no rows |
Also takes the shared options --workspace --yes --dry-run --format --verbosity --quiet --verbose --debug.
Example
$ hmp data prune --older-than 90 --delete-files -yExit codes it sets itself: 2 10 130. All exit codes.
hmp data lock#
$ hmp data lock [-h] [-w WORKSPACE] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] [--project PROJECT] [--check] [--strict] [--to FILE] [--lockfile LOCKFILE]Write the lockfile that pins the data of a project, or check the files against it
| Argument | What it does |
|---|---|
--project PROJECT | Project root owning hydromodpy.lock |
--check | Compare the files on disk with the lockfile instead of writing it |
--strict | With --check: check the files the lockfile names, and refuse a changed schema |
--to FILE | Destination lockfile (when writing) |
--lockfile LOCKFILE | Lockfile to check (with --check) |
Also takes the shared options --workspace --format --verbosity --quiet --verbose --debug.
Examples
$ hmp data lock --project path/to/project $ hmp data lock --check --project path/to/project --strict
Exit codes it sets itself: 2 16. All exit codes.
hmp data archive#
$ hmp data archive [-h] [-w WORKSPACE] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] --to FILEArchive the cache (files, sidecars and lockfile) to a portable file
| Argument | What it does |
|---|---|
--to FILE | Destination archive (.tar / .tar.gz / .tar.zst) required |
Also takes the shared options --workspace --format --verbosity --quiet --verbose --debug.
Example
$ hmp data archive --to data-cache.tar.gzExit codes it sets itself: 10. All exit codes.
hmp data restore#
$ hmp data restore [-h] [-w WORKSPACE] [--format {table,json,csv}] [--verbosity {quiet,normal,verbose,debug} | -q | -v | --debug] [--to DIR] inputRestore a cache archive into the workspace
| Argument | What it does |
|---|---|
input | Archive produced by 'hmp data archive' |
--to DIR | Folder to restore into (default: data/ of the workspace) |
Also takes the shared options --workspace --format --verbosity --quiet --verbose --debug.
Example
$ hmp data restore data-cache.tar.gzExit codes it sets itself: 10. All exit codes.