cli¶
cli
¶
CLI entry point for hydro-param.
Provide the top-level hydro-param console script and all subcommands
using the cyclopts framework. The CLI is the primary user interface for
configuration-driven hydrologic parameterization workflows.
Commands
hydro-param init [project-dir]
Scaffold a project directory with standard layout.
hydro-param datasets list
List available datasets grouped by category.
hydro-param datasets info
Notes
All model-specific logic (unit conversions, variable renaming, derivation)
lives in plugin modules (derivations/pywatershed.py,
formatters/pywatershed.py). The generic run command produces a raw
Standardized Internal Representation (SIR); the pywatershed run command
adds a second phase of model-specific post-processing.
See Also
docs/design.md : Full architecture and CLI specification (§11.9). hydro_param.pipeline : Generic 5-stage pipeline orchestrator. hydro_param.derivations.pywatershed : pywatershed derivation plugin.
datasets_list
¶
Display all registered datasets grouped by category.
Print a formatted table of datasets to stdout, showing name, description, access strategy, and availability status. Datasets are grouped under their category heading (e.g., Topography, Land Cover, Soils).
| PARAMETER | DESCRIPTION |
|---|---|
registry
|
Path to a custom registry YAML file or directory. When omitted, the bundled default registry is used.
TYPE:
|
Source code in src/hydro_param/cli.py
datasets_info
¶
Show full details for a single dataset.
Print comprehensive information including description, strategy, CRS, variables (continuous and derived), download instructions, and a pipeline config snippet for easy copy-paste.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Dataset name as it appears in the registry (e.g.,
TYPE:
|
registry
|
Path to a custom registry YAML file or directory. When omitted, the bundled default registry is used.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SystemExit
|
If the dataset name is not found in the registry (exit code 1). |
Source code in src/hydro_param/cli.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
datasets_download
¶
datasets_download(
name: str,
*,
dest: Path | None = None,
years: str | None = None,
variables: str | None = None,
registry: Path | None = None,
) -> None
Download dataset files via the AWS CLI.
Fetch remote dataset files (typically from S3) using aws s3 cp.
Supports single-file, multi-file (explicit file list), and
template-based (URL pattern with year/variable placeholders)
download configurations.
When run inside an initialised hydro-param project (detected via
.hydro-param marker), files are automatically routed to the
data/<category>/ subdirectory.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Dataset name as it appears in the registry (e.g.,
TYPE:
|
dest
|
Destination directory for downloaded files. When omitted inside
an initialised project, files are routed to
TYPE:
|
years
|
Comma-separated list of years to download (multi-file datasets).
Example:
TYPE:
|
variables
|
Comma-separated list of variables/products to download
(multi-file datasets). Example:
TYPE:
|
registry
|
Path to a custom registry YAML file or directory. When omitted, the bundled default registry is used.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SystemExit
|
If the dataset is not found, has no download info, AWS CLI is not installed, or a download fails (exit code 1). |
Notes
Requires the AWS CLI (aws) to be installed and available on
PATH. For requester-pays buckets (e.g., s3://usgs-landcover),
valid AWS credentials are needed. Anonymous access is used otherwise.
Source code in src/hydro_param/cli.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
run_cmd
¶
Execute the generic parameterization pipeline.
Run stages 1--5 (resolve fabric, resolve datasets, compute weights,
process datasets, normalize output) to produce a normalized
Standardized Internal Representation (SIR) with canonical variable
names and converted units. This command is model-agnostic; use pywatershed run for
model-specific post-processing.
| PARAMETER | DESCRIPTION |
|---|---|
config
|
Path to the pipeline YAML config file (e.g.,
TYPE:
|
registry
|
Path to a custom dataset registry YAML file or directory. When omitted, the bundled default registry is used.
TYPE:
|
resume
|
Enable manifest-based resume: skip datasets whose outputs are already complete and whose config fingerprint has not changed. Compares SHA-256 fingerprints of dataset request + registry entry + processing options.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SystemExit
|
If the pipeline raises any exception (exit code 1). |
See Also
hydro_param.pipeline.run_pipeline_from_config : Pipeline entry point. hydro_param.manifest : Manifest-based resume logic.
Source code in src/hydro_param/cli.py
init_cmd
¶
init_cmd(
project_dir: Path = Path("."),
*,
force: bool = False,
registry: Path | None = None,
) -> None
Scaffold a new hydro-param project directory.
Create a standard directory structure with a template pipeline
configuration, data directories organised by dataset category
(e.g., data/topography/, data/soils/), and a .gitignore.
A .hydro-param marker file is written to identify the project
root for automatic path resolution in other commands (e.g.,
datasets download auto-routes files to data/<category>/).
| PARAMETER | DESCRIPTION |
|---|---|
project_dir
|
Directory to initialise. Defaults to the current directory.
TYPE:
|
force
|
Re-initialise an existing project: create missing directories
and refresh the marker file, but preserve any existing
TYPE:
|
registry
|
Path to a custom registry YAML for category discovery. When
omitted, the bundled default registry is used to determine
which
TYPE:
|
See Also
hydro_param.project.init_project : Implementation of project scaffolding.
Source code in src/hydro_param/cli.py
pws_run_cmd
¶
Generate a complete pywatershed model setup from existing SIR output.
Consume pre-built SIR (Standardized Internal Representation) output
produced by hydro-param run and derive all PRMS parameters needed
for a pywatershed (NHM-PRMS) simulation.
This command executes Phase 2 only -- it does not re-run the
generic pipeline. Run hydro-param run pipeline.yml first to
produce SIR output, then run this command to derive model-specific
parameters.
Output files produced:
parameters.nc-- static PRMS parameters loadable bypws.Parameters.from_netcdf()forcing/<var>.nc-- one file per climate variable (prcp, tmax, tmin) in PRMS units (inches, degrees F)soltab.nc-- potential solar radiation tables (nhru x 366)control.yml-- simulation time period configuration
| PARAMETER | DESCRIPTION |
|---|---|
config
|
Path to a pywatershed run config YAML file (v4.0). See
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SystemExit
|
If config loading, SIR loading, or derivation fails (exit code 1). |
See Also
hydro_param.pywatershed_config.PywatershedRunConfig : Config schema. hydro_param.derivations.pywatershed.PywatershedDerivation : Derivation plugin. hydro_param.formatters.pywatershed.PywatershedFormatter : Output formatter.
Source code in src/hydro_param/cli.py
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 | |
pws_validate_cmd
¶
Validate a pywatershed parameter file against metadata constraints.
Check that required PRMS parameters are present and that values
fall within the valid ranges defined in the bundled
parameter_metadata.yml. Print a summary of issues found or
a success message.
| PARAMETER | DESCRIPTION |
|---|---|
param_file
|
Path to a pywatershed parameter NetCDF file (e.g.,
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SystemExit
|
If the file cannot be opened (exit code 1) or validation finds any issues (exit code 1). |
See Also
PywatershedFormatter.validate : Underlying validation logic.
Source code in src/hydro_param/cli.py
gfv11_download_cmd
¶
Download GFv1.1 NHM data layer rasters from ScienceBase.
Stream-download and unzip the original CONUS-wide rasters used to parameterize NHM v1.1 from two public ScienceBase items (~15 GB total). Files are organised into categorised subdirectories (soils, land_cover, topo, etc.) under output_dir.
Existing extracted files are skipped automatically. Zip archives are cleaned up after successful extraction.
| PARAMETER | DESCRIPTION |
|---|---|
output_dir
|
Shared data directory for downloaded rasters. Subdirectories
(
TYPE:
|
items
|
Which ScienceBase item(s) to download. One of
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
SystemExit
|
If items is not a valid choice or a fatal download error occurs (exit code 1). |
See Also
hydro_param.gfv11 : Download implementation module.
Source code in src/hydro_param/cli.py
main
¶
Invoke the cyclopts CLI application.
This is the entry point registered as the hydro-param console
script in pyproject.toml. Delegates to the cyclopts App
for argument parsing and command dispatch.