FrequencyStorm¶
TP-40/Hydro-35 frequency storm hyetograph generation helpers.
hms_commander.FrequencyStorm
¶
FrequencyStorm - Generate TP-40/Hydro-35 hyetographs for HCFCD M3 models.
This module generates hyetographs using the same algorithm as HEC-HMS "Hypothetical Storm → User Specified Pattern" method.
The temporal pattern was extracted from HCFCD M3 Model D (Brays Bayou) HMS output and validated to match HMS to 10^-6 precision for 24-hour storms.
Algorithm
Cumulative pattern scaling (same as HMS User Specified Pattern and Atlas14Storm): 1. Load dimensionless temporal pattern 2. Interpolate cumulative percentage at each time step 3. Scale to total depth 4. Convert cumulative to incremental
HCFCD M3 Model Defaults
- Duration: 24 hours (1440 minutes)
- Time interval: 5 minutes
- Peak position: 67% of duration
- All 21 M3 models use these values for consistency
Time Axis
Output DataFrames include a t=0 zero-sentinel row. Row 0 has hour=0.0 and incremental_depth=0.0; subsequent rows are interval end times, so a 24-hour storm ends at hour=24.0.
Supported Configurations
- Duration: Any duration (validated for 24-hour)
- Intervals: Any interval (5-minute recommended for HCFCD)
- Peak position: Variable (67% default for HCFCD)
Example
from hms_commander import FrequencyStorm
HCFCD M3 compatible (all defaults)¶
hyeto = FrequencyStorm.generate_hyetograph(13.20) print(f"24hr: {len(hyeto)} time steps, peak={hyeto['incremental_depth'].max():.2f}") 24hr: 289 time steps, peak=1.20
Variable duration (6-hour storm)¶
hyeto_6hr = FrequencyStorm.generate_hyetograph(9.10, total_duration_min=360) print(f"6hr: {len(hyeto_6hr)} time steps, peak={hyeto_6hr['incremental_depth'].max():.2f}") 6hr: 73 time steps, peak=1.48
FrequencyStorm
¶
Generate TP-40/Hydro-35 hyetographs using HMS-compatible temporal pattern.
This class provides static methods for generating incremental precipitation hyetographs that match HEC-HMS "Frequency Based Hypothetical" output.
The temporal pattern is a fixed dimensionless distribution that is scaled to the specified 24-hour total depth. This pattern was reverse-engineered from HEC-HMS PRECIP-INC output and validated to match across all AEP storms.
Notes
- The pattern was extracted from HCFCD M3 Model D (Brays Bayou)
- Pattern is valid for 24-hour storms with 5-minute intervals (288 values)
- Pattern can be resampled for different time intervals
- Peak position is configurable (default 67% as per M3 models)
See Also
- Atlas14Storm: For Atlas 14 hyetograph generation
- examples/frequency_storm_validation/FINDINGS.md: Validation details
Source code in hms_commander/FrequencyStorm.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 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 279 280 281 282 283 284 285 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 | |
generate_hyetograph(total_depth_inches, total_duration_min=1440, time_interval_min=5, peak_position_pct=67.0)
staticmethod
¶
Generate a TP-40/Hydro-35 hyetograph using HCFCD M3 model pattern.
This generates an incremental precipitation hyetograph using the same algorithm as HEC-HMS "Hypothetical Storm → User Specified Pattern".
HCFCD M3 Model Defaults (validated configuration): - Duration: 1440 minutes (24 hours) - Time interval: 5 minutes - Peak position: 67% of duration
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
total_depth_inches
|
float
|
Total precipitation depth (inches) RENAMED from 'total_depth' for API consistency across methods |
required |
total_duration_min
|
int
|
Storm duration in minutes (default: 1440 = 24hr) - Default: 1440 min (HCFCD M3 standard) - Validated: 24-hour storms to 10^-6 precision - Supported: Any duration (HMS User Pattern compatible) |
1440
|
time_interval_min
|
int
|
Time step in minutes (default: 5) - Default: 5 min (HCFCD M3 standard) - Supported: Any interval (pattern resampled as needed) |
5
|
peak_position_pct
|
float
|
Percent of duration before peak (default: 67) - Default: 67% (HCFCD M3 standard) - HMS options: 25%, 33%, 50%, 67%, 75% |
67.0
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame with columns: - 'hour': Time in hours from storm start (float) - 'incremental_depth': Precipitation depth for this interval (inches) - 'cumulative_depth': Cumulative precipitation depth (inches) |
DataFrame
|
Length = total_duration_min / time_interval_min + 1 (includes |
DataFrame
|
t=0 sentinel); the final row is the storm duration in hours. |
Example
HCFCD M3 compatible (all defaults)¶
hyeto = FrequencyStorm.generate_hyetograph(total_depth_inches=13.20) print(hyeto.columns.tolist()) ['hour', 'incremental_depth', 'cumulative_depth'] print(f"{len(hyeto)} intervals, total={hyeto['cumulative_depth'].iloc[-1]:.2f} inches") 289 intervals, total=13.20 inches
Variable duration (6-hour storm)¶
hyeto_6hr = FrequencyStorm.generate_hyetograph( ... total_depth_inches=9.10, total_duration_min=360 ... ) print(f"{len(hyeto_6hr)} intervals, total={hyeto_6hr['cumulative_depth'].iloc[-1]:.2f} inches") 73 intervals, total=9.10 inches
Notes
- Algorithm validated against HMS source code (aY.java)
- 24-hour storms validated to 10^-6 precision vs M3 Model D
- Pattern from HCFCD Model D (Brays Bayou) 1% AEP
- Pattern consistent across all AEP values (0.2% to 10%)
Source code in hms_commander/FrequencyStorm.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 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 | |
generate_from_ddf(depths, durations=None, peak_position_pct=67.0, time_interval_min=5)
staticmethod
¶
Generate hyetograph from depth-duration-frequency data.
This method takes the 8 cumulative depths from a TP-40 table and generates a hyetograph using the HMS-compatible temporal pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
depths
|
List[float]
|
Cumulative depths at each standard duration (8 values, inches) Order: 5, 15, 30, 60, 120, 180, 360, 1440 min |
required |
durations
|
Optional[List[int]]
|
Optional custom durations (default: standard TP-40) |
None
|
peak_position_pct
|
float
|
Percent of duration before peak (default 67) |
67.0
|
time_interval_min
|
int
|
Output time step in minutes (default 5) |
5
|
Returns:
| Type | Description |
|---|---|
ndarray
|
numpy array of incremental precipitation depths |
Example
TP-40 depths for Houston 1% AEP¶
depths = [1.20, 2.10, 4.30, 5.70, 6.70, 8.90, 10.80, 13.20] hyeto = FrequencyStorm.generate_from_ddf(depths) print(f"Total: {hyeto.sum():.2f} inches") Total: 13.20 inches
Source code in hms_commander/FrequencyStorm.py
get_pattern_info()
staticmethod
¶
Get information about the bundled temporal pattern.
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary with pattern metadata |
Example
info = FrequencyStorm.get_pattern_info() print(f"Peak at {info['peak_position']*100:.0f}%") Peak at 67%
Source code in hms_commander/FrequencyStorm.py
validate_against_ground_truth(hyetograph, ground_truth)
staticmethod
¶
Compare a generated hyetograph against ground truth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hyetograph
|
ndarray
|
Generated hyetograph array |
required |
ground_truth
|
ndarray
|
Ground truth array (same length) |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary with comparison metrics |
Example
hyeto = FrequencyStorm.generate_hyetograph(13.20) gt = np.load("ground_truth.npy") metrics = FrequencyStorm.validate_against_ground_truth(hyeto, gt) print(f"RMSE: {metrics['rmse']:.6f}")