Repository navigation
Modeling Adapters
Package: pyhydra.modeling
pyhydra provides helpers around external hydrological and hydraulic models.
The external models themselves are not bundled, licensed or installed by
pyhydra.
Package: pyhydra.modeling.hydrology
Main APIs include:
- readers for HMS text files:
read_gages,read_met,read_basin,read_subbasin,read_control,read_run; - file generators:
generate_gage,fill_gage,generate_met,generate_met_freq_storm,generate_hms,generate_control,generate_run,generate_py,generate_flow; - execution helper:
run_hms_script; - object-oriented workflow:
HMSModel; - calibration and parameter utilities:
extract_curve_number,calculate_clark_parameters,estimate_muskingum_k,update_basin_file,run_climate_change_scenarios.
HEC-HMS workflows require a local HMS project and compatible HEC-HMS runtime. Result reading is implemented for documented HMS/DSS workflows, but it depends on local DSS libraries and file structure.
Main APIs:
write_precipitation_filewrite_temperature_filewrite_swatplus_precipitation_fileswrite_swatplus_temperature_filesedit_file_ciorun_swatread_channel_sdread_swat_discharge
The SWAT+ adapter writes climate input files, edits simulation periods,
launches an external SWAT+ executable, and reads back per-channel results
(channel_sd_day/mon/yr/aa.txt — flow, sediment and nutrient balances)
through read_channel_sd; read_swat_discharge is a convenience wrapper for
a single channel's discharge (flo_out, m3/s) time series.
Package: pyhydra.modeling.hydraulic
Main APIs:
modify_unsteady_filemodify_plan_filemodify_project_filecreate_flow_seriesrun_hec_rasread_ras_dss_timeseriesread_ras_max_wsel
The HEC-RAS adapter modifies project input files and can execute HEC-RAS
through rascontrol (Windows COM only). read_ras_dss_timeseries reads a
named DSS output series (WSEL, FLOW, STAGE, ...) via hecdss;
read_ras_max_wsel is a convenience wrapper returning its peak value. There
is still no generic reader for 2D spatial results (depth/velocity rasters,
.hdf output) — only the scalar/time-series DSS outputs.
Main APIs:
setup_sfincs_modelrun_sfincs
The current module prepares selected SFINCS inputs and runs the external model. Result analysis is handled in flood-ensemble utilities and notebooks rather than through a generic SFINCS output-reader API.
Main APIs:
generate_manning_combinationsgenerate_manning_combinations_correlatedbuild_manning_ensembleload_flood_ensembleload_sfincs_ensemblecompute_manning_statsflooded_areaspatial_statsmanning_flood_regressionfilter_anomalous_simulations
These utilities support uncertainty analysis of flood maps and Manning roughness ensembles.
| Model/workflow | Prepare inputs | Execute model | Read/analyse outputs |
|---|---|---|---|
| HEC-HMS | Yes | Yes, via local runtime/script | Available for documented DSS/time-series workflows, environment-dependent |
| SWAT+ | Yes, climate files and file.cio
|
Yes, via external executable | Yes, per-channel channel_sd_*.txt (flow, sediment, nutrients) |
| HEC-RAS | Yes, selected plan/unsteady/project edits | Yes, via rascontrol
|
DSS time series (WSEL/FLOW/STAGE) via hecdss; no 2D spatial/raster reader |
| SFINCS | Yes, selected model setup helpers | Yes, via external executable | Ensemble/post-processing helpers, not a generic reader API |
| Manning ensembles | Yes, parameter sampling | Uses external hydraulic simulations | Yes, for flood-map ensemble statistics |
When writing methods sections, use precise wording such as "prepares inputs", "executes through an external model", or "analyses documented outputs", instead of saying all adapters prepare, execute and read results generically.