diff --git a/R/anlz_enteromap.R b/R/anlz_enteromap.R
index f190255e..ba50a730 100644
--- a/R/anlz_enteromap.R
+++ b/R/anlz_enteromap.R
@@ -3,6 +3,7 @@
#' @param fibdata data frame of Enterococcus sample data as returned by \code{\link{enterodata}} or \code{\link{anlz_fibwetdry}}
#' @param yrsel optional numeric to filter data by year
#' @param mosel optional numeric to filter data by month
+#' @param areasel optional character string to filter output by stations in the \code{long_name} column of \code{enterodata}, see details
#' @param wetdry logical; if \code{TRUE}, incorporate wet/dry differences (this will result in a call to \code{\link{anlz_fibwetdry}}, in which case \code{temporal_window} and \code{wet_threshold} are required). If \code{FALSE} (default), do not differentiate between wet and dry samples.
#' @param precipdata input data frame as returned by \code{\link{read_importrain}}. columns should be: station, date (yyyy-mm-dd), rain (in inches). The object \code{\link{catchprecip}} has this data from 1995-2023 for select Enterococcus stations. If \code{NULL}, defaults to \code{\link{catchprecip}}.
#' @param temporal_window numeric; required if \code{wetdry} is \code{TRUE}. number of days precipitation should be summed over (1 = day of sample only; 2 = day of sample + day before; etc.)
@@ -10,6 +11,8 @@
#'
#' @details This function is based on \code{\link{anlz_fibmap}}, but is specific to Enterococcus data downloaded via \code{\link{read_importentero}}. It creates categories for mapping using \code{\link{show_enteromap}}. Optionally, if samples have been defined as 'wet' or not via \code{\link{anlz_fibwetdry}}, this can be represented via symbols on the map. Categories based on relevant thresholds are assigned to each observation. The categories are specific to Enterococcus in marine waters (\code{class} of 2 or 3M). A station is categorized into one of four ranges defined by the thresholds as noted in the \code{cat} column of the output, with corresponding colors appropriate for each range as noted in the \code{col} column of the output.
#'
+#' The \code{areasel} argument can indicate valid entries in the \code{long_name} column of \code{enterodata}. For example, use \code{"Old Tampa Bay"} for stations in the subwatershed of Old Tampa Bay, where rows in \code{enterodata} are filtered based on the the selection. All stations are returned if this argument is set as \code{NULL} (default). All valid options for \code{areasel} include \code{"Old Tampa Bay"}, \code{"Hillsborough Bay"}, \code{"Middle Tampa Bay"}, \code{"Lower Tampa Bay"}, \code{"Boca Ciega Bay"}, or \code{"Manatee River"}. One to any of the options can be used.
+#'
#' @return A \code{data.frame} similar to \code{fibdata} with additional columns describing station categories and optionally filtered by arguments passed to the function
#'
#' @export
@@ -20,20 +23,22 @@
#' # differentiate wet/dry samples in that time frame
#' anlz_enteromap(enterodata, yrsel = 2020, mosel = 9, wetdry = TRUE,
#' temporal_window = 2, wet_threshold = 0.5)
-anlz_enteromap <- function (fibdata, yrsel = NULL, mosel = NULL, wetdry = FALSE,
+anlz_enteromap <- function (fibdata, yrsel = NULL, mosel = NULL, areasel = NULL, wetdry = FALSE,
precipdata = NULL, temporal_window = NULL,
- wet_threshold = NULL)
-{
+ wet_threshold = NULL){
+
levs <- util_fiblevs()
cols <- c("#2DC938", "#E9C318", "#EE7600", "#CC3231")
- out <- fibdata %>% select(station, yr,
- mo, Latitude, Longitude, ecocci) %>%
+
+ out <- fibdata %>%
+ select(station, long_name, yr, mo, Latitude, Longitude, ecocci) %>%
dplyr::mutate(cat = cut(ecocci, breaks = levs$ecoccilev, right = F, levs$ecoccilbs),
col = cut(ecocci, breaks = levs$ecoccilev, right = F, cols),
col = as.character(col),
ind = "Enterococcus",
indnm = "ecocci",
conc = ecocci)
+
if (wetdry == TRUE) {
# make sure necessary info is provided
stopifnot("temporal_window and wet_threshold must both be provided in order to subset to wet or dry samples" = !is.null(temporal_window) & !is.null(wet_threshold)
@@ -49,17 +54,38 @@ anlz_enteromap <- function (fibdata, yrsel = NULL, mosel = NULL, wetdry = FALSE,
wet_threshold = wet_threshold)
out$wet_sample = wetdry$wet_sample
}
+
+ # filter by area
+ if(!is.null(areasel)){
+
+ areasvc <- c("Old Tampa Bay", "Hillsborough Bay", "Middle Tampa Bay", "Lower Tampa Bay",
+ "Boca Ciega Bay", "Manatee River")
+
+ areasel <- match.arg(areasel, areasvc, several.ok = TRUE)
+
+ out <- out %>%
+ dplyr::filter(long_name %in% areasel)
+
+ }
+
if (!is.null(yrsel)) {
yrsel <- match.arg(as.character(yrsel), unique(out$yr))
- out <- out %>% dplyr::filter(yr %in% yrsel)
+ out <- out %>%
+ dplyr::filter(yr %in% yrsel)
}
if (!is.null(mosel)) {
mosel <- match.arg(as.character(mosel), 1:12)
- out <- out %>% dplyr::filter(mo %in% mosel)
+ out <- out %>%
+ dplyr::filter(mo %in% mosel)
}
+
chk <- length(na.omit(out$cat)) == 0
if (chk)
stop("No FIB data for ", paste(lubridate::month(mosel,
label = T), yrsel, sep = " "))
+
+ out <- tibble::tibble(out)
+
return(out)
+
}
diff --git a/R/anlz_fibmap.R b/R/anlz_fibmap.R
index 8d0f4748..764a4741 100644
--- a/R/anlz_fibmap.R
+++ b/R/anlz_fibmap.R
@@ -7,7 +7,7 @@
#'
#' @details This function is used to create FIB categories for mapping using \code{\link{show_fibmap}}. Categories based on relevant thresholds are assigned to each observation. The categories are specific to E. coli or Enterococcus and are assigned based on the station class as freshwater (\code{class} as 1 or 3F) or marine (\code{class} as 2 or 3M), respectively. A station is categorized into one of four ranges defined by the thresholds as noted in the \code{cat} column of the output, with corresponding colors appropriate for each range as noted in the \code{col} column of the output.
#'
-#' The \code{areasel} argument can indicate valid entries in the \code{area} column of \code{fibdata}. For example, use either \code{"Alafia River"} or \code{"Hillsborough River"} for the corresponding river basins, where rows in \code{fibdata} are filtered based on the the selection. All stations are returned if this argument is set as \code{NULL} (default). The Alafia River basin includes values in the \code{area} column of \code{fibdata} as \code{"Alafia River"} and \code{"Alafia River Tributary"}. The Hillsborough River basin includes values in the \code{area} column of \code{fibdat} as \code{"Hillsborough River"}, \code{"Hillsborough River Tributary"}, \code{"Lake Thonotosassa"}, \code{"Lake Thonotosassa Tributary"}, and \code{"Lake Roberta"}. Not all areas may be present based on the selection. All valid options for \code{areasel} include \code{"Alafia River"}, \code{"Hillsborough River"}, \code{"Big Bend"}, \code{"Cockroach Bay"}, \code{"East Lake Outfall"}, \code{"Hillsborough Bay"}, \code{"Little Manatee"}, \code{"Lower Tampa Bay"}, \code{"McKay Bay"}, \code{"Middle Tampa Bay"}, \code{"Old Tampa Bay"}, \code{"Palm River"}, \code{"Tampa Bypass Canal"}, or \code{"Valrico Lake"}.
+#' The \code{areasel} argument can indicate valid entries in the \code{area} column of \code{fibdata}. For example, use either \code{"Alafia River"} or \code{"Hillsborough River"} for the corresponding river basins, where rows in \code{fibdata} are filtered based on the the selection. All stations are returned if this argument is set as \code{NULL} (default). The Alafia River basin includes values in the \code{area} column of \code{fibdata} as \code{"Alafia River"} and \code{"Alafia River Tributary"}. The Hillsborough River basin includes values in the \code{area} column of \code{fibdat} as \code{"Hillsborough River"}, \code{"Hillsborough River Tributary"}, \code{"Lake Thonotosassa"}, \code{"Lake Thonotosassa Tributary"}, and \code{"Lake Roberta"}. Not all areas may be present based on the selection. All valid options for \code{areasel} include \code{"Alafia River"}, \code{"Hillsborough River"}, \code{"Big Bend"}, \code{"Cockroach Bay"}, \code{"East Lake Outfall"}, \code{"Hillsborough Bay"}, \code{"Little Manatee"}, \code{"Lower Tampa Bay"}, \code{"McKay Bay"}, \code{"Middle Tampa Bay"}, \code{"Old Tampa Bay"}, \code{"Palm River"}, \code{"Tampa Bypass Canal"}, or \code{"Valrico Lake"}. One to any of the options can be used.
#'
#' @return A \code{data.frame} similar to \code{fibdata} with additional columns describing station categories and optionally filtered by arguments passed to the function
#'
diff --git a/R/anlz_fibwetdry.R b/R/anlz_fibwetdry.R
index 7b81916c..ca780b83 100644
--- a/R/anlz_fibwetdry.R
+++ b/R/anlz_fibwetdry.R
@@ -50,7 +50,8 @@ anlz_fibwetdry <- function(fibdata,
# use threshold to show wet or dry
out <- dplyr::left_join(fibdata, prcp_calcd,
by = c("station", "date")) %>%
- dplyr::mutate(wet_sample = rain_total >= wet_threshold)
+ dplyr::mutate(wet_sample = rain_total >= wet_threshold) %>%
+ tibble::tibble()
return(out)
diff --git a/R/show_enteromap.R b/R/show_enteromap.R
index ff2c8590..c8f2d80d 100644
--- a/R/show_enteromap.R
+++ b/R/show_enteromap.R
@@ -17,14 +17,17 @@
#' # wet/dry samples
#' show_enteromap(enterodata, yrsel = 2020, mosel = 9, wetdry = TRUE,
#' temporal_window = 2, wet_threshold = 0.5)
-show_enteromap <- function(fibdata, yrsel, mosel, wetdry = FALSE,
+#'
+#' # Old Tampa Bay only
+#' show_enteromap(enterodata, yrsel = 2020, mosel = 9, areasel = "Old Tampa Bay")
+show_enteromap <- function(fibdata, yrsel, mosel, areasel = NULL, wetdry = FALSE,
precipdata = NULL, temporal_window = NULL,
wet_threshold = NULL){
# get categories
- fibmap <- anlz_enteromap(fibdata, yrsel = yrsel, mosel = mosel, wetdry = wetdry,
- precipdata = precipdata, temporal_window = temporal_window,
- wet_threshold = wet_threshold)
+ fibmap <- anlz_enteromap(fibdata, yrsel = yrsel, mosel = mosel, areasel = areasel,
+ wetdry = wetdry, precipdata = precipdata,
+ temporal_window = temporal_window, wet_threshold = wet_threshold)
# make a column even if wetdry wasn't selected
# and if it was, give it something other than true/false
@@ -115,8 +118,6 @@ show_enteromap <- function(fibdata, yrsel, mosel, wetdry = FALSE,
grep('ecoli', ., value = T) %>%
paste(collapse = '
') %>%
paste0('All samples
#/100mL
', .)
- title <- paste0('Enterococcus
', yrsel, '-', mosel, '%
@@ -126,8 +127,7 @@ show_enteromap <- function(fibdata, yrsel, mosel, wetdry = FALSE,
lat = ~Latitude,
icon = ~icons[as.numeric(grp)],
label = ~lapply(as.list(lab), util_html)
- ) %>%
- leaflet::addControl(html = title, position = 'topright')
+ )
# add appropriate legends
if(wetdry == TRUE){
@@ -139,8 +139,6 @@ show_enteromap <- function(fibdata, yrsel, mosel, wetdry = FALSE,
leaflet::addControl(html = ecocciallleg, position = 'topright')
}
-
-
return(out)
}
diff --git a/man/anlz_enteromap.Rd b/man/anlz_enteromap.Rd
index ec1092d2..da8b41fb 100644
--- a/man/anlz_enteromap.Rd
+++ b/man/anlz_enteromap.Rd
@@ -8,6 +8,7 @@ anlz_enteromap(
fibdata,
yrsel = NULL,
mosel = NULL,
+ areasel = NULL,
wetdry = FALSE,
precipdata = NULL,
temporal_window = NULL,
@@ -21,6 +22,8 @@ anlz_enteromap(
\item{mosel}{optional numeric to filter data by month}
+\item{areasel}{optional character string to filter output by stations in the \code{long_name} column of \code{enterodata}, see details}
+
\item{wetdry}{logical; if \code{TRUE}, incorporate wet/dry differences (this will result in a call to \code{\link{anlz_fibwetdry}}, in which case \code{temporal_window} and \code{wet_threshold} are required). If \code{FALSE} (default), do not differentiate between wet and dry samples.}
\item{precipdata}{input data frame as returned by \code{\link{read_importrain}}. columns should be: station, date (yyyy-mm-dd), rain (in inches). The object \code{\link{catchprecip}} has this data from 1995-2023 for select Enterococcus stations. If \code{NULL}, defaults to \code{\link{catchprecip}}.}
@@ -37,6 +40,8 @@ Assign threshold categories to Enterococcus data
}
\details{
This function is based on \code{\link{anlz_fibmap}}, but is specific to Enterococcus data downloaded via \code{\link{read_importentero}}. It creates categories for mapping using \code{\link{show_enteromap}}. Optionally, if samples have been defined as 'wet' or not via \code{\link{anlz_fibwetdry}}, this can be represented via symbols on the map. Categories based on relevant thresholds are assigned to each observation. The categories are specific to Enterococcus in marine waters (\code{class} of 2 or 3M). A station is categorized into one of four ranges defined by the thresholds as noted in the \code{cat} column of the output, with corresponding colors appropriate for each range as noted in the \code{col} column of the output.
+
+The \code{areasel} argument can indicate valid entries in the \code{long_name} column of \code{enterodata}. For example, use \code{"Old Tampa Bay"} for stations in the subwatershed of Old Tampa Bay, where rows in \code{enterodata} are filtered based on the the selection. All stations are returned if this argument is set as \code{NULL} (default). All valid options for \code{areasel} include \code{"Old Tampa Bay"}, \code{"Hillsborough Bay"}, \code{"Middle Tampa Bay"}, \code{"Lower Tampa Bay"}, \code{"Boca Ciega Bay"}, or \code{"Manatee River"}. One to any of the options can be used.
}
\examples{
anlz_enteromap(enterodata, yrsel = 2020, mosel = 9)
diff --git a/man/anlz_fibmap.Rd b/man/anlz_fibmap.Rd
index 13599b33..91631cab 100644
--- a/man/anlz_fibmap.Rd
+++ b/man/anlz_fibmap.Rd
@@ -24,7 +24,7 @@ Assign threshold categories to Fecal Indicator Bacteria (FIB) data
\details{
This function is used to create FIB categories for mapping using \code{\link{show_fibmap}}. Categories based on relevant thresholds are assigned to each observation. The categories are specific to E. coli or Enterococcus and are assigned based on the station class as freshwater (\code{class} as 1 or 3F) or marine (\code{class} as 2 or 3M), respectively. A station is categorized into one of four ranges defined by the thresholds as noted in the \code{cat} column of the output, with corresponding colors appropriate for each range as noted in the \code{col} column of the output.
-The \code{areasel} argument can indicate valid entries in the \code{area} column of \code{fibdata}. For example, use either \code{"Alafia River"} or \code{"Hillsborough River"} for the corresponding river basins, where rows in \code{fibdata} are filtered based on the the selection. All stations are returned if this argument is set as \code{NULL} (default). The Alafia River basin includes values in the \code{area} column of \code{fibdata} as \code{"Alafia River"} and \code{"Alafia River Tributary"}. The Hillsborough River basin includes values in the \code{area} column of \code{fibdat} as \code{"Hillsborough River"}, \code{"Hillsborough River Tributary"}, \code{"Lake Thonotosassa"}, \code{"Lake Thonotosassa Tributary"}, and \code{"Lake Roberta"}. Not all areas may be present based on the selection. All valid options for \code{areasel} include \code{"Alafia River"}, \code{"Hillsborough River"}, \code{"Big Bend"}, \code{"Cockroach Bay"}, \code{"East Lake Outfall"}, \code{"Hillsborough Bay"}, \code{"Little Manatee"}, \code{"Lower Tampa Bay"}, \code{"McKay Bay"}, \code{"Middle Tampa Bay"}, \code{"Old Tampa Bay"}, \code{"Palm River"}, \code{"Tampa Bypass Canal"}, or \code{"Valrico Lake"}.
+The \code{areasel} argument can indicate valid entries in the \code{area} column of \code{fibdata}. For example, use either \code{"Alafia River"} or \code{"Hillsborough River"} for the corresponding river basins, where rows in \code{fibdata} are filtered based on the the selection. All stations are returned if this argument is set as \code{NULL} (default). The Alafia River basin includes values in the \code{area} column of \code{fibdata} as \code{"Alafia River"} and \code{"Alafia River Tributary"}. The Hillsborough River basin includes values in the \code{area} column of \code{fibdat} as \code{"Hillsborough River"}, \code{"Hillsborough River Tributary"}, \code{"Lake Thonotosassa"}, \code{"Lake Thonotosassa Tributary"}, and \code{"Lake Roberta"}. Not all areas may be present based on the selection. All valid options for \code{areasel} include \code{"Alafia River"}, \code{"Hillsborough River"}, \code{"Big Bend"}, \code{"Cockroach Bay"}, \code{"East Lake Outfall"}, \code{"Hillsborough Bay"}, \code{"Little Manatee"}, \code{"Lower Tampa Bay"}, \code{"McKay Bay"}, \code{"Middle Tampa Bay"}, \code{"Old Tampa Bay"}, \code{"Palm River"}, \code{"Tampa Bypass Canal"}, or \code{"Valrico Lake"}. One to any of the options can be used.
}
\examples{
# assign categories to all
diff --git a/man/show_enteromap.Rd b/man/show_enteromap.Rd
index 6835f7be..09c42c73 100644
--- a/man/show_enteromap.Rd
+++ b/man/show_enteromap.Rd
@@ -8,6 +8,7 @@ show_enteromap(
fibdata,
yrsel,
mosel,
+ areasel = NULL,
wetdry = FALSE,
precipdata = NULL,
temporal_window = NULL,
@@ -21,6 +22,8 @@ show_enteromap(
\item{mosel}{optional numeric to filter data by month}
+\item{areasel}{optional character string to filter output by stations in the \code{long_name} column of \code{enterodata}, see details}
+
\item{wetdry}{logical; if \code{TRUE}, incorporate wet/dry differences (this will result in a call to \code{\link{anlz_fibwetdry}}, in which case \code{temporal_window} and \code{wet_threshold} are required). If \code{FALSE} (default), do not differentiate between wet and dry samples.}
\item{precipdata}{input data frame as returned by \code{\link{read_importrain}}. columns should be: station, date (yyyy-mm-dd), rain (in inches). The object \code{\link{catchprecip}} has this data from 1995-2023 for select Enterococcus stations. If \code{NULL}, defaults to \code{\link{catchprecip}}.}
@@ -44,6 +47,9 @@ show_enteromap(enterodata, yrsel = 2020, mosel = 9)
# wet/dry samples
show_enteromap(enterodata, yrsel = 2020, mosel = 9, wetdry = TRUE,
temporal_window = 2, wet_threshold = 0.5)
+
+# Old Tampa Bay only
+show_enteromap(enterodata, yrsel = 2020, mosel = 9, areasel = "Old Tampa Bay")
}
\seealso{
\code{\link{anlz_enteromap}} for details on the categories
diff --git a/tests/testthat/test-anlz_enteromap.R b/tests/testthat/test-anlz_enteromap.R
index 1679a542..c2d5bfbd 100644
--- a/tests/testthat/test-anlz_enteromap.R
+++ b/tests/testthat/test-anlz_enteromap.R
@@ -1,17 +1,17 @@
# These tests are copied and lightly modified from test-anlz_fibmap.R
-# Test case 1: Check if the output has the expected columns
+# Check if the output has the expected columns
test_that("Output has the expected columns for anlz_enteromap", {
result <- anlz_enteromap(enterodata)
- expected_columns <- c("station", "yr", "mo",
+ expected_columns <- c("station", "long_name", "yr", "mo",
"Latitude", "Longitude", "ecocci",
"cat", "col", "ind", "indnm", "conc")
expect_equal(colnames(result), expected_columns)
})
-# Test case 2: Check if filtering by year works correctly
+# Check if filtering by year works correctly
test_that("Filtering by year works correctly for anlz_enteromap", {
result <- anlz_enteromap(enterodata, yrsel = 2020)
@@ -20,7 +20,7 @@ test_that("Filtering by year works correctly for anlz_enteromap", {
})
-# Test case 3: Check if filtering by month works correctly
+# Check if filtering by month works correctly
test_that("Filtering by month works correctly for anlz_enteromap", {
result <- anlz_enteromap(enterodata, mosel = 7)
@@ -29,7 +29,16 @@ test_that("Filtering by month works correctly for anlz_enteromap", {
})
-# Test case 4: Check error no data
+# Check if filtering by area works correctly
+test_that("Filtering by area works correctly for anlz_enteromap", {
+
+ result <- anlz_enteromap(enterodata, areasel = 'Old Tampa Bay', mosel = 7)
+ expected_area <- 'Old Tampa Bay'
+ expect_equal(unique(result$long_name), expected_area)
+
+})
+
+# Check error no data
test_that("Checking error for no data with anlz_enteromap", {
expect_error(anlz_enteromap(enterodata, yrsel = 1900, mosel = 5))
diff --git a/vignettes/fib.Rmd b/vignettes/fib.Rmd
index 43947110..43754ead 100644
--- a/vignettes/fib.Rmd
+++ b/vignettes/fib.Rmd
@@ -220,8 +220,7 @@ Each `anlz` function has optional arguments that define the `temporal_window` an
The `anlz_fibwetdry()` function defines "wet" or "dry" samples as described above and returns the original input dataset with three additional columns describing the total rain (inches) on the day of sampling (`rain_sampleDay`), the total rain in the period defined by the `temporal_window` argument (`rain_total`), and whether the sample is "wet" or not as a logical value (`wet_sample`).
```{r}
-wetdry <- anlz_fibwetdry(enterodata, catchprecip, temporal_window = 2, wet_threshold = 0.5)
-head(wetdry)
+anlz_fibwetdry(enterodata, catchprecip, temporal_window = 2, wet_threshold = 0.5)
```
The remaining `anlz` functions are `anlz_enteromap()` to prepare data for mapping and `anlz_fibmatrix()` to prepare data for a score card. Both can optionally use `anlz_fibwetdry()` to plot "wet" or "dry" samples, described further in the `show` section.
@@ -229,8 +228,7 @@ The remaining `anlz` functions are `anlz_enteromap()` to prepare data for mappin
The `anlz_enteromap()` function is an *Enterococcus*-specific analogue to the `anlz_fibmap()` fecal coliform function described in the EPC section above. The function assigns categories to each observation in the *Enterococcus* data frame, which can be viewed for a given month and year using `show_enteromap()` (analagous to `show_fibmap()`). The categories are specific to *Enterococcus* in marine waters, and are noted in the `cat` column of the output. Corresponding colors are in the `col` column of the output.
```{r}
-enteromap <- anlz_enteromap(enterodata)
-head(enteromap)
+anlz_enteromap(enterodata)
```
The ranges (number of samples / 100 mL) are from EPC and are as follows for *Enterococcus*:
@@ -257,16 +255,20 @@ fibdata %>%
The `yrsel` and `mosel` arguments can be used to filter results by year and month. Not specifying these arguments will return results for the entire period of record.
```{r}
-enteromap <- anlz_enteromap(enterodata, yrsel = 2020, mosel = 8)
-head(enteromap)
+anlz_enteromap(enterodata, yrsel = 2020, mosel = 8)
```
The `wetdry` argument can be used to determine whether a sample was taken after a rain event (logical `wet_sample` column in output), based on user-specified thresholds and a provided precipitation data object (`catchprecip`). Below shows how to identify wet samples based on at least 0.5 inches of rain occurring two days prior to and including the sample date.
```{r}
-enteromap <- anlz_enteromap(enterodata, wetdry = TRUE, precipdata = catchprecip,
+anlz_enteromap(enterodata, wetdry = TRUE, precipdata = catchprecip,
temporal_window = 2, wet_threshold = 0.5)
-head(enteromap)
+```
+
+The `areasel` argument can indicate one or any of the major subwatersheds in Tampa Bay (excluding Terra Ceia Bay where no data exist). For example, use `Old Tampa Bay` for stations in the subwatershed of Old Tampa Bay, where rows in `enterodata` are filtered based on the selection. All stations are returned if this argument is set as `NULL` (default). All valid options for `areasel` include `"Old Tampa Bay"`, `"Hillsborough Bay"`, `"Middle Tampa Bay"`, `"Lower Tampa Bay"`, `"Boca Ciega Bay"`, or `"Manatee River"`.
+
+```{r}
+anlz_enteromap(enterodata, yrsel = 2023, mosel = 7, areasel = 'Old Tampa Bay')
```
The `anlz_fibmatrix()` function is used with the `show_fibmatrix()` function and is used similarly as for the EPC workflow described above. The function assigns Microbial Water Quality Assessment (MWQA) letter categories for each station and year based on the likelihood that *Enterococcus* concentrations will exceed 130 CFU / 100 mL. By default, the results for each year are based on a right-centered window that uses the previous two years and the current year to calculate probabilities from the monthly samples (`lagyr = 3`). The columns for each station and year include the estimated geometric mean of fecal coliform concentrations (`gmean`) and a category indicating a letter outcome based on the likelihood of exceedences (`cat`). The `indic` argument must be set explicitly as `'ecocci'` to select the indicator as *Enterococcus*.
@@ -279,17 +281,23 @@ anlz_fibmatrix(enterodata, indic = 'ecocci')
The `show_enteromap()` function creates a map of *Enterococcus* sites and thresholds based on output from `anlz_enteromap()`. The same arguments that apply to `anlz_enteromap()` also apply to `show_enteromap()`, including classification of samples as 'wet' or not depending on specified thresholds. Wet and dry samples are differentiated on the map by their shapes. Unlike `anlz_enteromap()`, the `yrsel` and `mosel` arguments are required.
-Additional information about a site can be seen by placing the cursor over a location. A map inset can also be seen by clicking the arrow on the bottom left of the map.
-
-```{r}
+```{r, out.width="100%"}
show_enteromap(enterodata, yrsel = 2020, mosel = 9)
```
-```{r}
+```{r, out.width="100%"}
show_enteromap(enterodata, yrsel = 2020, mosel = 9, wetdry = TRUE,
temporal_window = 2, wet_threshold = 0.5)
```
+Additional information about a site can be seen by placing the cursor over a location. A map inset can also be seen by clicking the arrow on the bottom left of the map.
+
+Sites for specific areas can be shown using the `areasel` argument.
+
+```{r, out.width="100%"}
+show_enteromap(enterodata, yrsel = 2023, mosel = 7, areasel = 'Old Tampa Bay')
+```
+
The `show_fibmatrix()` function creates a stoplight graphic of summarized FIB data at selected stations for each year of available data. The function was primarily designed for fecal coliform data, but has been adapted to work with *Enterococcus* data. The matrix color codes years and stations based on the likelihood of fecal indicator bacteria concentrations exceeding 130 CFU / 100 mL for *Enterococcus* (`ecocci` in both `fibdata` and `enterodata`). The likelihoods are categorized as A, B, C, D, or E (Microbial Water Quality Assessment or MWQA categories) with corresponding colors, where the breakpoints for each category are <10%, 10-30%, 30-50%, 50-75%, and >75% (right-closed). Methods and rationale for this categorization scheme are provided by the Florida Department of Environmental Protection, Figure 8 in @pbsj08 and @Morrison09. All stations are shown by default.
```{r, fig.height = 8, fig.width = 9}