Create Flow-To-Suitable-Area Curve (with Duration HSI applied) for Reach, Mainstem, or Watershed

habitat_fsa_duration(
  reach,
  mainstem,
  watershed,
  streamgage,
  habitat_type = "rearing",
  units = "ft",
  run = "fall",
  wy_group = "Dry",
  gradient = "Valley Foothill"
)

Arguments

reach

Integer comid identifier for reach (must provide either reach, mainstem, OR watershed)

mainstem

String name for mainstem (refer to cv_mainstems dataset for options)

watershed

String name for watershed (refer to cv_watersheds dataset for options)

streamgage

Three-letter CDEC identifier for the streamgage

habitat_type

Either "rearing" (default) or "spawning"

units

Desired units for output, either "ft" for square ft per linear ft, or "ac" for total acres

run

One of "fall" (default), "late fall", "winter", "spring", or "steelhead"

wy_group

Either "Dry" or "Wet" for water year type scenario

gradient

For rearing, either "Valley Foothill" (default) or "Valley Lowland"

Value

A tibble with columns for flow (flow_cfs) and suitable habitat (habitat)

Examples


habitat_fsa_duration(reach = 7978069, streamgage = "FSB")
#> Error in approx(x = fsa_weighted$q, xout = fsa$flow_cfs, y = fsa_weighted$durwua,     rule = 2:2, na.rm = F): need at least two non-NA values to interpolate

habitat_fsa_duration(mainstem = "Feather River", streamgage = "FSB")
#> Error in mutate(mutate(mutate(filter(flow_xw, comid %in% comids), fsa = map2(comid,     multiplier, function(x, y) {        habistat::habitat_fsa_reach_scaled(reach = x, multiplier = y,             habitat_type = habitat_type, units = "ft")    })), drc = map2(comid, streamgage, function(x, y) {    habistat::habitat_drc_weighted(reach = x, streamgage = y,         run = run, wy_group = wy_group, gradient = gradient,         scale = "flow")})), fsa_x_drc = map2(fsa, drc, function(f, d) {    fsa_weighted <- habistat::duration_apply_dhsi_to_fsa_curve(fsa = f,         drc = d, fsa_q = flow_cfs, fsa_wua = habitat, drc_q = flow_cfs,         drc_dhsi = durhsi)    return(tibble(flow_cfs = f$flow_cfs, habitat = approx(x = fsa_weighted$q,         xout = f$flow_cfs, y = fsa_weighted$durwua, rule = 2:2,         na.rm = F)$y))})): i In argument: `fsa_x_drc = map2(...)`.
#> i In group 1: `river_cvpia = "Feather River"`.
#> Caused by error in `map2()`:
#> i In index: 1.
#> Caused by error in `approx()`:
#> ! need at least two non-NA values to interpolate