hmp data#

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

Data cache of a workspace and the lockfile of a project

CommandWhat it does
hmp data lsList the rows of the workspace data cache
hmp data getServe a data request: one file per variable, cut to the extent and period
hmp data removeRemove cache rows for a variable/provider/station
hmp data pruneDrop cache rows older than N days, except the files a run or a lockfile cites
hmp data lockWrite the lockfile that pins the data of a project, or check the files against it
hmp data archiveArchive the cache (files, sidecars and lockfile) to a portable file
hmp data restoreRestore 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

ArgumentWhat it does
--variable VARIABLEFilter by variable
--provider PROVIDERFilter 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_VARIABLE

Serve a data request: one file per variable, cut to the extent and period

ArgumentWhat it does
REQUEST_OR_VARIABLEa request document (.json) or a variable name (e.g. dem, hydrometry)
--to DIRfolder that receives the files required
--bbox MINX,MINY,MAXX,MAXYbox in the CRS --crs names. When minx is negative, write '--bbox=-1.17,48.4,-1.0,48.5' (= sign).
--mask MASKvector file bounding the request
--stations STATIONScomma-separated station codes, for station variables
--crs CRSCRS of --bbox, as EPSG:<code>
--start STARTfirst date of the period (YYYY-MM-DD)
--end ENDlast date of the period, kept whole (YYYY-MM-DD)
--source SOURCEsource 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

ArgumentWhat it does
--variable VARIABLERemove the rows of this variable
--provider PROVIDERRemove the rows of this provider
--station-id STATION_IDRemove the rows of this station
--delete-filesAlso 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 -y

Exit 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

ArgumentWhat it does
--older-than OLDER_THANAge threshold in days (default: 30)
--delete-filesAlso 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 -y

Exit 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

ArgumentWhat it does
--project PROJECTProject root owning hydromodpy.lock
--checkCompare the files on disk with the lockfile instead of writing it
--strictWith --check: check the files the lockfile names, and refuse a changed schema
--to FILEDestination lockfile (when writing)
--lockfile LOCKFILELockfile 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 FILE

Archive the cache (files, sidecars and lockfile) to a portable file

ArgumentWhat it does
--to FILEDestination 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.gz

Exit 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] input

Restore a cache archive into the workspace

ArgumentWhat it does
inputArchive produced by 'hmp data archive'
--to DIRFolder 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.gz

Exit codes it sets itself: 10. All exit codes.