A convenience wrapper around ok_scenario() that automatically
generates a sequence of TP reduction scenarios from 0 to max_reduction_pct percent in steps of step_pct percent. Useful for
generating load-response curves and finding the minimum reduction needed
to achieve a trophic state target.
Usage
ok_scenario_sweep(
baseline,
max_reduction_pct = 70,
step_pct = 5,
target_tsi = NULL,
target_class = NULL
)Arguments
- baseline
An
okBATHTUBobject throughok_hydraulics().- max_reduction_pct
Numeric. Maximum TP reduction to evaluate (percent). Default 70.
- step_pct
Numeric. Step size between scenarios (percent). Default 5.
- target_tsi
Numeric. Optional TSI target passed to
ok_scenario(). DefaultNULL.- target_class
Character. Optional trophic class target (
"oligotrophic","mesotrophic", or"eutrophic") passed took_scenario(). DefaultNULL.
Value
A data frame as returned by ok_scenario(), with one row
per reduction step plus the baseline.
Examples
baseline <- ok_load(
inflow_m3yr = 45e6,
tp_inflow_ugl = 120,
ecoregion = "Cross Timbers",
coefficients = "oklahoma"
) |>
ok_hydraulics(surface_area_ha = 890, mean_depth_m = 4.2)
sweep <- ok_scenario_sweep(baseline, target_class = "mesotrophic")
print(sweep[, c("scenario", "tp_inflow_ugl", "tsi_mean",
"trophic_state", "meets_target")])
#> scenario tp_inflow_ugl tsi_mean trophic_state meets_target
#> 1 Baseline 120 62.7 Eutrophic FALSE
#> 2 5% TP reduction 114 62.4 Eutrophic FALSE
#> 3 10% TP reduction 108 62.1 Eutrophic FALSE
#> 4 15% TP reduction 102 61.8 Eutrophic FALSE
#> 5 20% TP reduction 96 61.5 Eutrophic FALSE
#> 6 25% TP reduction 90 61.1 Eutrophic FALSE
#> 7 30% TP reduction 84 60.7 Eutrophic FALSE
#> 8 35% TP reduction 78 60.3 Eutrophic FALSE
#> 9 40% TP reduction 72 59.9 Eutrophic FALSE
#> 10 45% TP reduction 66 59.4 Eutrophic FALSE
#> 11 50% TP reduction 60 58.9 Eutrophic FALSE
#> 12 55% TP reduction 54 58.3 Eutrophic FALSE
#> 13 60% TP reduction 48 57.6 Eutrophic FALSE
#> 14 65% TP reduction 42 56.8 Eutrophic FALSE
#> 15 70% TP reduction 36 55.9 Eutrophic FALSE