derivations.pywatershed¶
pywatershed
¶
pywatershed parameter derivation plugin.
Convert SIR physical properties (zonal statistics of raw geospatial data)
into PRMS/pywatershed model parameters. This module implements the
model-specific derivation pipeline defined in
docs/reference/pywatershed_dataset_param_map.yml, transforming
source-unit geospatial statistics into the internal unit system required
by PRMS (feet, inches, degrees Fahrenheit, acres).
The derivation follows a 15-step DAG. Steps implemented here:
- Geometry --- HRU area (acres) and latitude (decimal degrees)
- Topology --- segment routing (tosegment, hru_segment, seg_length)
- Topography --- elevation (feet), slope (decimal fraction), aspect (degrees) 3b. Segment elevation --- mean channel elevation from 3DEP DEM via InterpGen
- Land cover --- NLCD reclassification to PRMS cov_type, canopy density, imperviousness
- Soils --- gNATSGO/STATSGO2 texture classification and AWC
- Waterbody --- NHDPlus depression storage overlay
- Forcing --- temporal CBH merge (prcp, tmax, tmin)
- Lookup tables --- interception capacities and winter cover density
- Soltab --- potential solar radiation tables (Swift 1976)
- PET --- Jensen-Haise coefficients from climate normals
- Transpiration --- frost-free period timing from monthly tmin
- Routing --- Muskingum routing parameters (K_coef, x_coef, seg_slope, etc.)
- Defaults --- standard PRMS default values and initial conditions
- Calibration seeds --- physically-based initial values for calibration parameters
References
Markstrom, S. L., et al. (2015). PRMS-IV, the Precipitation-Runoff Modeling System, Version 4. USGS Techniques and Methods 6-B7. Regan, R. S., et al. (2018). Description of the National Hydrologic Model Infrastructure. USGS Techniques and Methods 6-B9.
See Also
hydro_param.plugins.DerivationContext : Typed input bundle for derivation. hydro_param.units.convert : Unit conversion dispatch used throughout. hydro_param.solar.compute_soltab : Solar radiation table computation.
PywatershedDerivation
¶
Derive pywatershed/PRMS parameters from SIR physical properties.
Implement the full derivation pipeline defined in
docs/reference/pywatershed_dataset_param_map.yml, converting
source-unit zonal statistics from the Standardized Internal
Representation (SIR) into the ~100+ parameters required by
pywatershed (PRMS-IV in Python).
The derivation follows a directed acyclic graph (DAG) of 15 ordered
steps. Each step is implemented as a private method (e.g.,
_derive_geometry for step 1). Steps execute in dependency order:
later steps may read parameters produced by earlier ones (e.g.,
step 8 reads cov_type from step 4).
This class conforms to the DerivationPlugin protocol defined in
hydro_param.plugins.
| ATTRIBUTE | DESCRIPTION |
|---|---|
name |
Plugin identifier (
TYPE:
|
Notes
PRMS internal units are: feet, inches, degrees Fahrenheit, acres.
All unit conversions from SI source data happen within individual
derivation steps using hydro_param.units.convert.
Lookup tables are loaded lazily from YAML files and cached in
_lookup_cache for the lifetime of the instance.
References
Markstrom, S. L., et al. (2015). PRMS-IV, the Precipitation-Runoff Modeling System, Version 4. USGS Techniques and Methods 6-B7.
See Also
hydro_param.plugins.DerivationContext : Input bundle for derive().
hydro_param.plugins.DerivationPlugin : Protocol this class implements.
hydro_param.formatters.pywatershed : Output formatter for pywatershed.
Source code in src/hydro_param/derivations/pywatershed.py
derive
¶
Derive all pywatershed parameters from the SIR.
Execute the full derivation DAG in dependency order, producing a
single xr.Dataset containing all derivable PRMS parameters.
Steps that lack required input data log warnings and are skipped
gracefully. Parameter overrides from the config are applied last.
| PARAMETER | DESCRIPTION |
|---|---|
context
|
Typed input bundle containing the SIR dataset, target fabric
GeoDataFrame, segment GeoDataFrame, waterbody GeoDataFrame,
temporal forcing datasets, lookup table directory, and
pipeline configuration.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dataset
|
Parameter dataset with PRMS-convention variable names and units.
Dimensions are |
Notes
Step execution order: 1 (geometry) -> 2 (topology) -> 3 (topo) -> 3b (seg_elev) -> 4 (landcover) -> 5 (soils) -> 6 (waterbody) -> 8 (lookups) -> 12 (routing) -> 9 (soltab) -> 10 (PET) -> 11 (transp) -> 13 (defaults) -> 14 (calibration) -> 7 (forcing) -> overrides.
Step 7 (forcing) runs late because it has no downstream dependencies within the static parameter DAG.
Source code in src/hydro_param/derivations/pywatershed.py
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 | |