Skip to content

TexasStorm

Texas dimensionless hyetographs: empirical percentile curves, the triangular model, and the L-gamma model.

Usage

from hms_commander import TexasStorm

# Empirical: 2nd-quartile, median curve, 24-hr class '12-24', 8 in
hyeto = TexasStorm.generate_hyetograph(
    total_depth_inches=8.0, duration_hours=24, method="empirical",
    quartile=2, percentile=50, duration_class="12-24", time_interval_min=30,
)

# Triangular: the parameter set must be named (the sources publish two)
hyeto = TexasStorm.generate_hyetograph(
    8.0, 12, "triangular", param_set="nws_hourly", time_interval_min=60,
)

# L-gamma
hyeto = TexasStorm.generate_hyetograph(15.0, 24, "lgamma", duration_class="12-24")

The result has the same columns as ScsTypeStorm and Atlas14Storm (hour, incremental_depth, cumulative_depth, with a t=0 row). The source and selections are in hyeto.attrs["provenance"].

HDM recommendation and duration-class selection

The TxDOT HDM (2019, p. 4-80) recommends the 50th-percentile combined (first- through fourth-quartile) curve for the 0-72 hr group, tabulated in HDM Table 4-16, for any storm duration. To request it:

hyeto = TexasStorm.generate_hyetograph(
    total_depth_inches=8.0, duration_hours=24, method="empirical",
    quartile="all", duration_class="0-72", percentile=50,
)

The 0-72 class is never selected automatically. When duration_class is omitted, the empirical method picks the duration-specific class (0-6, 6-12, 12-24, 24-72 hr) that contains the duration, as offered in SIR 2004-5075; the HDM does not use these duration-specific classes. quartile must always be given.

Sources and data origin

Method Source Data origin
empirical Williams-Sether and others (2004), USGS SIR 2004-5075, Supplements 4 and 5 (SIR Table 4 is the median of Supplement 5, 0-72 hr) Runoff-producing storms on small watersheds in Texas, 1959-86
triangular, usgs_runoff Asquith and others (2005), TxDOT 0-4194-4, Tables 4-5; Eq. 1-2 (HDM Eq. 4-26, 4-27) The same small-watershed runoff-producing storm database
triangular, nws_hourly 0-4194-4 Tables 7-9; HDM 2019 Table 4-13 (the only triangular set the HDM publishes) National Weather Service hourly point gages (Texas, Oklahoma, New Mexico), storms of at least 1 inch
lgamma TxDOT 0-4194-4; HDM 2019 Eq. 4-28, Table 4-15 See 0-4194-4

The tabulated empirical values are in hms_commander/data/texas_empirical_hyetographs.csv. scripts/texas_hyetograph_transcription.py compares two independent readings of the report (PDF text layer and OCR of the page images) and writes the file.

Selections the caller must make

  • Triangular parameter set. Two sets are published and they differ: usgs_runoff (0-4194-4 Tables 4-5: a = 0.23 for 0-24 hr, 0.35 for 24-72 hr) and nws_hourly (0-4194-4 Tables 7-9 and HDM Table 4-13: a = 0.02197, 0.28936, 0.38959 for 5-12, 13-24, 25-72 hr). No default is applied.
  • Duration class. Classes are 0-6, 6-12, 12-24, 24-72 hr (empirical); 0-12, 12-24, 24-72 hr (L-gamma); and the triangular classes above. A duration on an overlapping class boundary needs an explicit duration_class. The nws_hourly classes do not overlap, so durations of exactly 12 or 24 hr select automatically (the 5-12 or 13-24 hr class, respectively). HDM says to use the class giving the more severe runoff for exactly 12 or 24 hr; that choice is left to the caller where classes overlap.
  • Quartile (empirical): 1, 2, 3, 4, or "all".
  • Non-monotone published columns (empirical): see below.

Supported durations

  • All methods: more than 0 and at most 72 hr; the duration must be a whole multiple of time_interval_min.
  • nws_hourly: 5-12, 13-24 and 25-72 hr (HDM Table 4-13, p. 4-74). Durations between the classes (12-13 hr and 24-25 hr) are not tabulated and are rejected; an explicit duration_class does not change this. Durations under 5 hr are also rejected. A 6 hr storm uses the 5-12 hr class, which is how 0-4194-4 Example 1 applies the model (it calls it the 0-12 hour model). The 5 hr lower bound reflects the hourly-data sample in 0-4194-4.

Applicability

  • The sources state a limit of less than about 160 mi2 for the empirical curves (SIR 2004-5075; HDM p. 4-77). Pass drainage_area_sqmi to get a UserWarning above the limit; the warning is issued for method="empirical" only. Other methods are not checked against an area limit.
  • total_depth_inches and duration_hours must be finite and positive, and drainage_area_sqmi, if given, must be finite and positive. NaN and infinity are rejected with ValueError.
  • Storms of at least 1 inch of rainfall (warning below), durations up to 72 hr.
  • The source reports no data for the 10th and 90th percentiles of fourth-quartile 0-6 hr storms; requesting them raises ValueError.

Empirical curve handling

  • End points. The curves are tabulated at the centers of 2.5-percent intervals (2.5 to 97.5). Generation adds (0, 0) and (100, 100) and interpolates linearly. The SIR does not tabulate these end points; HDM Table 4-16 lists them.
  • 2.5-percent value of the combined median. HDM Table 4-16 prints 8.70 for the 50th percentile at 2.5 percent of duration. SIR 2004-5075 Table 4 and Supplement 5 give 6.37 (8.70 is the first-quartile value in SIR Table 4). This module uses the SIR value, 6.37.
  • Non-monotone published columns. Eight tabulated columns decrease somewhere with time (Supplement 4: quartile 1 24-72 hr 75th, quartile 3 0-6 hr 10th; Supplement 5: quartile 1 24-72 hr 90th, quartile 3 12-24 hr 10th, 25th, 30th, 40th, 50th percentiles). All median curves other than quartile 3 12-24 hr are monotone, and the combined 0-72 hr curve is unaffected. The nonmonotone argument controls the behavior:

    • "raise" (default): ValueError naming the supplement table page and the opt-in option. Example: Supplement 5, p. 113, quartile 3, 12-24 hr, 40th percentile.
    • "running_max": the running maximum is applied. The number of adjusted ordinates (monotone_points_adjusted) and the largest adjustment in percent points (max_monotone_adjustment_pct; 1.09 for the case above, 11.76 raised to 12.85 at 37.5 percent of duration) are recorded in hyeto.attrs["provenance"]. The sources do not prescribe this repair.

    The bundled CSV and get_empirical_curve return the published values unchanged.

hyeto = TexasStorm.generate_hyetograph(
    5.0, 18, "empirical", quartile=3, duration_class="12-24", percentile=40,
    nonmonotone="running_max",
)

hms_commander.TexasStorm

TexasStorm - Texas Dimensionless Hyetographs (Empirical, Triangular, L-gamma)

Generates cumulative-rainfall hyetographs from the dimensionless Texas hyetograph models published by USGS and TxDOT and adopted in the TxDOT Hydraulic Design Manual (HDM, Chapter 4, Section 13).

Functions:

Name Description
- ``empirical``

tabulated percentile curves by storm quartile and storm duration class (Williams-Sether and others, 2004, USGS SIR 2004-5075, Supplements 4 and 5; Table 4 of that report is the 50th percentile of Supplement 5, 0-72 hr).

- ``triangular``

two-parameter triangular model (Asquith and others, 2005, TxDOT 0-4194-4, Eq. 1-2; HDM Eq. 4-26 and 4-27).

- ``lgamma``

L-gamma model p(F) = F**b * exp(c * (1 - F)) (0-4194-4, Eq. 11; HDM Eq. 4-28 and Table 4-15).

Explicit choices (no silent defaults): - Two different triangular parameter sets are published (see TRIANGULAR_PARAMETER_SETS); param_set must be given. - A duration on an overlapping duration-class boundary requires an explicit duration_class. The non-overlapping nws_hourly class endpoints of exactly 12 and 24 hr are selected automatically. - The empirical quartile must be given. - A few published empirical columns decrease slightly with time. By default (nonmonotone="raise") generation raises ValueError; nonmonotone="running_max" applies a running maximum and records the adjustment in the provenance.

Applicability limits (from the sources): - Empirical curves were developed for small watersheds, less than about 160 square miles (SIR 2004-5075; HDM 2019 p. 4-77). A UserWarning is issued for the empirical method when drainage_area_sqmi exceeds MAX_DRAINAGE_AREA_SQMI. The sources state this limit for the empirical curves only. - All three models are for storms of at least 1 inch of rainfall; a warning is issued for smaller depths. - Storm durations up to 72 hr. The nws_hourly triangular set covers 5-12, 13-24 and 25-72 hr (HDM Table 4-13, p. 4-74); durations between the classes (12-13 and 24-25 hr) and below 5 hr are not supported and are rejected.

Output follows the sibling storm classes: a DataFrame with hour, incremental_depth and cumulative_depth columns and a t=0 zero row.

Example

from hms_commander import TexasStorm hyeto = TexasStorm.generate_hyetograph( ... total_depth_inches=8.0, ... duration_hours=12, ... method='triangular', ... param_set='nws_hourly', ... time_interval_min=60, ... ) round(float(hyeto['cumulative_depth'].iloc[-1]), 6) 8.0

References

Williams-Sether, T., Asquith, W.H., Thompson, D.B., Cleveland, T.G., and Fang, X., 2004, Empirical, dimensionless, cumulative-rainfall hyetographs developed from 1959-86 storm data for selected small watersheds in Texas: USGS Scientific Investigations Report 2004-5075.

Asquith, W.H., Roussel, M.C., Thompson, D.B., Cleveland, T.G., and Fang, X., 2005, Summary of dimensionless Texas hyetographs and distribution of storm depth developed for Texas Department of Transportation Research Project 0-4194: TxDOT Report 0-4194-4.

Texas Department of Transportation, 2019, Hydraulic Design Manual, Chapter 4, Section 13 (Equations 4-26 to 4-28, Tables 4-13 to 4-16).

TexasStorm

Static class for generating Texas dimensionless hyetographs.

All methods are static - no instantiation required.

Attributes:

Name Type Description
METHODS

Valid method values.

EMPIRICAL_QUARTILES

Valid quartile identifiers ('all' is the first- through fourth-quartile combined data group).

EMPIRICAL_DURATION_CLASSES

Storm duration classes in hours.

EMPIRICAL_PERCENTILES

Percentiles tabulated in the supplements.

MAX_DRAINAGE_AREA_SQMI

Approximate applicability limit (160 mi2).

MIN_STORM_DEPTH_INCHES

Minimum storm depth in the source data (1 in).

TRIANGULAR_PARAMETER_SETS Dict[str, dict]

The two published triangular parameter sets.

LGAMMA_PARAMETERS Dict[str, Tuple[float, float, float, float]]

L-gamma parameters (b, c) by duration class.

Source code in hms_commander/TexasStorm.py
 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
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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
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
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
class TexasStorm:
    """
    Static class for generating Texas dimensionless hyetographs.

    All methods are static - no instantiation required.

    Attributes:
        METHODS: Valid ``method`` values.
        EMPIRICAL_QUARTILES: Valid quartile identifiers ('all' is the
            first- through fourth-quartile combined data group).
        EMPIRICAL_DURATION_CLASSES: Storm duration classes in hours.
        EMPIRICAL_PERCENTILES: Percentiles tabulated in the supplements.
        MAX_DRAINAGE_AREA_SQMI: Approximate applicability limit (160 mi2).
        MIN_STORM_DEPTH_INCHES: Minimum storm depth in the source data (1 in).
        TRIANGULAR_PARAMETER_SETS: The two published triangular parameter sets.
        LGAMMA_PARAMETERS: L-gamma parameters (b, c) by duration class.
    """

    METHODS = ("empirical", "triangular", "lgamma")

    EMPIRICAL_QUARTILES = ("1", "2", "3", "4", "all")
    # '0-72' is tabulated in the source but only selectable explicitly.
    EMPIRICAL_DURATION_CLASSES = ("0-6", "6-12", "12-24", "24-72", "0-72")
    EMPIRICAL_PERCENTILES = (10, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90)

    MAX_DRAINAGE_AREA_SQMI = 160.0
    MIN_STORM_DEPTH_INCHES = 1.0
    MAX_DURATION_HOURS = 72.0

    _DATA_FILE = "data/texas_empirical_hyetographs.csv"
    _empirical_cache: Optional[pd.DataFrame] = None
    _APPLICABILITY_WARNING_STACKLEVEL = 4

    # Triangular model: p1 = F**2 / a for 0 <= F <= a;
    # p2 = -F**2/b + (2a/b + 2) F - (a**2/b + a) for a < F <= 1.
    # classes: name -> (min_hours, max_hours, a, b)
    TRIANGULAR_PARAMETER_SETS: Dict[str, dict] = {
        "usgs_runoff": {
            "source": (
                "Asquith and others (2005), TxDOT 0-4194-4, Tables 4 and 5 "
                "(Eq. 5-8): runoff-producing storms of at least 1 inch in the "
                "USGS small-watershed database; mean ordinate 59 percent "
                "(0-24 hr) and 55 percent (24-72 hr)."
            ),
            "classes": {
                "0-24": (0.0, 24.0, 0.23, 0.77),
                "24-72": (24.0, 72.0, 0.35, 0.65),
            },
        },
        "nws_hourly": {
            "source": (
                "Asquith and others (2005), TxDOT 0-4194-4, Tables 7-9 (NWS "
                "hourly database, storms of at least 1 inch); identical to "
                "TxDOT HDM 2019 Table 4-13."
            ),
            "classes": {
                "5-12": (5.0, 12.0, 0.02197, 0.97803),
                "13-24": (13.0, 24.0, 0.28936, 0.71064),
                "25-72": (25.0, 72.0, 0.38959, 0.61041),
            },
        },
    }

    # L-gamma: p(F) = F**b * exp(c * (1 - F)).  classes: name -> (min, max, b, c)
    # Source: 0-4194-4 text on L-gamma hyetographs; HDM 2019 Table 4-15.
    LGAMMA_PARAMETERS: Dict[str, Tuple[float, float, float, float]] = {
        "0-12": (0.0, 12.0, 1.262, 1.227),
        "12-24": (12.0, 24.0, 0.783, 0.4368),
        "24-72": (24.0, 72.0, 0.3388, -0.8152),
    }

    # ------------------------------------------------------------------
    # Model evaluation (dimensionless)
    # ------------------------------------------------------------------
    @staticmethod
    def triangular_cumulative(F: Union[float, np.ndarray], a: float, b: float):
        """
        Cumulative depth fraction of the triangular model (Eq. 1-2 / HDM 4-26, 4-27).

        Args:
            F: Elapsed fraction of storm duration, 0 to 1.
            a: Relative duration before peak intensity.
            b: Relative duration after peak intensity (a + b = 1).

        Returns:
            Cumulative fraction of total storm depth, same shape as ``F``.
        """
        F = np.asarray(F, dtype=float)
        p1 = F**2 / a
        p2 = -(F**2) / b + (2.0 * a / b + 2.0) * F - (a**2 / b + a)
        return np.where(F <= a, p1, p2)

    @staticmethod
    def lgamma_cumulative(F: Union[float, np.ndarray], b: float, c: float):
        """
        Cumulative depth fraction of the L-gamma model, p(F) = F**b * exp(c*(1-F)).

        Args:
            F: Elapsed fraction of storm duration, 0 to 1.
            b: Shape parameter (HDM Table 4-15).
            c: Shape parameter (HDM Table 4-15).
        """
        F = np.asarray(F, dtype=float)
        return F**b * np.exp(c * (1.0 - F))

    # ------------------------------------------------------------------
    # Empirical tables
    # ------------------------------------------------------------------
    @staticmethod
    def _load_empirical() -> pd.DataFrame:
        if TexasStorm._empirical_cache is None:
            path = Path(__file__).parent / TexasStorm._DATA_FILE
            if not path.exists():
                raise FileNotFoundError(
                    f"Texas empirical hyetograph table not found: {path}\n"
                    "This file should be bundled with hms-commander."
                )
            df = pd.read_csv(
                path,
                comment="#",
                dtype={"quartile": str, "duration_class": str},
            )
            TexasStorm._empirical_cache = df
        return TexasStorm._empirical_cache

    @staticmethod
    def _normalize_integral_selector(value: object, name: str) -> object:
        """Return an integral numeric selector as a built-in ``int``."""
        if isinstance(value, (bool, np.bool_)):
            raise ValueError(
                f"{name} must be an integral selector, not a boolean: {value}"
            )
        if isinstance(value, Real):
            numeric_value = float(value)
            if not math.isfinite(numeric_value) or not numeric_value.is_integer():
                raise ValueError(f"{name} must be an integral selector: {value}")
            return int(numeric_value)
        return value

    @staticmethod
    def _validate_positive_physical_quantity(name: str, value: object) -> None:
        """Require a finite, positive real quantity and reject booleans."""
        if (
            isinstance(value, (bool, np.bool_))
            or not isinstance(value, Real)
            or not math.isfinite(float(value))
            or value <= 0
        ):
            raise ValueError(f"{name} must be finite and positive: {value}")

    @staticmethod
    def _normalize_trimmed(trimmed: object) -> bool:
        """Require and normalize the empirical-supplement selector."""
        if not isinstance(trimmed, (bool, np.bool_)):
            raise ValueError(f"trimmed must be a bool: {trimmed}")
        return bool(trimmed)

    @staticmethod
    def get_empirical_curve(
        quartile: Union[int, str],
        duration_class: str,
        percentile: int = 50,
        trimmed: bool = True,
    ) -> pd.DataFrame:
        """
        Return a published empirical curve exactly as tabulated.

        Args:
            quartile: 1, 2, 3, 4, or 'all' (first- through fourth-quartile
                storms combined).
            duration_class: One of ``EMPIRICAL_DURATION_CLASSES``.
            percentile: One of ``EMPIRICAL_PERCENTILES``. Integral floats and
                NumPy numeric scalars are accepted and normalized to ``int``.
            trimmed: True for Supplement 5 (trimmed and smoothed, the source
                of SIR Table 4); False for Supplement 4 (untrimmed and
                smoothed). Must be a real boolean (``bool`` or ``np.bool_``).

        Returns:
            DataFrame with columns ``duration_pct`` (center of each 2.5-percent
            interval, 2.5 to 97.5) and ``depth_pct`` (cumulative percent of
            storm depth). The curve is not anchored at 0 or 100 percent.

        Raises:
            ValueError: For unknown selectors or when the source reports no
                data ('--') for the requested curve.
        """
        quartile = TexasStorm._normalize_integral_selector(quartile, "quartile")
        quartile = str(quartile).lower()
        percentile = TexasStorm._normalize_integral_selector(percentile, "percentile")
        trimmed = TexasStorm._normalize_trimmed(trimmed)
        if quartile not in TexasStorm.EMPIRICAL_QUARTILES:
            raise ValueError(
                f"Invalid quartile: '{quartile}'. "
                f"Valid: {TexasStorm.EMPIRICAL_QUARTILES}"
            )
        if duration_class not in TexasStorm.EMPIRICAL_DURATION_CLASSES:
            raise ValueError(
                f"Invalid duration_class: '{duration_class}'. "
                f"Valid: {TexasStorm.EMPIRICAL_DURATION_CLASSES}"
            )
        if percentile not in TexasStorm.EMPIRICAL_PERCENTILES:
            raise ValueError(
                f"Invalid percentile: {percentile}. "
                f"Valid: {TexasStorm.EMPIRICAL_PERCENTILES}"
            )

        df = TexasStorm._load_empirical()
        sel = df[
            (df["supplement"] == (5 if trimmed else 4))
            & (df["quartile"] == quartile)
            & (df["duration_class"] == duration_class)
        ]
        out = pd.DataFrame(
            {
                "duration_pct": sel["interval_pct"].to_numpy(dtype=float),
                "depth_pct": sel[f"p{percentile}"].to_numpy(dtype=float),
            }
        )
        if out["depth_pct"].isna().any():
            raise ValueError(
                f"SIR 2004-5075 reports no data for quartile={quartile}, "
                f"duration_class={duration_class}, percentile={percentile} "
                f"({'Supplement 5' if trimmed else 'Supplement 4'})."
            )
        return out.reset_index(drop=True)

    @staticmethod
    def _supplement_page(trimmed: bool, quartile: str, duration_class: str) -> int:
        """Printed SIR page of a supplement table (Supp. 4 starts p. 76, 5 p. 101)."""
        q = TexasStorm.EMPIRICAL_QUARTILES.index(quartile)
        c = TexasStorm.EMPIRICAL_DURATION_CLASSES.index(duration_class)
        return (101 if trimmed else 76) + 5 * q + c

    # ------------------------------------------------------------------
    # Class selection and validation
    # ------------------------------------------------------------------
    @staticmethod
    def _select_class(
        duration_hours: float,
        classes: Dict[str, Tuple[float, ...]],
        duration_class: Optional[str],
        what: str,
    ) -> str:
        """Pick a duration class; refuse to guess on boundaries or gaps."""
        if duration_class is not None:
            if duration_class not in classes:
                raise ValueError(
                    f"Invalid duration_class '{duration_class}' for {what}. "
                    f"Valid: {tuple(classes)}"
                )
            lo, hi = classes[duration_class][0], classes[duration_class][1]
            if not (lo <= duration_hours <= hi):
                raise ValueError(
                    f"duration_hours={duration_hours} is outside class "
                    f"'{duration_class}' ({lo}-{hi} hr) for {what}."
                )
            return duration_class

        matches = [
            name
            for name, v in classes.items()
            if name != "0-72" and v[0] <= duration_hours <= v[1]
        ]
        if len(matches) == 1:
            return matches[0]
        if not matches:
            raise ValueError(
                f"duration_hours={duration_hours} is not covered by any class "
                f"for {what}: {tuple(classes)}. This duration is unsupported; "
                "an explicit duration_class does not override it."
            )
        raise ValueError(
            f"duration_hours={duration_hours} falls on a boundary between "
            f"classes {matches} for {what}; the sources do not give a rule "
            "this module can apply. Pass duration_class explicitly."
        )

    @staticmethod
    def _check_applicability(
        total_depth_inches: float,
        drainage_area_sqmi: Optional[float],
        method: str,
    ) -> None:
        if total_depth_inches < TexasStorm.MIN_STORM_DEPTH_INCHES:
            msg = (
                f"Total depth {total_depth_inches} in is below 1 inch; the "
                "Texas hyetograph data are for storms of at least 1 inch."
            )
            logger.warning(msg)
            warnings.warn(
                msg,
                UserWarning,
                stacklevel=TexasStorm._APPLICABILITY_WARNING_STACKLEVEL,
            )
        if method != "empirical":
            return
        if drainage_area_sqmi is None:
            logger.info(
                "The Texas empirical hyetographs were developed for watersheds "
                f"smaller than about {TexasStorm.MAX_DRAINAGE_AREA_SQMI:.0f} "
                "mi2; drainage_area_sqmi not provided, limit not checked."
            )
        elif drainage_area_sqmi > TexasStorm.MAX_DRAINAGE_AREA_SQMI:
            msg = (
                f"Drainage area {drainage_area_sqmi} mi2 exceeds the approximate "
                f"{TexasStorm.MAX_DRAINAGE_AREA_SQMI:.0f} mi2 limit stated for "
                "the Texas empirical hyetographs (SIR 2004-5075; HDM 2019 "
                "p. 4-77)."
            )
            logger.warning(msg)
            warnings.warn(
                msg,
                UserWarning,
                stacklevel=TexasStorm._APPLICABILITY_WARNING_STACKLEVEL,
            )

    # ------------------------------------------------------------------
    # Public generator
    # ------------------------------------------------------------------
    @staticmethod
    @log_call
    def generate_hyetograph(
        total_depth_inches: float,
        duration_hours: float,
        method: str,
        time_interval_min: int = 60,
        quartile: Optional[Union[int, str]] = None,
        percentile: int = 50,
        trimmed: bool = True,
        param_set: Optional[str] = None,
        duration_class: Optional[str] = None,
        drainage_area_sqmi: Optional[float] = None,
        nonmonotone: str = "raise",
    ) -> pd.DataFrame:
        """
        Generate a Texas dimensionless hyetograph scaled to a depth and duration.

        Args:
            total_depth_inches: Total storm depth (inches).
            duration_hours: Storm duration (hours), at most 72.
            method: 'empirical', 'triangular', or 'lgamma'.
            time_interval_min: Output time step in minutes (default 60). The
                duration must be a whole multiple of the interval.
            quartile: Required for 'empirical': 1, 2, 3, 4, or 'all'.
            percentile: Empirical percentile (default 50). Integral floats and
                NumPy numeric scalars are accepted and normalized to ``int``.
            trimmed: Empirical only. True (default) uses SIR 2004-5075
                Supplement 5 (trimmed, smoothed; SIR Table 4 is its median);
                False uses Supplement 4 (untrimmed, smoothed). Must be a real
                boolean (``bool`` or ``np.bool_``); ``None`` is not a selector.
            param_set: Required for 'triangular': 'usgs_runoff' or
                'nws_hourly'. See ``TRIANGULAR_PARAMETER_SETS`` for sources.
            duration_class: Optional explicit class. Required when
                ``duration_hours`` falls on an overlapping class boundary.
                The non-overlapping 'nws_hourly' endpoints of exactly 12 and
                24 hr select automatically. It cannot make an unsupported
                duration valid: the 'nws_hourly' set rejects 12-13 hr,
                24-25 hr and durations under 5 hr (HDM Table 4-13, p. 4-74).
            drainage_area_sqmi: Optional watershed area; must be finite and
                positive if given. For 'empirical' only, a ``UserWarning`` is
                issued above ``MAX_DRAINAGE_AREA_SQMI`` (160 mi2; SIR
                2004-5075, HDM p. 4-77).
            nonmonotone: Empirical only. 'raise' (default) raises
                ``ValueError`` if the selected published column decreases with
                time. 'running_max' applies the running maximum and records
                the number of adjusted ordinates and the maximum adjustment
                (percent points) in the provenance.

        Returns:
            pd.DataFrame with columns:
                - 'hour': time from storm start (float)
                - 'incremental_depth': depth in the interval ending at 'hour' (in)
                - 'cumulative_depth': cumulative depth (in)
            Length = duration / interval + 1 (row 0 is the t=0 zero row).
            ``attrs['provenance']`` records the source and selections.

        Raises:
            ValueError: Non-finite or non-positive depth, duration or area;
                invalid or ambiguous selections; durations over 72 hr or in an
                unsupported gap; an interval that does not divide the
                duration; an empirical curve for which the source gives no
                data; or a non-monotone published column with
                ``nonmonotone='raise'``.

        Note:
            For 'empirical', the tabulated curve (values at the centers of
            2.5-percent intervals) is linearly interpolated with (0, 0) and
            (100, 100) added as end points (as in HDM Table 4-16). If a
            published column decreases with time (8 of the tabulated columns),
            the ``nonmonotone`` policy applies.

        Example:
            >>> hyeto = TexasStorm.generate_hyetograph(
            ...     10.0, 24, 'empirical', quartile=2, duration_class='12-24',
            ...     time_interval_min=30)
            >>> len(hyeto)
            49
        """
        if method not in TexasStorm.METHODS:
            raise ValueError(f"Invalid method: '{method}'. Valid: {TexasStorm.METHODS}")
        if nonmonotone not in ("raise", "running_max"):
            raise ValueError(
                f"Invalid nonmonotone: '{nonmonotone}'. "
                "Valid: ('raise', 'running_max')"
            )
        trimmed = TexasStorm._normalize_trimmed(trimmed)
        for name, val in (
            ("total_depth_inches", total_depth_inches),
            ("duration_hours", duration_hours),
            ("time_interval_min", time_interval_min),
        ):
            TexasStorm._validate_positive_physical_quantity(name, val)
        if drainage_area_sqmi is not None:
            TexasStorm._validate_positive_physical_quantity(
                "drainage_area_sqmi", drainage_area_sqmi
            )
        if not (0 < duration_hours <= TexasStorm.MAX_DURATION_HOURS):
            raise ValueError(
                f"duration_hours must be in (0, {TexasStorm.MAX_DURATION_HOURS:g}]: "
                f"{duration_hours}"
            )
        if time_interval_min <= 0:
            raise ValueError(f"Time interval must be positive: {time_interval_min}")
        n_float = duration_hours * 60.0 / time_interval_min
        n = int(round(n_float))
        if n < 1 or abs(n_float - n) > 1e-9:
            raise ValueError(
                f"Time interval {time_interval_min} min does not evenly divide "
                f"the {duration_hours}-hour duration."
            )

        TexasStorm._check_applicability(total_depth_inches, drainage_area_sqmi, method)

        F = np.linspace(0.0, 1.0, n + 1)
        provenance: dict = {"method": method, "duration_hours": duration_hours}

        if method == "triangular":
            if param_set not in TexasStorm.TRIANGULAR_PARAMETER_SETS:
                raise ValueError(
                    "param_set is required for the triangular method: "
                    f"{tuple(TexasStorm.TRIANGULAR_PARAMETER_SETS)}. The two "
                    "published sets differ; see TRIANGULAR_PARAMETER_SETS."
                )
            pset = TexasStorm.TRIANGULAR_PARAMETER_SETS[param_set]
            cls = TexasStorm._select_class(
                duration_hours,
                pset["classes"],
                duration_class,
                f"triangular/{param_set}",
            )
            _, _, a, b = pset["classes"][cls]
            frac = TexasStorm.triangular_cumulative(F, a, b)
            provenance.update(
                param_set=param_set,
                duration_class=cls,
                a=a,
                b=b,
                source=pset["source"],
            )

        elif method == "lgamma":
            cls = TexasStorm._select_class(
                duration_hours,
                TexasStorm.LGAMMA_PARAMETERS,
                duration_class,
                "lgamma",
            )
            _, _, b, c = TexasStorm.LGAMMA_PARAMETERS[cls]
            frac = TexasStorm.lgamma_cumulative(F, b, c)
            provenance.update(
                duration_class=cls,
                b=b,
                c=c,
                source="TxDOT 0-4194-4 (L-gamma); HDM 2019 Eq. 4-28, Table 4-15",
            )

        else:  # empirical
            if quartile is None:
                raise ValueError(
                    "quartile is required for the empirical method: "
                    f"{TexasStorm.EMPIRICAL_QUARTILES}"
                )
            quartile = TexasStorm._normalize_integral_selector(quartile, "quartile")
            percentile = TexasStorm._normalize_integral_selector(
                percentile, "percentile"
            )
            classes = {
                name: tuple(float(x) for x in name.split("-")) + (None, None)
                for name in TexasStorm.EMPIRICAL_DURATION_CLASSES
            }
            cls = TexasStorm._select_class(
                duration_hours, classes, duration_class, "empirical"
            )
            curve = TexasStorm.get_empirical_curve(quartile, cls, percentile, trimmed)
            x = np.concatenate(([0.0], curve["duration_pct"].to_numpy(), [100.0]))
            y = np.concatenate(([0.0], curve["depth_pct"].to_numpy(), [100.0]))
            y_mono = np.maximum.accumulate(y)
            n_adj = int(np.count_nonzero(y_mono != y))
            max_adj = float(np.max(y_mono - y))
            if n_adj and nonmonotone == "raise":
                qs = str(quartile).lower()
                page = TexasStorm._supplement_page(trimmed, qs, cls)
                raise ValueError(
                    "The published empirical column is not monotone: SIR "
                    f"2004-5075 Supplement {5 if trimmed else 4}, printed "
                    f"p. {page}, quartile={qs}, duration_class={cls}, "
                    f"percentile={percentile} decreases with time at "
                    f"{n_adj} ordinate(s) (max {max_adj:.2f} percent points). "
                    "Pass nonmonotone='running_max' to apply a running "
                    "maximum, or select another curve."
                )
            if n_adj:
                logger.warning(
                    f"Published empirical curve is not monotone at {n_adj} "
                    f"point(s) (max adjustment {max_adj:.2f} percent points); "
                    "running maximum applied."
                )
            frac = np.interp(F * 100.0, x, y_mono) / 100.0
            provenance.update(
                quartile=str(quartile).lower(),
                duration_class=cls,
                percentile=percentile,
                trimmed=trimmed,
                nonmonotone=nonmonotone,
                monotone_points_adjusted=n_adj,
                max_monotone_adjustment_pct=max_adj,
                source=("USGS SIR 2004-5075 Supplement " f"{5 if trimmed else 4}"),
            )

        incremental = incremental_depths_from_cumulative_values(
            frac, total_depth_inches=total_depth_inches
        )
        total_check = float(incremental.sum())
        if abs(total_check - total_depth_inches) > 1e-6:
            logger.warning(
                f"Depth conservation warning: expected {total_depth_inches:.6f}, "
                f"got {total_check:.6f}"
            )
        logger.info(
            f"Generated Texas {method} hyetograph: {n} intervals, "
            f"{total_check:.6f} inches total, peak {incremental.max():.3f} inches"
        )

        hyetograph = build_hyetograph_frame(incremental, time_interval_min)
        hyetograph.attrs["provenance"] = provenance
        return hyetograph

triangular_cumulative(F, a, b) staticmethod

Cumulative depth fraction of the triangular model (Eq. 1-2 / HDM 4-26, 4-27).

Parameters:

Name Type Description Default
F Union[float, ndarray]

Elapsed fraction of storm duration, 0 to 1.

required
a float

Relative duration before peak intensity.

required
b float

Relative duration after peak intensity (a + b = 1).

required

Returns:

Type Description

Cumulative fraction of total storm depth, same shape as F.

Source code in hms_commander/TexasStorm.py
@staticmethod
def triangular_cumulative(F: Union[float, np.ndarray], a: float, b: float):
    """
    Cumulative depth fraction of the triangular model (Eq. 1-2 / HDM 4-26, 4-27).

    Args:
        F: Elapsed fraction of storm duration, 0 to 1.
        a: Relative duration before peak intensity.
        b: Relative duration after peak intensity (a + b = 1).

    Returns:
        Cumulative fraction of total storm depth, same shape as ``F``.
    """
    F = np.asarray(F, dtype=float)
    p1 = F**2 / a
    p2 = -(F**2) / b + (2.0 * a / b + 2.0) * F - (a**2 / b + a)
    return np.where(F <= a, p1, p2)

lgamma_cumulative(F, b, c) staticmethod

Cumulative depth fraction of the L-gamma model, p(F) = F*b * exp(c(1-F)).

Parameters:

Name Type Description Default
F Union[float, ndarray]

Elapsed fraction of storm duration, 0 to 1.

required
b float

Shape parameter (HDM Table 4-15).

required
c float

Shape parameter (HDM Table 4-15).

required
Source code in hms_commander/TexasStorm.py
@staticmethod
def lgamma_cumulative(F: Union[float, np.ndarray], b: float, c: float):
    """
    Cumulative depth fraction of the L-gamma model, p(F) = F**b * exp(c*(1-F)).

    Args:
        F: Elapsed fraction of storm duration, 0 to 1.
        b: Shape parameter (HDM Table 4-15).
        c: Shape parameter (HDM Table 4-15).
    """
    F = np.asarray(F, dtype=float)
    return F**b * np.exp(c * (1.0 - F))

get_empirical_curve(quartile, duration_class, percentile=50, trimmed=True) staticmethod

Return a published empirical curve exactly as tabulated.

Parameters:

Name Type Description Default
quartile Union[int, str]

1, 2, 3, 4, or 'all' (first- through fourth-quartile storms combined).

required
duration_class str

One of EMPIRICAL_DURATION_CLASSES.

required
percentile int

One of EMPIRICAL_PERCENTILES. Integral floats and NumPy numeric scalars are accepted and normalized to int.

50
trimmed bool

True for Supplement 5 (trimmed and smoothed, the source of SIR Table 4); False for Supplement 4 (untrimmed and smoothed). Must be a real boolean (bool or np.bool_).

True

Returns:

Type Description
DataFrame

DataFrame with columns duration_pct (center of each 2.5-percent

DataFrame

interval, 2.5 to 97.5) and depth_pct (cumulative percent of

DataFrame

storm depth). The curve is not anchored at 0 or 100 percent.

Raises:

Type Description
ValueError

For unknown selectors or when the source reports no data ('--') for the requested curve.

Source code in hms_commander/TexasStorm.py
@staticmethod
def get_empirical_curve(
    quartile: Union[int, str],
    duration_class: str,
    percentile: int = 50,
    trimmed: bool = True,
) -> pd.DataFrame:
    """
    Return a published empirical curve exactly as tabulated.

    Args:
        quartile: 1, 2, 3, 4, or 'all' (first- through fourth-quartile
            storms combined).
        duration_class: One of ``EMPIRICAL_DURATION_CLASSES``.
        percentile: One of ``EMPIRICAL_PERCENTILES``. Integral floats and
            NumPy numeric scalars are accepted and normalized to ``int``.
        trimmed: True for Supplement 5 (trimmed and smoothed, the source
            of SIR Table 4); False for Supplement 4 (untrimmed and
            smoothed). Must be a real boolean (``bool`` or ``np.bool_``).

    Returns:
        DataFrame with columns ``duration_pct`` (center of each 2.5-percent
        interval, 2.5 to 97.5) and ``depth_pct`` (cumulative percent of
        storm depth). The curve is not anchored at 0 or 100 percent.

    Raises:
        ValueError: For unknown selectors or when the source reports no
            data ('--') for the requested curve.
    """
    quartile = TexasStorm._normalize_integral_selector(quartile, "quartile")
    quartile = str(quartile).lower()
    percentile = TexasStorm._normalize_integral_selector(percentile, "percentile")
    trimmed = TexasStorm._normalize_trimmed(trimmed)
    if quartile not in TexasStorm.EMPIRICAL_QUARTILES:
        raise ValueError(
            f"Invalid quartile: '{quartile}'. "
            f"Valid: {TexasStorm.EMPIRICAL_QUARTILES}"
        )
    if duration_class not in TexasStorm.EMPIRICAL_DURATION_CLASSES:
        raise ValueError(
            f"Invalid duration_class: '{duration_class}'. "
            f"Valid: {TexasStorm.EMPIRICAL_DURATION_CLASSES}"
        )
    if percentile not in TexasStorm.EMPIRICAL_PERCENTILES:
        raise ValueError(
            f"Invalid percentile: {percentile}. "
            f"Valid: {TexasStorm.EMPIRICAL_PERCENTILES}"
        )

    df = TexasStorm._load_empirical()
    sel = df[
        (df["supplement"] == (5 if trimmed else 4))
        & (df["quartile"] == quartile)
        & (df["duration_class"] == duration_class)
    ]
    out = pd.DataFrame(
        {
            "duration_pct": sel["interval_pct"].to_numpy(dtype=float),
            "depth_pct": sel[f"p{percentile}"].to_numpy(dtype=float),
        }
    )
    if out["depth_pct"].isna().any():
        raise ValueError(
            f"SIR 2004-5075 reports no data for quartile={quartile}, "
            f"duration_class={duration_class}, percentile={percentile} "
            f"({'Supplement 5' if trimmed else 'Supplement 4'})."
        )
    return out.reset_index(drop=True)

generate_hyetograph(total_depth_inches, duration_hours, method, time_interval_min=60, quartile=None, percentile=50, trimmed=True, param_set=None, duration_class=None, drainage_area_sqmi=None, nonmonotone='raise') staticmethod

Generate a Texas dimensionless hyetograph scaled to a depth and duration.

Parameters:

Name Type Description Default
total_depth_inches float

Total storm depth (inches).

required
duration_hours float

Storm duration (hours), at most 72.

required
method str

'empirical', 'triangular', or 'lgamma'.

required
time_interval_min int

Output time step in minutes (default 60). The duration must be a whole multiple of the interval.

60
quartile Optional[Union[int, str]]

Required for 'empirical': 1, 2, 3, 4, or 'all'.

None
percentile int

Empirical percentile (default 50). Integral floats and NumPy numeric scalars are accepted and normalized to int.

50
trimmed bool

Empirical only. True (default) uses SIR 2004-5075 Supplement 5 (trimmed, smoothed; SIR Table 4 is its median); False uses Supplement 4 (untrimmed, smoothed). Must be a real boolean (bool or np.bool_); None is not a selector.

True
param_set Optional[str]

Required for 'triangular': 'usgs_runoff' or 'nws_hourly'. See TRIANGULAR_PARAMETER_SETS for sources.

None
duration_class Optional[str]

Optional explicit class. Required when duration_hours falls on an overlapping class boundary. The non-overlapping 'nws_hourly' endpoints of exactly 12 and 24 hr select automatically. It cannot make an unsupported duration valid: the 'nws_hourly' set rejects 12-13 hr, 24-25 hr and durations under 5 hr (HDM Table 4-13, p. 4-74).

None
drainage_area_sqmi Optional[float]

Optional watershed area; must be finite and positive if given. For 'empirical' only, a UserWarning is issued above MAX_DRAINAGE_AREA_SQMI (160 mi2; SIR 2004-5075, HDM p. 4-77).

None
nonmonotone str

Empirical only. 'raise' (default) raises ValueError if the selected published column decreases with time. 'running_max' applies the running maximum and records the number of adjusted ordinates and the maximum adjustment (percent points) in the provenance.

'raise'

Returns:

Type Description
DataFrame

pd.DataFrame with columns: - 'hour': time from storm start (float) - 'incremental_depth': depth in the interval ending at 'hour' (in) - 'cumulative_depth': cumulative depth (in)

DataFrame

Length = duration / interval + 1 (row 0 is the t=0 zero row).

DataFrame

attrs['provenance'] records the source and selections.

Raises:

Type Description
ValueError

Non-finite or non-positive depth, duration or area; invalid or ambiguous selections; durations over 72 hr or in an unsupported gap; an interval that does not divide the duration; an empirical curve for which the source gives no data; or a non-monotone published column with nonmonotone='raise'.

Note

For 'empirical', the tabulated curve (values at the centers of 2.5-percent intervals) is linearly interpolated with (0, 0) and (100, 100) added as end points (as in HDM Table 4-16). If a published column decreases with time (8 of the tabulated columns), the nonmonotone policy applies.

Example

hyeto = TexasStorm.generate_hyetograph( ... 10.0, 24, 'empirical', quartile=2, duration_class='12-24', ... time_interval_min=30) len(hyeto) 49

Source code in hms_commander/TexasStorm.py
@staticmethod
@log_call
def generate_hyetograph(
    total_depth_inches: float,
    duration_hours: float,
    method: str,
    time_interval_min: int = 60,
    quartile: Optional[Union[int, str]] = None,
    percentile: int = 50,
    trimmed: bool = True,
    param_set: Optional[str] = None,
    duration_class: Optional[str] = None,
    drainage_area_sqmi: Optional[float] = None,
    nonmonotone: str = "raise",
) -> pd.DataFrame:
    """
    Generate a Texas dimensionless hyetograph scaled to a depth and duration.

    Args:
        total_depth_inches: Total storm depth (inches).
        duration_hours: Storm duration (hours), at most 72.
        method: 'empirical', 'triangular', or 'lgamma'.
        time_interval_min: Output time step in minutes (default 60). The
            duration must be a whole multiple of the interval.
        quartile: Required for 'empirical': 1, 2, 3, 4, or 'all'.
        percentile: Empirical percentile (default 50). Integral floats and
            NumPy numeric scalars are accepted and normalized to ``int``.
        trimmed: Empirical only. True (default) uses SIR 2004-5075
            Supplement 5 (trimmed, smoothed; SIR Table 4 is its median);
            False uses Supplement 4 (untrimmed, smoothed). Must be a real
            boolean (``bool`` or ``np.bool_``); ``None`` is not a selector.
        param_set: Required for 'triangular': 'usgs_runoff' or
            'nws_hourly'. See ``TRIANGULAR_PARAMETER_SETS`` for sources.
        duration_class: Optional explicit class. Required when
            ``duration_hours`` falls on an overlapping class boundary.
            The non-overlapping 'nws_hourly' endpoints of exactly 12 and
            24 hr select automatically. It cannot make an unsupported
            duration valid: the 'nws_hourly' set rejects 12-13 hr,
            24-25 hr and durations under 5 hr (HDM Table 4-13, p. 4-74).
        drainage_area_sqmi: Optional watershed area; must be finite and
            positive if given. For 'empirical' only, a ``UserWarning`` is
            issued above ``MAX_DRAINAGE_AREA_SQMI`` (160 mi2; SIR
            2004-5075, HDM p. 4-77).
        nonmonotone: Empirical only. 'raise' (default) raises
            ``ValueError`` if the selected published column decreases with
            time. 'running_max' applies the running maximum and records
            the number of adjusted ordinates and the maximum adjustment
            (percent points) in the provenance.

    Returns:
        pd.DataFrame with columns:
            - 'hour': time from storm start (float)
            - 'incremental_depth': depth in the interval ending at 'hour' (in)
            - 'cumulative_depth': cumulative depth (in)
        Length = duration / interval + 1 (row 0 is the t=0 zero row).
        ``attrs['provenance']`` records the source and selections.

    Raises:
        ValueError: Non-finite or non-positive depth, duration or area;
            invalid or ambiguous selections; durations over 72 hr or in an
            unsupported gap; an interval that does not divide the
            duration; an empirical curve for which the source gives no
            data; or a non-monotone published column with
            ``nonmonotone='raise'``.

    Note:
        For 'empirical', the tabulated curve (values at the centers of
        2.5-percent intervals) is linearly interpolated with (0, 0) and
        (100, 100) added as end points (as in HDM Table 4-16). If a
        published column decreases with time (8 of the tabulated columns),
        the ``nonmonotone`` policy applies.

    Example:
        >>> hyeto = TexasStorm.generate_hyetograph(
        ...     10.0, 24, 'empirical', quartile=2, duration_class='12-24',
        ...     time_interval_min=30)
        >>> len(hyeto)
        49
    """
    if method not in TexasStorm.METHODS:
        raise ValueError(f"Invalid method: '{method}'. Valid: {TexasStorm.METHODS}")
    if nonmonotone not in ("raise", "running_max"):
        raise ValueError(
            f"Invalid nonmonotone: '{nonmonotone}'. "
            "Valid: ('raise', 'running_max')"
        )
    trimmed = TexasStorm._normalize_trimmed(trimmed)
    for name, val in (
        ("total_depth_inches", total_depth_inches),
        ("duration_hours", duration_hours),
        ("time_interval_min", time_interval_min),
    ):
        TexasStorm._validate_positive_physical_quantity(name, val)
    if drainage_area_sqmi is not None:
        TexasStorm._validate_positive_physical_quantity(
            "drainage_area_sqmi", drainage_area_sqmi
        )
    if not (0 < duration_hours <= TexasStorm.MAX_DURATION_HOURS):
        raise ValueError(
            f"duration_hours must be in (0, {TexasStorm.MAX_DURATION_HOURS:g}]: "
            f"{duration_hours}"
        )
    if time_interval_min <= 0:
        raise ValueError(f"Time interval must be positive: {time_interval_min}")
    n_float = duration_hours * 60.0 / time_interval_min
    n = int(round(n_float))
    if n < 1 or abs(n_float - n) > 1e-9:
        raise ValueError(
            f"Time interval {time_interval_min} min does not evenly divide "
            f"the {duration_hours}-hour duration."
        )

    TexasStorm._check_applicability(total_depth_inches, drainage_area_sqmi, method)

    F = np.linspace(0.0, 1.0, n + 1)
    provenance: dict = {"method": method, "duration_hours": duration_hours}

    if method == "triangular":
        if param_set not in TexasStorm.TRIANGULAR_PARAMETER_SETS:
            raise ValueError(
                "param_set is required for the triangular method: "
                f"{tuple(TexasStorm.TRIANGULAR_PARAMETER_SETS)}. The two "
                "published sets differ; see TRIANGULAR_PARAMETER_SETS."
            )
        pset = TexasStorm.TRIANGULAR_PARAMETER_SETS[param_set]
        cls = TexasStorm._select_class(
            duration_hours,
            pset["classes"],
            duration_class,
            f"triangular/{param_set}",
        )
        _, _, a, b = pset["classes"][cls]
        frac = TexasStorm.triangular_cumulative(F, a, b)
        provenance.update(
            param_set=param_set,
            duration_class=cls,
            a=a,
            b=b,
            source=pset["source"],
        )

    elif method == "lgamma":
        cls = TexasStorm._select_class(
            duration_hours,
            TexasStorm.LGAMMA_PARAMETERS,
            duration_class,
            "lgamma",
        )
        _, _, b, c = TexasStorm.LGAMMA_PARAMETERS[cls]
        frac = TexasStorm.lgamma_cumulative(F, b, c)
        provenance.update(
            duration_class=cls,
            b=b,
            c=c,
            source="TxDOT 0-4194-4 (L-gamma); HDM 2019 Eq. 4-28, Table 4-15",
        )

    else:  # empirical
        if quartile is None:
            raise ValueError(
                "quartile is required for the empirical method: "
                f"{TexasStorm.EMPIRICAL_QUARTILES}"
            )
        quartile = TexasStorm._normalize_integral_selector(quartile, "quartile")
        percentile = TexasStorm._normalize_integral_selector(
            percentile, "percentile"
        )
        classes = {
            name: tuple(float(x) for x in name.split("-")) + (None, None)
            for name in TexasStorm.EMPIRICAL_DURATION_CLASSES
        }
        cls = TexasStorm._select_class(
            duration_hours, classes, duration_class, "empirical"
        )
        curve = TexasStorm.get_empirical_curve(quartile, cls, percentile, trimmed)
        x = np.concatenate(([0.0], curve["duration_pct"].to_numpy(), [100.0]))
        y = np.concatenate(([0.0], curve["depth_pct"].to_numpy(), [100.0]))
        y_mono = np.maximum.accumulate(y)
        n_adj = int(np.count_nonzero(y_mono != y))
        max_adj = float(np.max(y_mono - y))
        if n_adj and nonmonotone == "raise":
            qs = str(quartile).lower()
            page = TexasStorm._supplement_page(trimmed, qs, cls)
            raise ValueError(
                "The published empirical column is not monotone: SIR "
                f"2004-5075 Supplement {5 if trimmed else 4}, printed "
                f"p. {page}, quartile={qs}, duration_class={cls}, "
                f"percentile={percentile} decreases with time at "
                f"{n_adj} ordinate(s) (max {max_adj:.2f} percent points). "
                "Pass nonmonotone='running_max' to apply a running "
                "maximum, or select another curve."
            )
        if n_adj:
            logger.warning(
                f"Published empirical curve is not monotone at {n_adj} "
                f"point(s) (max adjustment {max_adj:.2f} percent points); "
                "running maximum applied."
            )
        frac = np.interp(F * 100.0, x, y_mono) / 100.0
        provenance.update(
            quartile=str(quartile).lower(),
            duration_class=cls,
            percentile=percentile,
            trimmed=trimmed,
            nonmonotone=nonmonotone,
            monotone_points_adjusted=n_adj,
            max_monotone_adjustment_pct=max_adj,
            source=("USGS SIR 2004-5075 Supplement " f"{5 if trimmed else 4}"),
        )

    incremental = incremental_depths_from_cumulative_values(
        frac, total_depth_inches=total_depth_inches
    )
    total_check = float(incremental.sum())
    if abs(total_check - total_depth_inches) > 1e-6:
        logger.warning(
            f"Depth conservation warning: expected {total_depth_inches:.6f}, "
            f"got {total_check:.6f}"
        )
    logger.info(
        f"Generated Texas {method} hyetograph: {n} intervals, "
        f"{total_check:.6f} inches total, peak {incremental.max():.3f} inches"
    )

    hyetograph = build_hyetograph_frame(incremental, time_interval_min)
    hyetograph.attrs["provenance"] = provenance
    return hyetograph