
Tidal creek condition outcome by bay segment and year
Source:R/anlz_wq_tidalcreeks.R
anlz_wq_tidalcreeks.RdTidal creek condition outcome by bay segment and year
Arguments
- tidalcreeks
sf object of tidal creek assessment segments, e.g.
tbeptools::tidalcreeks- iwrraw
data.frame of raw IWR water quality data for tidal creeks, e.g.
tbeptools::iwrraw- yrs
integer vector of years to assess, passed to
anlz_tdlcrk
Value
A data.frame with columns bay_segment, yr,
outcome (0-1, 1 = best), and n_assessed (number of creek
records feeding that segment/year's outcome)
Details
Each tidal creek is assigned to the bay segment subwatershed
(tbsegshed) it overlaps most (by length, for
creeks spanning more than one subwatershed).
anlz_tdlcrk computes each creek's condition
category (Prioritize/Investigate/Caution/Monitor) from year counts out of a rolling 10-year window.
The category itself comes from a compound rule (the worst grade present usually wins,
with several count-based exceptions that downgrade it, e.g. a single bad
year surrounded by mostly good years). Rather than use that category,
this converts each creek's own 4 counts directly into a continuous 0-1
score. This is a count-weighted average across an ordinal scale for each
category (Monitor = 1, Caution = 2/3, Investigate = 1/3,
Prioritize = 0), i.e. what fraction of the 10-year window fell in each
grade. Creeks with a "No Data" assessment are dropped.
Each creek's continuous score is then averaged to a bay-segment/year outcome, weighted by each creek's physical length so longer creek segments contribute proportionally more.
Examples
if (FALSE) { # \dontrun{
anlz_wq_tidalcreeks(tbeptools::tidalcreeks, tbeptools::iwrraw, yrs = 2015:2020)
} # }