| Title: | Data and Indicators for the Tampa Bay Estuary Program |
|---|---|
| Description: | Several functions are provided for working with Tampa Bay Estuary Program data and indicators, including the water quality report card, tidal creek assessments, Tampa Bay Nekton Index, Tampa Bay Benthic Index, seagrass transect data, habitat report card, and fecal indicator bacteria. Additional functions are provided for miscellaneous tasks, such as reference library curation. |
| Authors: | Marcus Beck [aut, cre] (ORCID: <https://orcid.org/0000-0002-4996-0059>), Meagan Schrandt [aut] (ORCID: <https://orcid.org/0000-0002-0482-5072>), Mike Wessel [aut], Ed Sherwood [aut] (ORCID: <https://orcid.org/0000-0001-5330-302X>), Gary Raulerson [aut] (ORCID: <https://orcid.org/0000-0002-5920-5743>), Adhokshaja Achar Budihal Prasad [aut] (ORCID: <https://orcid.org/0000-0002-6485-6858>), Benjamin Best [aut] (ORCID: <https://orcid.org/0000-0002-2686-0784>), Kim Cressman [aut] (ORCID: <https://orcid.org/0000-0002-8083-2434>) |
| Maintainer: | Marcus Beck <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 3.1.0.9028 |
| Built: | 2026-05-19 14:09:18 UTC |
| Source: | https://github.com/tbep-tech/tbeptools |
Tampa Bay intertidal and supratidal land use and cover for Habitat Master Plan reporting
acresacres
A data frame
## Not run: load(url("https://github.com/tbep-tech/hmpu-workflow/raw/master/data/acres.RData")) save(acres, file = 'data/acres.RData', compress = 'xz') ## End(Not run)## Not run: load(url("https://github.com/tbep-tech/hmpu-workflow/raw/master/data/acres.RData")) save(acres, file = 'data/acres.RData', compress = 'xz') ## End(Not run)
AMBI species group assignments for Tampa Bay benthic taxa
ambisppambispp
A data frame with 1983 rows and 5 variables:
int, join key to taxacounts in benthicdata
chr, taxon name
int, ecological group 1-5 for conventional AMBI (Gillett et al. 2015), NA if unclassified
int, ecological group 1-5 for Tampa Bay-specific AMBI, NA if unclassified
chr, provenance of the AMBI group assignment (Gulf, National, or assumption)
Ecological groups range from I (most sensitive to pollution) to V (most tolerant). The conventional AMBI groups (AMBIGroupID) follow published literature (Gillett et al. 2015), with Gulf of Mexico scores preferred over National scores, and family-level assumptions applied where species-level scores were unavailable. The Tampa Bay-specific groups (TBAMBIGroupID) are based on local sediment sample assignments.
This table is used as the species lookup in anlz_ambiscr to join ecological group assignments to observed taxa counts in benthicdata.
Gillett, D.J., Weisberg, S.B., Grayson, T., Hamilton, A., Hansen, V., Leppo, E.W., Pelletier, M.C., et al. (2015). Effect of ecological group classification schemes on performance of the AMBI benthic index in US coastal waters. Ecological Indicators, 50, 99-107. doi:10.1016/j.ecolind.2014.11.005
## Not run: library(readxl) library(dplyr) ambispp <- read_excel('data-raw/AMBI_EcoSource_ReportDeliverableToDK.xlsx') |> select(TaxaListID, NAME, AMBIGroupID, TBAMBIGroupID = TBAMBIGroupId, AMBIListSource) save(ambispp, file = 'data/ambispp.RData', compress = 'xz') ## End(Not run)## Not run: library(readxl) library(dplyr) ambispp <- read_excel('data-raw/AMBI_EcoSource_ReportDeliverableToDK.xlsx') |> select(TaxaListID, NAME, AMBIGroupID, TBAMBIGroupID = TBAMBIGroupId, AMBIListSource) save(ambispp, file = 'data/ambispp.RData', compress = 'xz') ## End(Not run)
Get annual medians of AMBI scores by bay segment
anlz_ambimed( ambiscr, bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB", "All"), rev = FALSE, yrrng = c(1993, 2024), window = TRUE )anlz_ambimed( ambiscr, bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB", "All"), rev = FALSE, yrrng = c(1993, 2024), window = TRUE )
ambiscr |
input data frame as returned by |
bay_segment |
chr string for the bay segment, one to many of "HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB", "All" |
rev |
logical if factor levels for bay segments are reversed |
yrrng |
numeric indicating year ranges to evaluate |
window |
logical indicating whether to use a rolling 5-year window (default TRUE) or single year values (FALSE) for the bay segment categories, see details |
An additional summary is provided for the entire bay as an unweighted summary across categories ("All").
Only sampling funded by TBEP and as part of the routine EPC benthic monitoring program are included in the final categories.
The default behavior is to use a rolling five-year window to calculate the percent of sites in each AMBI category by bay segment. This applies only to years 2005 and later, where the counts from the current year and the prior four years are summed to calculate the percentages. This is intended to help smooth out inter-annual variability due to reduced sampling effort from 2005 to present. If window = FALSE, then only single year values are used.
The AMBI category column (AMBICat or TBAMBICat) is based on the adjusted AMBI score (0-10 scale) using the classification thresholds defined in anlz_ambiscr.
A data frame of annual percent composition by AMBI category and bay segment
ambiscr <- anlz_ambiscr(benthicdata) anlz_ambimed(ambiscr)ambiscr <- anlz_ambiscr(benthicdata) anlz_ambimed(ambiscr)
Get AMBI scores for benthic stations
anlz_ambiscr(benthicdata, type = c("AMBI", "AMBI-TB"))anlz_ambiscr(benthicdata, type = c("AMBI", "AMBI-TB"))
benthicdata |
nested |
type |
chr string indicating which AMBI variant to calculate, one of |
This function calculates the AZTI Marine Biotic Index (AMBI) for benthic stations in Tampa Bay. The index assigns each taxon to one of five ecological groups (I = most sensitive, V = most tolerant to pollution) and computes a Biotic Coefficient (BC) from the proportion of taxa in each group.
The Biotic Coefficient is calculated as:
where \
An adjusted AMBI score on a 0-10 scale is also returned:
Higher adjusted scores indicate healthier benthic conditions. Azoic stations (empty samples, TaxaListID == 1942 in benthicdata) receive BC = 7 and adjusted score = 0.
Two variants are supported via the type argument. "AMBI" uses ecological group assignments from published literature (AMBIGroupID in ambispp). "AMBI-TB" uses Tampa Bay-specific assignments (TBAMBIGroupID in ambispp). The calculation is identical, only the group assignment column differs.
A data frame of AMBI scores for each station, with columns from benthicdata stations joined to:
int, total number of classified taxa records used in the calculation
num, percentage of taxa records in each ecological group
num, Biotic Coefficient (0-6 scale, or 7 for azoic)
num, adjusted AMBI score (0-10 scale)
chr, pollution category based on BC
chr, biotic index value (0-6 or Azoic)
chr, dominating ecological group based on BC
chr, community health descriptor based on BC
chr, adjusted AMBI category based on the 0-10 scale
Gillett, D.J., Weisberg, S.B., Grayson, T., Hamilton, A., Hansen, V., Leppo, E.W., Pelletier, M.C., et al. (2015). Effect of ecological group classification schemes on performance of the AMBI benthic index in US coastal waters. Ecological Indicators, 50, 99-107. doi:10.1016/j.ecolind.2014.11.005
anlz_ambiscr(benthicdata) anlz_ambiscr(benthicdata, type = 'AMBI-TB')anlz_ambiscr(benthicdata) anlz_ambiscr(benthicdata, type = 'AMBI-TB')
Get attainment categories for each year and bay segment using chlorophyll and light attenuation
anlz_attain(avedat, magdurout = FALSE, trgs = NULL)anlz_attain(avedat, magdurout = FALSE, trgs = NULL)
avedat |
result returned from |
magdurout |
logical indicating if the separate magnitude and duration estimates are returned |
trgs |
optional |
A data.frame for each year and bay segment showing the attainment category
avedat <- anlz_avedat(epcdata) anlz_attain(avedat)avedat <- anlz_avedat(epcdata) anlz_attain(avedat)
Get site attainment categories for chlorophyll or light attenuation
anlz_attainsite( avedatsite, thr = c("chla", "la"), trgs = NULL, yrrng = NULL, thrs = FALSE )anlz_attainsite( avedatsite, thr = c("chla", "la"), trgs = NULL, yrrng = NULL, thrs = FALSE )
avedatsite |
result returned from |
thr |
chr string indicating with water quality value and appropriate threshold to to plot, one of "chl" for chlorophyll and "la" for light availability |
trgs |
optional |
yrrng |
optional numeric value for year to return, defaults to all |
thrs |
logical indicating if attainment category is relative to targets (default) or thresholds |
This function is a simplication of the attainment categories returned by anlz_attain. Sites are only compared to the targets/thresholds that apply separately for chlorophyll or light attenuation.
a data.frame for each year and site showing the attainment category
avedatsite <- anlz_avedatsite(epcdata) anlz_attainsite(avedatsite)avedatsite <- anlz_avedatsite(epcdata) anlz_attainsite(avedatsite)
Estimate annual means for chlorophyll and secchi data
anlz_avedat(epcdata, partialyr = FALSE)anlz_avedat(epcdata, partialyr = FALSE)
epcdata |
|
partialyr |
logical indicating if incomplete annual data for the most recent year are approximated by five year monthly averages for each parameter |
Mean estimates for chlorophyll and secchi
# view average estimates anlz_avedat(epcdata)# view average estimates anlz_avedat(epcdata)
Estimate annual means by site for chlorophyll and secchi data
anlz_avedatsite(epcdata, partialyr = FALSE)anlz_avedatsite(epcdata, partialyr = FALSE)
epcdata |
|
partialyr |
logical indicating if incomplete annual data for the most recent year are approximated by five year monthly averages for each parameter |
Mean estimates for chlorophyll and secchi
# view average estimates anlz_avedatsite(epcdata)# view average estimates anlz_avedatsite(epcdata)
Assign threshold categories to Enterococcus data
anlz_enteromap( fibdata, yrsel = NULL, mosel = NULL, areasel = NULL, wetdry = FALSE, precipdata = NULL, temporal_window = NULL, wet_threshold = NULL, assf = FALSE )anlz_enteromap( fibdata, yrsel = NULL, mosel = NULL, areasel = NULL, wetdry = FALSE, precipdata = NULL, temporal_window = NULL, wet_threshold = NULL, assf = FALSE )
fibdata |
data frame of Enterococcus sample data as returned by |
yrsel |
optional numeric to filter data by year |
mosel |
optional numeric to filter data by month |
areasel |
optional character string to filter output by stations in the |
wetdry |
logical; if |
precipdata |
input data frame as returned by |
temporal_window |
numeric; required if |
wet_threshold |
numeric; required if |
assf |
logical indicating if the data are further processed as a simple features object with additional columns for |
This function is based on anlz_fibmap, but is specific to Enterococcus data downloaded via read_importentero. It creates categories for mapping using show_enteromap. Optionally, if samples have been defined as 'wet' or not via 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 (class of 2 or 3M). A station is categorized into one of four ranges defined by the thresholds as noted in the cat column of the output, with corresponding colors appropriate for each range as noted in the col column of the output.
The areasel argument can indicate valid entries in the long_name column of enterodata. For example, use "Old Tampa Bay" for stations in the subwatershed of Old Tampa Bay, where rows in enterodata are filtered based on the 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". One to any of the options can be used.
A data.frame similar to fibdata if assf = FALSE with additional columns describing station categories and optionally filtered by arguments passed to the function. A sf object if assf = TRUE with additional columns for show_enteromap.
anlz_enteromap(enterodata, yrsel = 2020, mosel = 9) # differentiate wet/dry samples in that time frame anlz_enteromap(enterodata, yrsel = 2020, mosel = 9, wetdry = TRUE, temporal_window = 2, wet_threshold = 0.5) # as sf object anlz_enteromap(enterodata, assf = TRUE)anlz_enteromap(enterodata, yrsel = 2020, mosel = 9) # differentiate wet/dry samples in that time frame anlz_enteromap(enterodata, yrsel = 2020, mosel = 9, wetdry = TRUE, temporal_window = 2, wet_threshold = 0.5) # as sf object anlz_enteromap(enterodata, assf = TRUE)
Assign threshold categories to Fecal Indicator Bacteria (FIB) data
anlz_fibmap(fibdata, yrsel = NULL, mosel = NULL, areasel = NULL, assf = FALSE)anlz_fibmap(fibdata, yrsel = NULL, mosel = NULL, areasel = NULL, assf = FALSE)
fibdata |
input FIB |
yrsel |
optional numeric value to filter output by years in |
mosel |
optional numeric value to filter output by month in |
areasel |
optional character string to filter output by stations in the |
assf |
logical indicating if the data are further processed as a simple features object with additional columns for |
This function is used to create FIB categories for mapping using 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 (class as 1 or 3F) or marine (class as 2 or 3M), respectively. A station is categorized into one of four ranges defined by the thresholds as noted in the cat column of the output, with corresponding colors appropriate for each range as noted in the col column of the output.
The input fibdata object can be one returned by either read_importfib or read_importwqp.
The areasel argument can indicate valid entries in the area column of fibdata from read_importfib or mancofibdata, pascofibdata, polcofibdata, or hcesdfibdata from read_importwqp. For example, use either "Alafia River" or "Hillsborough River" to show stations for the corresponding river basins, where rows in fibdata are filtered based on the the selection. All valid options for areasel for fibdata include "Alafia River", "Hillsborough River", "Cockroach Bay", "East Lake Outfall", "Hillsborough Bay", "Little Manatee", "Lower Tampa Bay", "McKay Bay", "Middle Tampa Bay", "Old Tampa Bay", "Palm River", "Tampa Bypass Canal", or "Valrico Lake". Valid options for areasel if the input data are from read_importwqp are any that are present in the area column for the respective input datasets (mancofibdata, pascofibdata, polcofibdata, or polcofibdata). One to any of the options can be used.All stations are returned if this argument is set as NULL (default). Not all areas may be present based on the year/month selection.
A data.frame similar to the input if assf = FALSE with additional columns describing station categories and optionally filtered by arguments passed to the function. A sf object if assf = TRUE with additional columns for show_fibmap.
# assign categories to all anlz_fibmap(fibdata) # filter by year, month, and area anlz_fibmap(fibdata, yrsel = 2020, mosel = 7, areasel = 'Alafia River') # as sf object anlz_fibmap(fibdata, assf = TRUE)# assign categories to all anlz_fibmap(fibdata) # filter by year, month, and area anlz_fibmap(fibdata, yrsel = 2020, mosel = 7, areasel = 'Alafia River') # as sf object anlz_fibmap(fibdata, assf = TRUE)
Analyze Fecal Indicator Bacteria categories over time by station or bay segment
anlz_fibmatrix( fibdata, yrrng = NULL, stas = NULL, bay_segment = NULL, lagyr = 3, subset_wetdry = c("all", "wet", "dry"), precipdata = NULL, temporal_window = NULL, wet_threshold = NULL, warn = TRUE )anlz_fibmatrix( fibdata, yrrng = NULL, stas = NULL, bay_segment = NULL, lagyr = 3, subset_wetdry = c("all", "wet", "dry"), precipdata = NULL, temporal_window = NULL, wet_threshold = NULL, warn = TRUE )
fibdata |
input data frame as returned by |
yrrng |
numeric vector indicating min, max years to include, defaults to range of years in data, see details |
stas |
optional vector of stations to include, see details |
bay_segment |
optional vector of bay segment names to include, supercedes |
lagyr |
numeric for year lag to calculate categories, see details |
subset_wetdry |
character, subset data frame to only wet or dry samples as defined by |
precipdata |
input data frame as returned by |
temporal_window |
numeric; required if |
wet_threshold |
numeric; required if |
warn |
logical to print warnings about stations with insufficient data, default |
This function is used to create output for plotting a matrix stoplight graphic for FIB categories by station. Each station (or bay segment) and year combination is categorized based on the likelihood of fecal indicator bacteria concentrations exceeding some threshold in a given year. For Enterococcus (marine), the default threshold is 130 CFU / 100 mL in a given year. For E. coli (fresh), the default threshold is 410 CFU / 100 mL. The proportions 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\
If the input data are from read_importentero (baywide assessment), the results can be summarized by bay segment if bay_segment is not NULL. The stas argument is ignored and all stations within each bay segment watershed are used to evaluate the FIB categories.
yrrng can be specified several ways. If yrrng = NULL, the year range of the data for the selected changes is chosen. User-defined values for the minimum and maximum years can also be used, or only a minimum or maximum can be specified, e.g., yrrng = c(2000, 2010) or yrrng = c(2000, NA). In the latter case, the maximum year will be defined by the data.
The default stations if the input is from read_importfib (EPC data) and if bay_segment is NULL are those used in TBEP report #05-13 (https://drive.google.com/file/d/1MZnK3cMzV7LRg6dTbCKX8AOZU0GNurJJ/view) for the Hillsborough River Basin Management Action Plan (BMAP) subbasins. These include Blackwater Creek (WBID 1482, EPC stations 143, 108), Baker Creek (WBID 1522C, EPC station 107), Lake Thonotosassa (WBID 1522B, EPC stations 135, 118), Flint Creek (WBID 1522A, EPC station 148), and the Lower Hillsborough River (WBID 1443E, EPC stations 105, 152, 137). Other stations can be plotted using the stas argument.
Input from read_importwqp for Manatee County (21FLMANA_WQX), Pasco County (21FLPASC_WQX), or Polk County (21FLPOLK_WQX) FIB data can also be used. The function has not been tested for other organizations.
A tibble object with FIB summaries by year and station including columns for the estimated geometric mean of Enterococcus (marine) or E. coli (fresh) concentrations (gmean), the proportion of samples exceeding 130 CFU / 100 mL (Enterococcus) or 410 CFU / 100 mL (exced), the count of samples (cnt), and a category indicating a letter outcome based on the proportion of exceedences (cat). Results can be summarized by bay segment if bay_segment is not NULL and the input data is from read_importentero.
anlz_fibmatrix(fibdata) # use different dataset anlz_fibmatrix(enterodata, lagyr = 1) # subset to only wet samples anlz_fibmatrix(enterodata, lagyr = 1, subset_wetdry = "wet", temporal_window = 2, wet_threshold = 0.5) # Manatee County data anlz_fibmatrix(mancofibdata, lagyr = 1)anlz_fibmatrix(fibdata) # use different dataset anlz_fibmatrix(enterodata, lagyr = 1) # subset to only wet samples anlz_fibmatrix(enterodata, lagyr = 1, subset_wetdry = "wet", temporal_window = 2, wet_threshold = 0.5) # Manatee County data anlz_fibmatrix(mancofibdata, lagyr = 1)
Identify Fecal Indicator Bacteria samples as coming from a 'wet' or 'dry' time period
anlz_fibwetdry(fibdata, precipdata, temporal_window = 2, wet_threshold = 0.5)anlz_fibwetdry(fibdata, precipdata, temporal_window = 2, wet_threshold = 0.5)
fibdata |
input data frame |
precipdata |
input data frame as returned by |
temporal_window |
numeric, number of days precipitation should be summed over (1 = day of sample only; 2 = day of sample + day before; etc.) |
wet_threshold |
numeric, inches accumulated through the defined temporal window, above which a sample should be defined as being from a 'wet' time period |
This function allows the user to specify a threshold for declaring a sample to be taken after an important amount of rain over an important amount of days, and declaring it to be 'wet'. This is of interest because samples taken after significant precipitation (definitions of this vary, which is why the user can specify desired thresholds) are more likely to exceed relevant bacterial thresholds. Identifying samples as 'wet' or not allows for calculation of further indices for wet and dry subsets of samples.
a data frame; the original fibdata data frame with three additional columns. rain_sampleDay is the total rain (inches) on the day of sampling, rain_total is the total rain (inches) for the period of time defined by temporal_window, and wet_sample is logical, indicating whether the rainfall for that station's catchment exceeded the amount over the time period specified in args.
entero_wetdry <- anlz_fibwetdry(enterodata, catchprecip) head(entero_wetdry)entero_wetdry <- anlz_fibwetdry(enterodata, catchprecip) head(entero_wetdry)
Evaluate Habitat Master Plan progress for report card
anlz_hmpreport(acres, subtacres, hmptrgs)anlz_hmpreport(acres, subtacres, hmptrgs)
acres |
|
subtacres |
|
hmptrgs |
|
The relevant output columns are targeteval and goaleval that indicate numeric values as -1 (target not met, trending below), 0 (target met, trending below), 0.5 (target not met, trending above), and 1 (target met, trending above).
Columns in the output are as follows:
Year of the assessment
Habitat type assessed
Coverage estimate for the year
Coverage estimate for the previous set of available data
Year for the previous set of available data
Strata for the habitat type
2030 target for the habitat type from the Habitat Master Plan
2050 goal for the habitat type from the Habitat Master Plan
Difference in acres for the current year and the previous set of available data
Difference in years for the current year and the previous set of available data
Acreage change per year for the current year relative to the previous set of available data
Annual rate required to achieve the 2030 target
Annual rate required to achieve the 2050 goal
Proportion of target met for the current year
Proportion of goal met for the current year
A number indicating target status of the current year for the report card
A number indicating goal status of the current year for the report card
The numbers in targeteval and goaleval are one of four values as -1, 0, 0.5, and 1. These numbers define the status for the assessment year:
target or goal not met, trending below
target or goal met, trending below
target or goal not met, trending above
target or goal met, trending above
A summarized data.frame appropriate for creating a report card
# view summarized data for report card anlz_hmpreport(acres, subtacres, hmptrgs)# view summarized data for report card anlz_hmpreport(acres, subtacres, hmptrgs)
Estimate hydrological estimates and adjustment factors for bay segments
anlz_hydroload(yrs, noaa_key = NULL, trace = FALSE)anlz_hydroload(yrs, noaa_key = NULL, trace = FALSE)
yrs |
numeric vector indicating years to return |
noaa_key |
user-supplied NOAA key, see details |
trace |
logical indicating if function progress is printed in the consol |
This function uses rainfall and streamflow data from NOAA and USGS and requires an API key. See the webpage https://www.ncdc.noaa.gov/cdo-web/token for retrieving a NOAA token. This key can be added to the R environment file and called for later use, see the examples.
These estimates are used in annual compliance assessment reports produced by the Tampa Bay Nitrogen Management Consortium. Load estimates and adjustment factors are based on regression models in https://drive.google.com/file/d/11NT0NQ2WbPO6pVZaD7P7Z6qjcwO1jxHw/view?usp=drivesdk
A data frame with hydrological load estimates by bay segments for the requested years
## Not run: # this function requires an API key # save it to the R environment file (only once) # save the key, do only once cat("NOAA_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n", file=file.path(normalizePath("~/"), ".Renviron"), append=TRUE) # retrieve the key after saving, may need to restart R noaa_key <- Sys.getenv('NOAA_key') # get estimates for 2021 anlz_hydroload(2021, noaa_key) ## End(Not run)## Not run: # this function requires an API key # save it to the R environment file (only once) # save the key, do only once cat("NOAA_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n", file=file.path(normalizePath("~/"), ".Renviron"), append=TRUE) # retrieve the key after saving, may need to restart R noaa_key <- Sys.getenv('NOAA_key') # get estimates for 2021 anlz_hydroload(2021, noaa_key) ## End(Not run)
Format raw IWR data
anlz_iwrraw(iwrraw, tidalcreeks, yr = 2025)anlz_iwrraw(iwrraw, tidalcreeks, yr = 2025)
iwrraw |
FDEP impaired waters rule data base as |
tidalcreeks |
|
yr |
numeric for reference year to evaluate, scores are based on ten years of data using |
The function subsets the raw IWR data for ten years starting at the value in yr and subsets by the creek population in tidalcreeks. Select water quality parameters in masterCode are filtered and some of the names are combined for continuity.
A data.frame with the formatted data
anlz_iwrraw(iwrraw, tidalcreeks, yr = 2025)anlz_iwrraw(iwrraw, tidalcreeks, yr = 2025)
Convert references csv to bib
anlz_refs(path)anlz_refs(path)
path |
chr string of path to reference csv file or data frame object |
A data frame with references formatted as bib entries
# input and format path <- system.file('tbep-refs.csv', package = 'tbeptools') bibs <- anlz_refs(path) ## Not run: # save output writeLines(bibs, 'formatted.bib') ## End(Not run)# input and format path <- system.file('tbep-refs.csv', package = 'tbeptools') bibs <- anlz_refs(path) ## Not run: # save output writeLines(bibs, 'formatted.bib') ## End(Not run)
Add contaminant totals to sediment data
anlz_sedimentaddtot( sedimentdata, yrrng = c(1993, 2024), bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB"), funding_proj = "TBEP", param = NULL, pelave = TRUE )anlz_sedimentaddtot( sedimentdata, yrrng = c(1993, 2024), bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB"), funding_proj = "TBEP", param = NULL, pelave = TRUE )
sedimentdata |
input sediment |
yrrng |
numeric vector indicating min, max years to include, use single year for one year of data |
bay_segment |
chr string for the bay segment, one to many of "HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB" |
funding_proj |
chr string for the funding project, one to many of "TBEP" (default), "TBEP-Special", "Apollo Beach", "Janicki Contract", "Rivers", "Tidal Streams" |
param |
optional character string of a parameter to filter the results |
pelave |
logical indicating if output is used for |
This function adds totals to the sedimentdata input for total PCBs, total DDT, total LMW PAH, total HMW PAH, and total PAH. Appropriate TEL/PEL values for the totals are also added.
A data.frame object similar to the input, but filtered by the arguments and contaminant totals added. Replicate samples are also removed.
anlz_sedimentaddtot(sedimentdata)anlz_sedimentaddtot(sedimentdata)
Get average concentrations for a sediment parameter by bay segment
anlz_sedimentave( sedimentdata, param, yrrng = c(1993, 2024), bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB"), funding_proj = "TBEP" )anlz_sedimentave( sedimentdata, param, yrrng = c(1993, 2024), bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB"), funding_proj = "TBEP" )
sedimentdata |
input sediment |
param |
chr string for which parameter to plot |
yrrng |
numeric vector indicating min, max years to include, use single year for one year of data |
bay_segment |
chr string for the bay segment, one to many of "HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB" |
funding_proj |
chr string for the funding project, one to many of "TBEP" (default), "TBEP-Special", "Apollo Beach", "Janicki Contract", "Rivers", "Tidal Streams" |
Summaries for all bay segments are returned by default. The averages and confidence intervals are specific to the year ranges in yrrng.
A data.frame object with average sediment concentrations for the selected parameter by bay segment
anlz_sedimentave(sedimentdata, param = 'Arsenic')anlz_sedimentave(sedimentdata, param = 'Arsenic')
Get sediment PEL ratios at stations in Tampa Bay
anlz_sedimentpel( sedimentdata, yrrng = c(1993, 2024), bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB"), funding_proj = "TBEP" )anlz_sedimentpel( sedimentdata, yrrng = c(1993, 2024), bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB"), funding_proj = "TBEP" )
sedimentdata |
input sediment |
yrrng |
numeric vector indicating min, max years to include, use single year for one year of data |
bay_segment |
chr string for the bay segment, one to many of "HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB" |
funding_proj |
chr string for the funding project, one to many of "TBEP" (default), "TBEP-Special", "Apollo Beach", "Janicki Contract", "Rivers", "Tidal Streams" |
Average PEL ratios for all contaminants graded from A to F for benthic stations monitored in Tampa Bay are estimated. The PEL is a measure of how likely a contaminant is to have a toxic effect on invertebrates that inhabit the sediment. The PEL ratio is the contaminant concentration divided by the Potential Effects Levels (PEL) that applies to a contaminant, if available. Higher ratios and lower grades indicate sediment conditions that are likely unfavorable for invertebrates. The station average combines the PEL ratios across all contaminants measured at a station and the grade applies to the average.
The grade breaks for the PEL ratio are 0.00756, 0.02052, 0.08567, and 0.28026, with lower grades assigned to the higher breaks.
A data.frame object with average PEL ratios and grades at each station
anlz_sedimentpel(sedimentdata)anlz_sedimentpel(sedimentdata)
Get average concentrations for a sediment parameter by bay segment
anlz_sedimentpelave( sedimentdata, yrrng = c(1993, 2024), bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB"), funding_proj = "TBEP" )anlz_sedimentpelave( sedimentdata, yrrng = c(1993, 2024), bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB"), funding_proj = "TBEP" )
sedimentdata |
input sediment |
yrrng |
numeric vector indicating min, max years to include, use single year for one year of data |
bay_segment |
chr string for the bay segment, one to many of "HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB" |
funding_proj |
chr string for the funding project, one to many of "TBEP" (default), "TBEP-Special", "Apollo Beach", "Janicki Contract", "Rivers", "Tidal Streams" |
Summaries for all bay segments are returned by default. The averages and confidence intervals are specific to the year ranges in yrrng.
A data.frame of the average of the average PEL ratios for each bay segment
anlz_sedimentpelave(sedimentdata)anlz_sedimentpelave(sedimentdata)
Analyze time series data split by date within years
anlz_splitdata( df, date_split, date_col = "date", value_col = "value", stats = list(avg = mean) )anlz_splitdata( df, date_split, date_col = "date", value_col = "value", stats = list(avg = mean) )
df |
data frame containing date and value columns |
date_split |
date to split analysis into annual periods |
date_col |
name of the date column |
value_col |
name of the value column |
stats |
list of functions to apply to values, default: |
A tibble summarizing data for annual periods "before" and "after" the split date
# Create sample data data <- data.frame( date = seq.Date(as.Date("2010-01-01"), as.Date("2020-12-31"), by = "month"), value = rnorm(132, mean = 10, sd = 2)) # Basic analysis with default statistics split_date <- as.Date("2015-06-15") anlz_splitdata(data, split_date, "date", "value")# Create sample data data <- data.frame( date = seq.Date(as.Date("2010-01-01"), as.Date("2020-12-31"), by = "month"), value = rnorm(132, mean = 10, sd = 2)) # Basic analysis with default statistics split_date <- as.Date("2015-06-15") anlz_splitdata(data, split_date, "date", "value")
Analyze storm data split by date within years
anlz_splitstorms( df_hurricane, date_split, stats = list(sum = sum, avg = mean, n = length) )anlz_splitstorms( df_hurricane, date_split, stats = list(sum = sum, avg = mean, n = length) )
df_hurricane |
data frame containing date_beg and scale columns for hurricanes |
date_split |
date to split analysis into annual periods |
stats |
list of functions to apply to scale values, default: sum, average and count. Functions should accept numeric vector input and return single value |
A tibble summarizing hurricanes for annual periods "before" and "after" the split date, with requested statistics computed for the scale values
# Create sample hurricane data hurricanes <- data.frame( date_beg = as.Date(c( "1980-07-31", "1980-09-04", "1980-11-07", "1981-05-06", "1981-08-07", "1981-11-12")), scale = c(6, 1, 3, 1, 2, 1)) # Basic analysis with default statistics (sum, average and count) split_date <- Sys.Date() - lubridate::years(1) anlz_splitstorms(hurricanes, split_date) # Analysis with custom statistics anlz_splitstorms(hurricanes, split_date, stats = list( max = max, min = min))# Create sample hurricane data hurricanes <- data.frame( date_beg = as.Date(c( "1980-07-31", "1980-09-04", "1980-11-07", "1981-05-06", "1981-08-07", "1981-11-12")), scale = c(6, 1, 3, 1, 2, 1)) # Basic analysis with default statistics (sum, average and count) split_date <- Sys.Date() - lubridate::years(1) anlz_splitstorms(hurricanes, split_date) # Analysis with custom statistics anlz_splitstorms(hurricanes, split_date, stats = list( max = max, min = min))
Get annual medians of Tampa Bay Benthic Index scores by bay segment
anlz_tbbimed( tbbiscr, bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB", "All", "All (wt)"), rev = FALSE, yrrng = c(1993, 2024), window = TRUE )anlz_tbbimed( tbbiscr, bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB", "All", "All (wt)"), rev = FALSE, yrrng = c(1993, 2024), window = TRUE )
tbbiscr |
input data frame as returned by |
bay_segment |
chr string for the bay segment, one to many of "HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB", "All", "All (wt)" |
rev |
logical if factor levels for bay segments are reversed |
yrrng |
numeric indicating year ranges to evaluate |
window |
logical indicating whether to use a rolling 5-year window (default TRUE) or single year values (FALSE) for the bay segment categories, see details |
Additional summaries are provided for the entire bay, as a summary across categories ("All") and a summary weighted across the relative sizes of each bay segment ("All (wt)").
Only sampling funded by TBEP and as part of the routine EPC benthic monitoring program are included in the final categories.
The default behavior is to use a rolling five-year window to calculate the percent of sites in each TBBI category by bay segment. This applies only to years 2005 and later, where the counts from the current year and the prior four years are summed to calculate the percentages. This is intended to help smooth out inter-annual variability due to reduced sampling effort from 2005 to present. If window = FALSE, then only single year values are used.
A data frame of annual medians by bay segment
tbbiscr <- anlz_tbbiscr(benthicdata) anlz_tbbimed(tbbiscr)tbbiscr <- anlz_tbbiscr(benthicdata) anlz_tbbimed(tbbiscr)
Get Tampa Bay Benthic Index scores
anlz_tbbiscr(benthicdata)anlz_tbbiscr(benthicdata)
benthicdata |
nested |
This function calculates scores for the TBBI based on station, taxa, and field sample data. The total TBBI scores are returned as TBBI and TBBICat, where the latter is a categorical description of the scores.
A single data frame of TBBI scores for each site.
anlz_tbbiscr(benthicdata)anlz_tbbiscr(benthicdata)
Get annual averages of Tampa Bay Nekton Index scores by bay segment
anlz_tbniave( tbniscr, bay_segment = c("OTB", "HB", "MTB", "LTB"), rev = FALSE, perc = c(32, 46) )anlz_tbniave( tbniscr, bay_segment = c("OTB", "HB", "MTB", "LTB"), rev = FALSE, perc = c(32, 46) )
tbniscr |
input data frame as returned by |
bay_segment |
chr string for the bay segment, one to many of "OTB", "HB", "MTB", "LTB" |
rev |
logical if factor levels for bay segments are reversed |
perc |
numeric values indicating break points for score categories |
A data frame of annual averages by bay segment
tbniscr <- anlz_tbniscr(fimdata) anlz_tbniave(tbniscr)tbniscr <- anlz_tbniscr(fimdata) anlz_tbniave(tbniscr)
Get all raw metrics for Tampa Bay Nekton Index
anlz_tbnimet(fimdata, all = FALSE)anlz_tbnimet(fimdata, all = FALSE)
fimdata |
|
all |
logical indicating if only TBNI metrics are returned (default), otherwise all are calcualted |
All raw metrics are returned in addition to those required for the TBNI. Each row shows metric values for a station, year, and month where fish catch data were available.
A data frame of raw metrics in wide fomat. If all = TRUE, all metrics are returned, otherwise only NumTaxa, BenthicTaxa, TaxaSelect, NumGuilds, and Shannon are returned.
anlz_tbnimet(fimdata)anlz_tbnimet(fimdata)
Get Tampa Bay Nekton Index scores
anlz_tbniscr(fimdata, raw = TRUE)anlz_tbniscr(fimdata, raw = TRUE)
fimdata |
|
raw |
logical indicating if raw metric values are also returned |
This function calculates raw and scored metrics for the TBNI, including NumTaxa, BenthicTaxa, TaxaSelect, NumGuilds, and Shannon. The total TBNI score is returned as TBNI_Score.
A data frame of metrics and TBNI scores in wide format.
anlz_tbniscr(fimdata)anlz_tbniscr(fimdata)
Estimate tidal creek report card scores
anlz_tdlcrk(tidalcreeks, iwrraw, tidtrgs = NULL, yr = 2025)anlz_tdlcrk(tidalcreeks, iwrraw, tidtrgs = NULL, yr = 2025)
tidalcreeks |
|
iwrraw |
FDEP impaired waters data base as |
tidtrgs |
optional |
yr |
numeric for reference year to evaluate, scores are based on the planning period beginning ten years prior to this date |
A data.frame with the report card scores for each creek, as prioritize, investigate, caution, monitor, or no data
anlz_tdlcrk(tidalcreeks, iwrraw, yr = 2025)anlz_tdlcrk(tidalcreeks, iwrraw, yr = 2025)
Estimate tidal creek water quality indicators to support report card scores
anlz_tdlcrkindic(tidalcreeks, iwrraw, yr = 2025, radar = FALSE)anlz_tdlcrkindic(tidalcreeks, iwrraw, yr = 2025, radar = FALSE)
tidalcreeks |
|
iwrraw |
FDEP impaired waters rule data base as |
yr |
numeric for reference year to evaluate, scores are based on the planning period beginning ten years prior to this date |
radar |
logical indicating if output is for |
Annual geometric means for additional water quality data available at each wbid, JEI combination. Florida trophic state index values are also estimated where data are available.
Nitrogen ratios are estimated for JEIs that cover source (upstream, freshwater) and tidal (downstream) WBIDs, defined as the ratio of concentrations between the two (i.e., ratios > 1 mean source has higher concentrations). Nitrogen ratios for a given year reflect the ratio of the median nitrogen concentrations when they were measured in both a source and tidal segment during the same day. Note that a ratio of one can be obtained if both the source and tidal segments are at minimum detection.
Indicators for years where more than 10\
If radar = TRUE, output is returned in a format for use with show_tdlcrkradar Specifically, results are calculated as the percentage of years where an indicator exceeds a relevant threshold. This only applies to the marine WBIDs of the tidal creeks (Florida DEP class 2, 3M). Six indicators are returned with percentage exceedances based on total nitrogen (tn_ind) greater than 1.1 mg/L, chlorophyll (chla_ind) greater than 11 ug/L, trophic state index (tsi_ind) greater than 55 (out of 100), nitrate/nitrite ratio between marine and upstream segments (nox_ind) greater than one, chlorophyll and total nitrogen ratios > 15, and percentage of years more where than ten percent of observations were below DO percent saturation of 42.
A data.frame with the indicator values for each tidal creek
dat <- anlz_tdlcrkindic(tidalcreeks, iwrraw, yr = 2025) head(dat)dat <- anlz_tdlcrkindic(tidalcreeks, iwrraw, yr = 2025) head(dat)
Get annual averages of seagrass frequency occurrence by bay segments and year
anlz_transectave( transectocc, bay_segment = c("OTB", "HB", "MTB", "LTB", "BCB"), total = TRUE, yrrng = c(1998, 2025), rev = FALSE )anlz_transectave( transectocc, bay_segment = c("OTB", "HB", "MTB", "LTB", "BCB"), total = TRUE, yrrng = c(1998, 2025), rev = FALSE )
transectocc |
data frame returned by |
bay_segment |
chr string for the bay segment, one to many of "OTB", "HB", "MTB", "LTB", "BCB" |
total |
logical indicating if average frequency occurrence is calculated for the entire bay across segments |
yrrng |
numeric indicating year ranges to evaluate |
rev |
logical if factor levels for bay segments are reversed |
The focat column returned in the results shows a color category based on arbitrary breaks of the frequency occurrence estimates (foest) at 25, 50, and 75 percent. These don't necessarily translate to any ecological breakpoints.
A data frame of annual averages by bay segment
## Not run: transect <- read_transect() ## End(Not run) transectocc <- anlz_transectocc(transect) anlz_transectave(transectocc)## Not run: transect <- read_transect() ## End(Not run) transectocc <- anlz_transectocc(transect) anlz_transectave(transectocc)
Get annual averages of seagrass frequency occurrence by bay segments, year, and species
anlz_transectavespp( transectocc, bay_segment = c("OTB", "HB", "MTB", "LTB", "BCB"), yrrng = c(1998, 2025), species = c("Halodule", "Syringodium", "Thalassia", "Ruppia", "Halophila", "Caulerpa", "Dapis", "Chaetomorpha"), total = TRUE, by_seg = FALSE )anlz_transectavespp( transectocc, bay_segment = c("OTB", "HB", "MTB", "LTB", "BCB"), yrrng = c(1998, 2025), species = c("Halodule", "Syringodium", "Thalassia", "Ruppia", "Halophila", "Caulerpa", "Dapis", "Chaetomorpha"), total = TRUE, by_seg = FALSE )
transectocc |
data frame returned by |
bay_segment |
chr string for the bay segment, one to many of "OTB", "HB", "MTB", "LTB", "BCB" |
yrrng |
numeric indicating year ranges to evaluate |
species |
chr string of species to summarize, one to many of "Halodule", "Syringodium", "Thalassia", "Ruppia", "Halophila", "Caulerpa", "Dapis", "Chaetomorpha" |
total |
logical indicating if total frequency occurrence for all species is also returned |
by_seg |
logical indicating if separate results by bay segments are retained |
Frequency occurrence estimates are averaged across segments in bay_segment if by_seg = F, i.e., separate results by location are not returned. Results are retained by bay segment if by_seg = T.
A data frame of annual averages by bay segment
## Not run: transect <- read_transect() ## End(Not run) transectocc <- anlz_transectocc(transect) anlz_transectavespp(transectocc)## Not run: transect <- read_transect() ## End(Not run) transectocc <- anlz_transectocc(transect) anlz_transectavespp(transectocc)
Get seagrass average abundance and occurrence across transects
anlz_transectocc(transect)anlz_transectocc(transect)
transect |
data frame returned by |
Abundance and frequency occurrence are estimated as in Sherwood et al. 2017, equations 1 and 2. In short, frequency occurrence is estimated as the number of instances a species was observed along a transect divided by the number of placements along a transect and average abundance was estimated as the sum of species-specific Braun-Blanquet scores divided by the number of placements along a transect. The estimates are obtained for all seagrass species including Caulerpa (attached macroalgae), Dapis (cyanobacteria), and Chaetomorpha (drift green algea), whereas all other attached and drift algae species are aggregated. Drift or attached macroalgae and cyanobacteria (Dapis) estimates may not be accurate prior to 2021. Values for total include total frequency occurrence only for seagrass species (Halodule, Syringodium, Thalassia, Ruppia, Halophila).
A data frame with abundance and frequency occurrence estimates aggregated by species, transect, and date. The nsites column is the total number of placements that were sampled along a transect for a particular date.
Sherwood, E.T., Greening, H.S., Johansson, J.O.R., Kaufman, K., Raulerson, G.E. 2017. Tampa Bay (Florida, USA): Documenting seagrass recovery since the 1980's and reviewing the benefits. Southeastern Geographer. 57(3):294-319.
## Not run: transect <- read_transect() ## End(Not run) anlz_transectocc(transect)## Not run: transect <- read_transect() ## End(Not run) anlz_transectocc(transect)
Get attainment categories for a chosen year
anlz_yrattain(epcdata, yrsel, partialyr = FALSE)anlz_yrattain(epcdata, yrsel, partialyr = FALSE)
epcdata |
data frame of epc data returned by |
yrsel |
numeric indicating chosen year |
partialyr |
logical indicating if incomplete annual data for the most recent year are approximated by five year monthly averages for each parameter |
A data.frame for the chosen year and all bay segments showing the bay segment averages for chloropyll concentration, light attenuations, segment targets, and attainment categories.
# defaults to current year anlz_yrattain(epcdata, yrsel = 2025)# defaults to current year anlz_yrattain(epcdata, yrsel = 2025)
Benthic data for the Tampa Bay Benthic Index current as of 20251225
benthicdatabenthicdata
A nested tibble with 3 rows and 2 variables:
chr identifying the dataset as stations, fieldsamples, or taxacounts
list of dataframes for each dataset
Index the corresponding list element in the value column to view each dataset. For example, the stations data in the first row can be viewed as benthicdata$value[[1]].
## Not run: # location to download data path <- '~/Desktop/benthic.zip' # load and assign to object benthicdata <- read_importbenthic(path, download_latest = TRUE, remove = TRUE) save(benthicdata, file = 'data/benthicdata.RData', compress = 'xz') ## End(Not run)## Not run: # location to download data path <- '~/Desktop/benthic.zip' # load and assign to object benthicdata <- read_importbenthic(path, download_latest = TRUE, remove = TRUE) save(benthicdata, file = 'data/benthicdata.RData', compress = 'xz') ## End(Not run)
Catchments and radar pixels (for precip) of selected Enterococcus stations
catchpixelscatchpixels
A data frame with two columns:
a character string of the Water Quality Portal station name
a number; each row is a single pixel from the Southwest Florida Water Management District's radar-estimated rainfall shapefile
Generated by data-raw/catchpixels-raw.R (view on github: https://github.com/tbep-tech/tbeptools/blob/master/data-raw/catchpixels-raw.R)
Daily precip by catchment for selected Enterococcus stations
catchprecipcatchprecip
A data frame with three columns:
a character string of the Water Quality Portal station name
a date
a number; inches of rain for that date, averaged across all pixels in the station's catchment
Daily precipitation data for multiple years, provided by the Southwest Florida Water Management District, were downloaded at the pixel level and averaged to the catchment level for key Enterococcus sampling stations. Created using read_importrainmany.
Southwest Florida Management District radar-estimated daily rainfall data, ftp://ftp.swfwmd.state.fl.us/pub/radar_rainfall/Daily_Data/
## Not run: catchprecip <- read_importrainmany(1995:2025, quiet = F) save(catchprecip, file = 'data/catchprecip.RData') ## End(Not run)## Not run: catchprecip <- read_importrainmany(1995:2025, quiet = F) save(catchprecip, file = 'data/catchprecip.RData') ## End(Not run)
Spatial data object of minor subbasins (dbasins) in the Tampa Bay watershed
dbasindbasin
A simple features sf object (POLYGON) with 436 features and 26 fields, +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
library(sf) plot(st_geometry(dbasin))library(sf) plot(st_geometry(dbasin))
Enterococcus data from 53 key Enterococcus stations since 1995
enterodataenterodata
A data frame with 6885 rows and 16 columns:
datedate, sample date
yrnumeric, year of sample date
monumeric, month of sample date
timecharacter, sample time
time_zonecharacter, sample time zone
long_namecharacter, long name of bay segment subwatershed
bay_segmentcharacter, short name of bay segment subwatershed
stationcharacter, sample station
enteronumeric, Enterococcus concentration
entero_censoredlogical, whether entero value was below the laboratory MDL, minimum detection limit
MDLnumeric, minimum detection limit at the time of processing
entero_unitscharacter, units of measurement for entero
qualifierqualifier codes associated with sample
LabCommentslab comments on sample
Latitudenumeric, latitude in decimal degrees
Longitudenumeric, longitude in decimal degrees
A dataset containing Enterococcus from 53 stations in the TBEP watershed since 1995.
Water Quality Portal, https://waterqualitydata.us
## Not run: enterodata <- read_importentero(startDate = '1995-01-01', endDate = '2025-12-31') save(enterodata, file = 'data/enterodata.RData') ## End(Not run)## Not run: enterodata <- read_importentero(startDate = '1995-01-01', endDate = '2025-12-31') save(enterodata, file = 'data/enterodata.RData') ## End(Not run)
All bay data as of 20260203
epcdataepcdata
A data frame with 29041 rows and 26 variables:
chr
num
POSIXct
num
num
num
num
num
num
num
chr
num
num
chr
num
chr
num
num
num
num
num
num
num
num
num
num
## Not run: xlsx <- '~/Desktop/epcdata.xlsx' epcdata <- read_importwq(xlsx, download_latest = TRUE) nrow(epcdata) ncol(epcdata) save(epcdata, file = 'data/epcdata.RData', compress = 'xz') ## End(Not run)## Not run: xlsx <- '~/Desktop/epcdata.xlsx' epcdata <- read_importwq(xlsx, download_latest = TRUE) nrow(epcdata) ncol(epcdata) save(epcdata, file = 'data/epcdata.RData', compress = 'xz') ## End(Not run)
All Fecal Indicator Bacteria (FIB) data as of 20260302
fibdatafibdata
A data frame with 31081 rows and 18 variables:
chr
num
chr
POSIXct
num
num
num
num
num
num
num
chr
num
chr
num
chr
num
chr
This dataset includes FIB data from the Environmental Protection Commission where station class is marine (3M, 2) and Enterococcus data is present or the station class is freshwater (3F, 1) and E. coli data is present. The data is formatted from the raw data loaded from read_importfib.
## Not run: xlsx <- tempfile(fileext = '.xlsx') fibdata <- read_importfib(xlsx, download_latest = TRUE) nrow(fibdata) ncol(fibdata) save(fibdata, file = 'data/fibdata.RData') file.remove(xlsx) ## End(Not run)## Not run: xlsx <- tempfile(fileext = '.xlsx') fibdata <- read_importfib(xlsx, download_latest = TRUE) nrow(fibdata) ncol(fibdata) save(fibdata, file = 'data/fibdata.RData') file.remove(xlsx) ## End(Not run)
FIM data for Tampa Bay Nekton Index current as of 09032025
fimdatafimdata
A data frame with 53969 rows and 19 variables:
chr
Date
num
num
chr
int
chr
num
num
num
chr
chr
chr
chr
chr
chr
chr
chr
chr
## Not run: csv <- '~/Desktop/TampaBay_NektonIndexData.csv' fimdata <- read_importfim(csv, download_latest = TRUE) save(fimdata, file = 'data/fimdata.RData', compress = 'xz') ## End(Not run)## Not run: csv <- '~/Desktop/TampaBay_NektonIndexData.csv' fimdata <- read_importfim(csv, download_latest = TRUE) save(fimdata, file = 'data/fimdata.RData', compress = 'xz') ## End(Not run)
Spatial data object of FIM stations including Tampa Bay segments
fimstationsfimstations
A simple features sf object (POINT) with 8099 features and 2 fields, +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
num
chr
## Not run: # file path csv <- '~/Desktop/fimraw.csv' # load and assign to object fimstations <- read_importfim(csv, download_latest = FALSE, locs = TRUE) save(fimstations, file = 'data/fimstations.RData', compress = 'xz') ## End(Not run)## Not run: # file path csv <- '~/Desktop/fimraw.csv' # load and assign to object fimstations <- read_importfim(csv, download_latest = FALSE, locs = TRUE) save(fimstations, file = 'data/fimstations.RData', compress = 'xz') ## End(Not run)
Hillsborough County Environmental Services Division (ESD) FIB data as of 20260302
hcesdfibdatahcesdfibdata
A data frame with 1264 rows and 13 variables:
chr, Station name
POSIXct, Date/time of sampling
chr, Waterbody class (Fresh, Marine)
num, Year of sampling
num, Month of sampling
num, Latitude, WGS84
num, Latitude, WGS84
num, Depth of sample, meters
chr, Variable name (ecoli, entero
num, Value of variable
num, Units of variable
num, Qualifier code
chr, Location name
This dataset includes FIB data from Hillsborough County Environmental Services Division (21FLHESD_WQX) where station class is marine (estuary) and Enterococcus data is present or the station class is freshwater (stream/river, reservoir) and E. coli data is present. The data is formatted from the raw data loaded from read_importwqp.
## Not run: hcesdfibdata <- read_importwqp('21FLHESD_WQX', type = 'fib') nrow(hcesdfibdata) ncol(hcesdfibdata) save(hcesdfibdata, file = 'data/hcesdfibdata.RData') ## End(Not run)## Not run: hcesdfibdata <- read_importwqp('21FLHESD_WQX', type = 'fib') nrow(hcesdfibdata) ncol(hcesdfibdata) save(hcesdfibdata, file = 'data/hcesdfibdata.RData') ## End(Not run)
Habitat Master Plan targets and goals
hmptrgshmptrgs
A data frame showing 2030 targets and 2050 goals
## Not run: library(dplyr) load(url("https://github.com/tbep-tech/hmpu-workflow/raw/master/data/trgs.RData")) hmptrgs <- trgs %>% rename(Goal2050 = Target2050) save(hmptrgs, file = 'data/hmptrgs.RData', compress = 'xz') ## End(Not run)## Not run: library(dplyr) load(url("https://github.com/tbep-tech/hmpu-workflow/raw/master/data/trgs.RData")) hmptrgs <- trgs %>% rename(Goal2050 = Target2050) save(hmptrgs, file = 'data/hmptrgs.RData', compress = 'xz') ## End(Not run)
Florida Department of Environmental Protection, Impaired Waters Rule, Run 67
iwrrawiwrraw
A data frame 592464 rows and 11 variables
File was created using workflow at https://tbep-tech.github.io/tidalcreek-stats/Creek_select_tbeptools, example below is old and for Run 61.
## Not run: library(dplyr) load(file = '../../02_DOCUMENTS/tidal_creeks/iwrraw_run61.RData') iwrraw <- sf::st_set_geometry(iwrraw, NULL) %>% rename(JEI = jei) save(iwrraw, file = 'data/iwrraw.RData', compress = 'xz') ## End(Not run)## Not run: library(dplyr) load(file = '../../02_DOCUMENTS/tidal_creeks/iwrraw_run61.RData') iwrraw <- sf::st_set_geometry(iwrraw, NULL) %>% rename(JEI = jei) save(iwrraw, file = 'data/iwrraw.RData', compress = 'xz') ## End(Not run)
Manatee County FIB data as of 20260302
mancofibdatamancofibdata
A data frame with 1928 rows and 13 variables:
chr, Station name
POSIXct, Date/time of sampling
chr, Waterbody class (Fresh, Marine)
num, Year of sampling
num, Month of sampling
num, Latitude, WGS84
num, Latitude, WGS84
num, Depth of sample, meters
chr, Variable name (ecoli, entero
num, Value of variable
num, Units of variable
num, Qualifier code
chr, Location name based on USF Water Alas waterbody name
This dataset includes FIB data from Manatee County Department of Natural Resources where station class is marine (estuary) and Enterococcus data is present or the station class is freshwater (stream/river, reservoir) and E. coli data is present. The data is formatted from the raw data loaded from read_importwqp.
## Not run: mancofibdata <- read_importwqp('21FLMANA_WQX', type = 'fib') nrow(mancofibdata) ncol(mancofibdata) save(mancofibdata, file = 'data/mancofibdata.RData') ## End(Not run)## Not run: mancofibdata <- read_importwqp('21FLMANA_WQX', type = 'fib') nrow(mancofibdata) ncol(mancofibdata) save(mancofibdata, file = 'data/mancofibdata.RData') ## End(Not run)
Pasco County FIB data as of 20260302
pascofibdatapascofibdata
A data frame with 255 rows and 13 variables:
chr, Station name
POSIXct, Date/time of sampling
chr, Waterbody class (Fresh, Marine)
num, Year of sampling
num, Month of sampling
num, Latitude, WGS84
num, Latitude, WGS84
num, Depth of sample, meters
chr, Variable name (ecoli, entero
num, Value of variable
num, Units of variable
num, Qualifier code
chr, Location name
This dataset includes FIB data from Pasco County (21FLPASC_WQX) where station class is marine (estuary) and Enterococcus data is present or the station class is freshwater (stream/river, reservoir) and E. coli data is present. The data is formatted from the raw data loaded from read_importwqp.
## Not run: pascofibdata <- read_importwqp('21FLPASC_WQX', type = 'fib') nrow(pascofibdata) ncol(pascofibdata) save(pascofibdata, file = 'data/pascofibdata.RData') ## End(Not run)## Not run: pascofibdata <- read_importwqp('21FLPASC_WQX', type = 'fib') nrow(pascofibdata) ncol(pascofibdata) save(pascofibdata, file = 'data/pascofibdata.RData') ## End(Not run)
Phytoplankton data current as of 20260204
phytodataphytodata
A nested tibble with 41390 rows and 8 variables:
chr
Date
chr
chr
num
Date
num
Ord.factor
## Not run: # location to download data path <- tempfile(fileext = '.xlsx') # load and assign to object phytodata <- read_importphyto(path, download_latest = TRUE) nrow(phytodata) ncol(phytodata) save(phytodata, file = 'data/phytodata.RData', compress = 'xz') file.remove(path) ## End(Not run)## Not run: # location to download data path <- tempfile(fileext = '.xlsx') # load and assign to object phytodata <- read_importphyto(path, download_latest = TRUE) nrow(phytodata) ncol(phytodata) save(phytodata, file = 'data/phytodata.RData', compress = 'xz') file.remove(path) ## End(Not run)
Polk County FIB data as of 20260302
polcofibdatapolcofibdata
A data frame with 996 rows and 13 variables:
chr, Station name
POSIXct, Date/time of sampling
chr, Waterbody class (Fresh, Marine)
num, Year of sampling
num, Month of sampling
num, Latitude, WGS84
num, Latitude, WGS84
num, Depth of sample, meters
chr, Variable name (ecoli, entero
num, Value of variable
num, Units of variable
num, Qualifier code
chr, Location name
This dataset includes FIB data from Polk County (21FLPOLK_WQX) where station class is marine (estuary) and Enterococcus data is present or the station class is freshwater (stream/river, reservoir) and E. coli data is present. The data is formatted from the raw data loaded from read_importwqp.
## Not run: polcofibdata <- read_importwqp('21FLPOLK_WQX', type = 'fib') nrow(polcofibdata) ncol(polcofibdata) save(polcofibdata, file = 'data/polcofibdata.RData') ## End(Not run)## Not run: polcofibdata <- read_importwqp('21FLPOLK_WQX', type = 'fib') nrow(polcofibdata) ncol(polcofibdata) save(polcofibdata, file = 'data/polcofibdata.RData') ## End(Not run)
Download latest file from epchc.org
read_dlcurrent(locin, download_latest = TRUE, urlin)read_dlcurrent(locin, download_latest = TRUE, urlin)
locin |
chr string path for local file, to overwrite it not current |
download_latest |
logical to download latest file regardless of local copy |
urlin |
url for file location |
The local copy is checked against a temporary file downloaded from the location specified by urlin. The local file is replaced with the downloaded file if the MD5 hashes are different.
The local copy specified in the path by locin is overwritten by the new file is not current or download_latest = TRUE. The function does nothing if download_latest = FALSE.
## Not run: locin <- '~/Desktop/RWMDataSpreadsheet_ThroughCurrentReportMonth.xlsx' urlin1 <- 'https://epcbocc.sharepoint.com/:x:/s/Share/' urlin2 <- 'EYXZ5t16UlFGk1rzIU91VogBa8U37lh8z_Hftf2KJISSHg?e=8r1SUL' urlin <- paste0(urlin1, urlin2, '&download=1') read_dlcurrent(locin = locin, urlin = urlin) ## End(Not run)## Not run: locin <- '~/Desktop/RWMDataSpreadsheet_ThroughCurrentReportMonth.xlsx' urlin1 <- 'https://epcbocc.sharepoint.com/:x:/s/Share/' urlin2 <- 'EYXZ5t16UlFGk1rzIU91VogBa8U37lh8z_Hftf2KJISSHg?e=8r1SUL' urlin <- paste0(urlin1, urlin2, '&download=1') read_dlcurrent(locin = locin, urlin = urlin) ## End(Not run)
Format benthic data for the Tampa Bay Benthic Index
read_formbenthic(pathin)read_formbenthic(pathin)
pathin |
A path to unzipped csv files with base tables used to calculate benthic index |
Function is used internally within read_importbenthic
A nested tibble of station, field sample, and taxa data
## Not run: # location to download data path <- '~/Desktop/benthic.zip' # download urlin1 <- 'https://epcbocc.sharepoint.com/:x:/s/Share/' urlin2 <- 'EQUCWBuwCNdGuMREYAyAD1gBKC98mYtCHMWX0FYLrbT4KA?e=nDfnnQ' urlin <- paste0(urlin1, urlin2, '&download=1') read_dlcurrent(path, download_latest = TRUE, urlin = urlin) # unzip tmppth <- tempfile() utils::unzip(path, exdir = tmppth, overwrite = TRUE) # format benthic data read_formbenthic(pathin = tmppth) # remove temporary path unlink(tmppth, recursive = TRUE) ## End(Not run)## Not run: # location to download data path <- '~/Desktop/benthic.zip' # download urlin1 <- 'https://epcbocc.sharepoint.com/:x:/s/Share/' urlin2 <- 'EQUCWBuwCNdGuMREYAyAD1gBKC98mYtCHMWX0FYLrbT4KA?e=nDfnnQ' urlin <- paste0(urlin1, urlin2, '&download=1') read_dlcurrent(path, download_latest = TRUE, urlin = urlin) # unzip tmppth <- tempfile() utils::unzip(path, exdir = tmppth, overwrite = TRUE) # format benthic data read_formbenthic(pathin = tmppth) # remove temporary path unlink(tmppth, recursive = TRUE) ## End(Not run)
Format Fecal Indicator Bacteria (FIB) data
read_formfib(datin, all = FALSE)read_formfib(datin, all = FALSE)
datin |
input |
all |
logical indicating if all stations with FIB data are returned, default is |
Formats input data from read_importepc appropriate for FIB results, see the details in read_importfib for more more information.
A lightly formatted data.frame with FIB data
read_importfib, read_importepc
## Not run: # file path xlsx <- '~/Desktop/RWMDataSpreadsheet_ThroughCurrentReportMonth.xlsx' # load raw data and assign to object epcall <- read_importepc(xlsx, download_latest = T) # final formatting fibdata <- read_formfib(epcall) ## End(Not run)## Not run: # file path xlsx <- '~/Desktop/RWMDataSpreadsheet_ThroughCurrentReportMonth.xlsx' # load raw data and assign to object epcall <- read_importepc(xlsx, download_latest = T) # final formatting fibdata <- read_formfib(epcall) ## End(Not run)
Format FIM data for the Tampa Bay Nekton Index
read_formfim(datin, locs = FALSE)read_formfim(datin, locs = FALSE)
datin |
input |
locs |
logical indicating if a spatial features object is returned with locations of each FIM sampling station |
Function is used internally within read_importfim
A formatted data.frame with FIM data if locs = FALSE, otherwise a simple features object if locs = TRUE
# file path url <- 'https://raw.githubusercontent.com/tbep-tech/tbni-proc/master/data/' fl <- 'TampaBay_NektonIndexData.csv' csv <- url(paste0(url, fl)) datin <- read.csv(csv) # load and assign to object fimdata <- read_formfim(datin)# file path url <- 'https://raw.githubusercontent.com/tbep-tech/tbni-proc/master/data/' fl <- 'TampaBay_NektonIndexData.csv' csv <- url(paste0(url, fl)) datin <- read.csv(csv) # load and assign to object fimdata <- read_formfim(datin)
Format phytoplankton data
read_formphyto(datin)read_formphyto(datin)
datin |
input |
Only seven taxonomic groups are summarized. Pyrodinium bahamense, Karenia brevis, Tripos hircus, Pseudo-nitzschia sp., and Pseudo-nitzschia pungens are retained at the species level. Diatoms are summarized at the class level using Bacillariophyceae, Coscinodiscophyceae, and Mediophyceae and Cyanobacteria are summarized at the phylum level using Cyanobacteriota. All other taxa are grouped into an "other" category.
A formatted data.frame with phytoplankton count data
## Not run: # file path xlsx <- '~/Desktop/phyto_data.xlsx' # load and assign to object phytodata <- read_importphyto(xlsx, download_latest = TRUE) ## End(Not run)## Not run: # file path xlsx <- '~/Desktop/phyto_data.xlsx' # load and assign to object phytodata <- read_importphyto(xlsx, download_latest = TRUE) ## End(Not run)
Format sediment data
read_formsediment(pathin)read_formsediment(pathin)
pathin |
A path to unzipped csv files with sediment result tables |
Function is used internally within read_importsediment
A data.frame of sediment data for Tampa Bay
## Not run: # location to download data path <- '~/Desktop/sediment.zip' # download urlin1 <- 'https://epcbocc.sharepoint.com/:x:/s/Share/' urlin2 <- 'Ef9utuKCHD9LliarsOPKCJwB5kxgCObf0tY5x5wX20JQUA?e=DuTseb' urlin <- paste0(urlin1, urlin2, '&download=1') read_dlcurrent(path, download_latest = TRUE, urlin = urlin) # unzip tmppth <- tempfile() utils::unzip(path, exdir = tmppth, overwrite = TRUE) # format sediment data read_formsediment(pathin = tmppth) # remove temporary path unlink(tmppth, recursive = TRUE) ## End(Not run)## Not run: # location to download data path <- '~/Desktop/sediment.zip' # download urlin1 <- 'https://epcbocc.sharepoint.com/:x:/s/Share/' urlin2 <- 'Ef9utuKCHD9LliarsOPKCJwB5kxgCObf0tY5x5wX20JQUA?e=DuTseb' urlin <- paste0(urlin1, urlin2, '&download=1') read_dlcurrent(path, download_latest = TRUE, urlin = urlin) # unzip tmppth <- tempfile() utils::unzip(path, exdir = tmppth, overwrite = TRUE) # format sediment data read_formsediment(pathin = tmppth) # remove temporary path unlink(tmppth, recursive = TRUE) ## End(Not run)
Format seagrass transect data from Water Atlas
read_formtransect(jsn, training = FALSE, raw = FALSE)read_formtransect(jsn, training = FALSE, raw = FALSE)
jsn |
A data frame returned from |
training |
logical if input are transect training data or complete database |
raw |
logical indicating if raw, unformatted data are returned, see details |
Shoot density is reported as number of shoots per square meter and is corrected for the quadrat size entered in the raw data. Shoot density and blade height (cm) are based on averages across random observations at each transect point that are entered separately in the data form. Abundance is reported as a numeric value from 0 - 5 for Braun-Blanquet coverage estimates.
If raw = TRUE, the unformatted data are returned. The default is to use formatting that allows the raw data to be used with the downstream functions. The raw data may have extra information that may be of use outside of the plotting functions in this package.
data frame in long format
library(jsonlite) ## Not run: # all transect data url <- 'https://tampabay.wateratlas.usf.edu/seagrass-transect-data-portal/api/assessments/all__use-with-care' jsn <- fromJSON(url) trndat <- read_formtransect(jsn) ## End(Not run) # training transect data url <- 'https://tampabay.wateratlas.usf.edu/seagrass-transect-data-portal/api/assessments/training' jsn <- fromJSON(url) trndat <- read_formtransect(jsn, training = TRUE)library(jsonlite) ## Not run: # all transect data url <- 'https://tampabay.wateratlas.usf.edu/seagrass-transect-data-portal/api/assessments/all__use-with-care' jsn <- fromJSON(url) trndat <- read_formtransect(jsn) ## End(Not run) # training transect data url <- 'https://tampabay.wateratlas.usf.edu/seagrass-transect-data-portal/api/assessments/training' jsn <- fromJSON(url) trndat <- read_formtransect(jsn, training = TRUE)
Format water quality data
read_formwq(datin, all = FALSE)read_formwq(datin, all = FALSE)
datin |
input |
all |
logical indicating if all water quality parameters are returned, see details |
Secchi data VOB depths or secchis < 0.5 ft from bottom are assigned NA, function is used internally within read_importwq
A lightly formatted data.frame with chloropyll and secchi observations
## Not run: # file path xlsx <- '~/Desktop/RWMDataSpreadsheet_ThroughCurrentReportMonth.xlsx' # load raw data and assign to object epcall <- read_importepc(xlsx, download_latest = T) # final formatting epcdata <- read_formwq(epcall) ## End(Not run)## Not run: # file path xlsx <- '~/Desktop/RWMDataSpreadsheet_ThroughCurrentReportMonth.xlsx' # load raw data and assign to object epcall <- read_importepc(xlsx, download_latest = T) # final formatting epcdata <- read_formwq(epcall) ## End(Not run)
Format data and station metadata from the Water Quality Portal
read_formwqp(res, sta, org, type, trace = F)read_formwqp(res, sta, org, type, trace = F)
res |
A data frame containing results obtained from the API |
sta |
A data frame containing station metadata obtained from the API |
org |
chr string indicating the organization identifier |
type |
chr string indicating data type to download, one of |
trace |
Logical indicating whether to display progress messages, default is |
This function is used by read_importwqp to combine, format, and process data (res) and station metadata (sta) obtained from the Water Quality Portal for the selected county and data type. The resulting data frame includes the date, time, station identifier, latitude, longitude, variable name, value, unit, and quality flag. Manatee County FIB data (21FLMANA_WQX) will also include an area column indicating the waterbody name as used by the USF Water Atlas, with some area aggregations. Other county-level FIB data will have a similar column.
A data frame containing formatted water quality and station metadata
## Not run: url <- list( Result = "https://www.waterqualitydata.us/data/Result/search?mimeType=csv&zip=no", Station = "https://www.waterqualitydata.us/data/Station/search?mimeType=csv&zip=no" ) headers <- c( "Content-Type" = "application/json", "Accept" = "application/zip" ) body <- list( organization = c("21FLMANA_WQX"), sampleMedia = c("Water"), characteristicType = c("Information", "Nutrient", "Biological, Algae, Phytoplankton, Photosynthetic Pigments"), providers = c("STORET"), siteType = c("Estuary") ) res <- url[['Result']] %>% httr::POST(httr::add_headers(headers), body = jsonlite::toJSON(body)) %>% httr::content('text') %>% read.csv(text = .) sta <- url[['Station']] %>% httr::POST(httr::add_headers(headers), body = jsonlite::toJSON(body)) %>% httr::content('text') %>% read.csv(text = .) # combine and format read_formwqp(res, sta, '21FLMANA_WQX', type = 'wq') ## End(Not run)## Not run: url <- list( Result = "https://www.waterqualitydata.us/data/Result/search?mimeType=csv&zip=no", Station = "https://www.waterqualitydata.us/data/Station/search?mimeType=csv&zip=no" ) headers <- c( "Content-Type" = "application/json", "Accept" = "application/zip" ) body <- list( organization = c("21FLMANA_WQX"), sampleMedia = c("Water"), characteristicType = c("Information", "Nutrient", "Biological, Algae, Phytoplankton, Photosynthetic Pigments"), providers = c("STORET"), siteType = c("Estuary") ) res <- url[['Result']] %>% httr::POST(httr::add_headers(headers), body = jsonlite::toJSON(body)) %>% httr::content('text') %>% read.csv(text = .) sta <- url[['Station']] %>% httr::POST(httr::add_headers(headers), body = jsonlite::toJSON(body)) %>% httr::content('text') %>% read.csv(text = .) # combine and format read_formwqp(res, sta, '21FLMANA_WQX', type = 'wq') ## End(Not run)
Download and import benthic data for Tampa Bay
read_importbenthic(path, download_latest = FALSE, remove = FALSE)read_importbenthic(path, download_latest = FALSE, remove = FALSE)
path |
chr string for local path where the zipped folder will be downloaded, must include .zip extension |
download_latest |
logical to download latest if a more recent dataset is available |
remove |
logical if the downloaded folder is removed after unzipping |
This function downloads and unzips a folder of base tables used to calculate the benthic index from https://epcbocc.sharepoint.com/:f:/s/Share/EtOJfziTTa9FliL1oROb9OsBRZU-nO60fu_0NRC162hHjQ?e=4gUXgJ.
Index the corresponding list element in the value column to view each dataset. For example, the stations data in the first row can be viewed as benthicdata$value[[1]].
A nested tibble of station, taxa, and field sample data.
## Not run: # location to download data path <- '~/Desktop/benthic.zip' # load and assign to object benthicdata <- read_importbenthic(path, download_latest = TRUE) ## End(Not run)## Not run: # location to download data path <- '~/Desktop/benthic.zip' # load and assign to object benthicdata <- read_importbenthic(path, download_latest = TRUE) ## End(Not run)
Download Enterococcus data from the Water Quality Portal
read_importentero(stas = NULL, startDate, endDate)read_importentero(stas = NULL, startDate, endDate)
stas |
character, a vector of stations. If |
startDate |
character, starting date of observations as YYYY-MM-DD |
endDate |
character, ending date of observations as YYYY-MM-DD |
Retrieves Enterococcus sample data from selected stations and date range from the Water Quality Portal, https://www.waterqualitydata.us
a data frame containing one row for each sample. Columns returned are:
datedate, sample date
yrnumeric, year of sample date
monumeric, month of sample date
timecharacter, sample time
time_zonecharacter, sample time zone
long_namecharacter, long name of bay segment subwatershed
bay_segmentcharacter, short name of bay segment subwatershed
stationcharacter, sample station
enteronumeric, Enterococcus concentration
entero_censoredlogical, whether entero value was below the laboratory MDL, minimum detection limit
MDLnumeric, minimum detection limit at the time of processing
entero_unitscharacter, units of measurement for entero
qualifierqualifier codes associated with sample
LabCommentslab comments on sample
Latitudenumeric, latitude in decimal degrees
Longitudenumeric, longitude in decimal degrees
## Not run: # stations to download stas <- c('21FLHILL_WQX-101', '21FLHILL_WQX-102', '21FLHILL_WQX-103') # download and read the data entero_in <- read_importentero(stas = stas, startDate = '2023-01-01', endDate = '2023-02-01') head(entero_in) ## End(Not run)## Not run: # stations to download stas <- c('21FLHILL_WQX-101', '21FLHILL_WQX-102', '21FLHILL_WQX-103') # download and read the data entero_in <- read_importentero(stas = stas, startDate = '2023-01-01', endDate = '2023-02-01') head(entero_in) ## End(Not run)
Download and/or import local water quality file for internal use
read_importepc(xlsx, download_latest = FALSE, na = c("", "NULL"))read_importepc(xlsx, download_latest = FALSE, na = c("", "NULL"))
xlsx |
chr string path for local excel file, to overwrite if not current |
download_latest |
logical passed to |
na |
chr vector of strings to interpret as |
Loads the "RWMDataSpreadsheet" worksheet from the file located at xlsx. The file is downloaded from https://epcbocc.sharepoint.com/:x:/s/Share/EYXZ5t16UlFGk1rzIU91VogBa8U37lh8z_Hftf2KJISSHg?e=8r1SUL&download=1. The files can be viewed at https://epcbocc.sharepoint.com/:f:/s/Share/EiypSSYdsEFCi84Sv_6-t7kBUYaXiIqN0B1n2w57Z_V3kQ?e=NdZQcU.
This function is used internally by read_importwq and read_importfib because both use the same source data from the Environmental Protection Commission of Hillsborough County.
An unformatted data.frame from EPC
## Not run: # file path xlsx <- '~/Desktop/RWMDataSpreadsheet_ThroughCurrentReportMonth.xlsx' # load and assign to object epcall <- read_importepc(xlsx, download_latest = T) ## End(Not run)## Not run: # file path xlsx <- '~/Desktop/RWMDataSpreadsheet_ThroughCurrentReportMonth.xlsx' # load and assign to object epcall <- read_importepc(xlsx, download_latest = T) ## End(Not run)
Load local water quality file for Fecal Indicator Bacteria (FIB)
read_importfib(xlsx, download_latest = FALSE, na = c("", "NULL"), all = TRUE)read_importfib(xlsx, download_latest = FALSE, na = c("", "NULL"), all = TRUE)
xlsx |
chr string path for local excel file, to overwrite if not current |
download_latest |
logical passed to |
na |
chr vector of strings to interpret as |
all |
logical indicating if all stations with FIB data are returned, default is |
Loads the "RWMDataSpreadsheet" worksheet from the file located at xlsx. The file is downloaded from https://epcbocc.sharepoint.com/:x:/s/Share/EYXZ5t16UlFGk1rzIU91VogBa8U37lh8z_Hftf2KJISSHg?e=8r1SUL&download=1. The files can be viewed at https://epcbocc.sharepoint.com/:f:/s/Share/EiypSSYdsEFCi84Sv_6-t7kBUYaXiIqN0B1n2w57Z_V3kQ?e=NdZQcU.
Returns FIB data including E. coli, Enterococcus, Fecal Coliform, and Total Coliform concentrations and waterbody class (freshwater as 1 or 3F, marine as 2 or 3M) for stations and sample dates.
Values are returned for E. coli (ecoli), Enterococcus (entero), Fecal Coliform (fcolif), and Total Coliform (totcol). Values shown are # of colonies per 100 mL of water (#/100mL). Qualifier columns for each are also returned with the _q suffix. Qualifier codes can be interpreted from the source spreadsheet.
Concentrations noted with < or > in the raw data are reported as is, with only the numeric value shown. Samples with this notation can be determined from the qualifier columns.
If all = FALSE, only stations with AreaName in the source data as Hillsborough River, Hillsborough River Tributary, Alafia River, Alafia River Tributary, Lake Thonotosassa, Lake Thonotosassa Tributary, and Lake Roberta.
A data.frame of formatted FIB data.
## Not run: # file path xlsx <- '~/Desktop/RWMDataSpreadsheet_ThroughCurrentReportMonth.xlsx' # load and assign to object fibdata <- read_importfib(xlsx, download_latest = T) ## End(Not run)## Not run: # file path xlsx <- '~/Desktop/RWMDataSpreadsheet_ThroughCurrentReportMonth.xlsx' # load and assign to object fibdata <- read_importfib(xlsx, download_latest = T) ## End(Not run)
Load local FIM data for the Tampa Bay Nekton Index
read_importfim(csv, download_latest = FALSE, locs = FALSE)read_importfim(csv, download_latest = FALSE, locs = FALSE)
csv |
chr string path for local csv file, to overwrite if not current |
download_latest |
logical passed to |
locs |
logical indicating if a spatial features object is returned with locations of each FIM sampling station |
Data downloaded from ftp://ftp.floridamarine.org/users/fim/tmac/NektonIndex/TampaBay_NektonIndexData.csv.
A formatted data.frame with FIM data if locs = FALSE, otherwise a simple features object if locs = TRUE
## Not run: # file path csv <- '~/Desktop/fimraw.csv' # load and assign to object fimdata <- read_importfim(csv, download_latest = TRUE) ## End(Not run)## Not run: # file path csv <- '~/Desktop/fimraw.csv' # load and assign to object fimdata <- read_importfim(csv, download_latest = TRUE) ## End(Not run)
Load local phytoplankton cell count file
read_importphyto(xlsx, download_latest = FALSE, na = c("", "NULL"))read_importphyto(xlsx, download_latest = FALSE, na = c("", "NULL"))
xlsx |
chr string path for local excel file, to overwrite if not current |
download_latest |
logical passed to |
na |
chr vector of strings to interpret as |
Phytoplankton cell count data downloaded from https://epcbocc.sharepoint.com/:x:/s/Share/ETAfRQ5drmRHntDd1O8s3FQB180Fumed4nQ99w-OIVDxrA?e=eSmtxD&download=1
A data.frame of formatted water quality data.
## Not run: # file path xlsx <- '~/Desktop/phyto_data.xlsx' # load and assign to object phytodata <- read_importphyto(xlsx, download_latest = T) ## End(Not run)## Not run: # file path xlsx <- '~/Desktop/phyto_data.xlsx' # load and assign to object phytodata <- read_importphyto(xlsx, download_latest = T) ## End(Not run)
Download and crop the latest weather rasters from Parameter-elevation Relationship on Independent Slopes Model (PRISM). Summarize by zone and save as CSV.
read_importprism( vars = c("tmin", "tmax", "tdmean", "ppt"), vars_ytd = c("ppt"), date_beg = as.Date("1981-01-01"), date_end = Sys.Date(), bbox = sf::st_bbox(sf_zones), dir_tif = sub("\\.[^.]*$", "", zonal_csv), pfx_tif = "prism_daily_", sf_zones, fld_zones, zonal_fun = "mean", zonal_csv, redo_zonal = F, verbose = F )read_importprism( vars = c("tmin", "tmax", "tdmean", "ppt"), vars_ytd = c("ppt"), date_beg = as.Date("1981-01-01"), date_end = Sys.Date(), bbox = sf::st_bbox(sf_zones), dir_tif = sub("\\.[^.]*$", "", zonal_csv), pfx_tif = "prism_daily_", sf_zones, fld_zones, zonal_fun = "mean", zonal_csv, redo_zonal = F, verbose = F )
vars |
character vector of PRISM variables to download and crop. The
default is |
vars_ytd |
character vector of PRISM variables to be summed for the
year to date, which gets recorded as a new layer with the suffix |
date_beg |
defaults to the start of PRISM daily availability 1981-01-01. |
date_end |
defaults to today's date, but will be adjusted to the most recently available data, per update schedule. CAUTION: If you try to request the same date-variable in a given day, you will get an error from the PRISM service with a message like "You have tried to download the file PRISM_tdmean_stable_4kmD2_19810101_bil.zip more than twice in one day (Pacific local time). Note that repeated offenses may result in your IP address being blocked." |
bbox |
bounding box of the spatial extent to crop PRISM daily rasters,
which could be bigger than |
dir_tif |
directory path to store downloaded and cropped PRISM daily
rasters (as GeoTIFF) across years with file name of format
|
pfx_tif |
prefix for the PRISM daily raster files, appended by the month-day. Defaults to |
sf_zones |
spatial feature object ( |
fld_zones |
character vector of unique field name(s) in |
zonal_fun |
function to apply to the |
zonal_csv |
path to output of zonal statistics ( |
redo_zonal |
logical whether to recalculate the zonal statistics. Defaults to False. |
verbose |
logical whether to show informative messages on processing |
The Parameter-elevation Relationship on Independent Slopes Model (PRISM) is a combined dataset consisting of ground gauge station and RADAR products, at a 4km grid resolution covering the contiguous United States from 1981 to present.
The available variables (vars) are:
tmin: minimum temperature (ºC)
tmax: maximum temperature (ºC)
tmean: mean temperature (ºC; tmean = mean(tmin, tmax))
tdmean: mean dew point temperature (ºC)
ppt: total precipitation (mm; rain and snow)
vpdmin: daily minimum vapor pressure deficit
vpdmax: daily maximum vapor pressure deficit
The daily PRISM data is available over three stability levels, or 8 versions given by the update schedule:
stable: data is considered final and will not change (before 6 months)
provisional: data is considered final but may be updated (previous 6 months)
early: data is preliminary and may be updated (this month)
The PRISM update schedule is downloaded and processed in a data frame to understand the latest date and variable available, along with version and date updated.
Any existing rasters in dir_tif are fetched based on a common naming
structure for the raster file name (prism_daily_{month}-{day}.tif) and
layer names ({date}_{variable}_v{version}-{date_updated}) into a data
frame.
Based on intersecting above with the requested dates, any missing or more
recently updated variable-date PRISM rasters are downloaded and cropped to
the bounding box (bbox) and written as GeoTIFFs (*.tif). Layers are renamed
to include extra information on {version} (1-8) and {date_udpated}.
Summary statistics (based on sf_zones and zonal_fun) are calculated on
the cropped PRISM daily rasters.
For more on Parameter-elevation Relationship on Independent Slopes Model (PRISM), see:
PRISM download methods information (FTP, web services)
data frame with the following columns:
{fld_zones} column(s) specified from input sf_zones
{zonal_fun}: value of input function (e.g. "mean") summarizing raster to zone
date: date of PRISM daily raster
variable: PRISM variable
version: PRISM version
date_updated: date of PRISM daily raster update
## Not run: # setup output directory and table dir_tif <- system.file("prism", package = "tbeptools") zonal_csv <- system.file("prism/_zones.csv", package = "tbeptools") # run function for Tampa Bay watersheds for first 3 days and 4 variables d <- read_importprism( vars = c("tdmean", "ppt"), date_beg = as.Date("1981-01-01"), date_end = as.Date("1981-01-02"), dir_tif = dir_tif, sf_zones = tbsegshed, fld_zones = "bay_segment", zonal_csv = zonal_csv) # show raster files, layers and plot tifs <- list.files(dir_tif, pattern = ".tif$", full.names = T) basename(tifs) r <- terra::rast(tifs[1]) r names(r) terra::plet( r[[3]], main = names(r)[3], col = "Spectral", tiles = "CartoDB.DarkMatter") # show summary by zone d ## End(Not run)## Not run: # setup output directory and table dir_tif <- system.file("prism", package = "tbeptools") zonal_csv <- system.file("prism/_zones.csv", package = "tbeptools") # run function for Tampa Bay watersheds for first 3 days and 4 variables d <- read_importprism( vars = c("tdmean", "ppt"), date_beg = as.Date("1981-01-01"), date_end = as.Date("1981-01-02"), dir_tif = dir_tif, sf_zones = tbsegshed, fld_zones = "bay_segment", zonal_csv = zonal_csv) # show raster files, layers and plot tifs <- list.files(dir_tif, pattern = ".tif$", full.names = T) basename(tifs) r <- terra::rast(tifs[1]) r names(r) terra::plet( r[[3]], main = names(r)[3], col = "Spectral", tiles = "CartoDB.DarkMatter") # show summary by zone d ## End(Not run)
Download daily precip data and summarise by station catchment
read_importrain(curyr, catchpixels, mos = 1:12, quiet = T)read_importrain(curyr, catchpixels, mos = 1:12, quiet = T)
curyr |
numeric for year |
catchpixels |
data.frame with columns named 'station' and 'pixel'. A data frame has been created for key Enterococcus stations, associating each station with all pixels in that station's catchment layer. This is the tbeptools object 'catchpixels'. |
mos |
numeric vector for months to download |
quiet |
logical for messages |
Data from the Southwest Florida Water Management District's (SWFWMD) ftp site: ftp://ftp.swfwmd.state.fl.us/pub/radar_rainfall/Daily_Data/
data.frame with station, date, rain columns as a daily average (inches) for all pixels in a catchment
## Not run: read_importrain(2021, catchpixels, quiet = F) ## End(Not run)## Not run: read_importrain(2021, catchpixels, quiet = F) ## End(Not run)
read_importrain for multiple yearsRun read_importrain for multiple years
read_importrainmany(yrs, quiet = FALSE, sleep = 5)read_importrainmany(yrs, quiet = FALSE, sleep = 5)
yrs |
numeric vector of years to download (do not need to be in order) |
quiet |
logical passed to |
sleep |
numeric number of seconds to pause between years |
This function is a simple wrapper for read_importrain to download multiple years of rainfall data from the Southwest Florida Water Management District's (SWFWMD) ftp site: ftp://ftp.swfwmd.state.fl.us/pub/radar_rainfall/Daily_Data/. The function will pause for sleep seconds between years to avoid overloading the server.
A data frame identical to that returned by read_importrain with the years requested
## Not run: read_importrainmany(c(2021, 2022), quiet = F) ## End(Not run)## Not run: read_importrainmany(c(2021, 2022), quiet = F) ## End(Not run)
Under NOAA Tides and Currents, there is the NOAA Center for Operational Oceanographic Products and Services (CO-OPS). This function uses the CO-OPS Data Retrieval API to extract see level data by station.
read_importsealevels( path_csv, download_latest = TRUE, df_stations = sealevelstations[, c("station_id", "station_name")], api_url = "https://api.tidesandcurrents.noaa.gov/api/prod/datagetter", beg_int = 19010101, end_int = as.integer(format(lubridate::today(), "%Y%m%d")), product = "monthly_mean", datum = "stnd", time_zone = "lst", units = "metric" )read_importsealevels( path_csv, download_latest = TRUE, df_stations = sealevelstations[, c("station_id", "station_name")], api_url = "https://api.tidesandcurrents.noaa.gov/api/prod/datagetter", beg_int = 19010101, end_int = as.integer(format(lubridate::today(), "%Y%m%d")), product = "monthly_mean", datum = "stnd", time_zone = "lst", units = "metric" )
path_csv |
chr string path of CSV file to store tabular output. (Overwrites existing file.) |
download_latest |
logical to download latest. (Overwrites existing file.) |
df_stations |
data frame of stations with column |
api_url |
chr string URL for NOAA Center for Operational Oceanographic Products and Services (CO-OPS) API. Defaults to the CO-OPS API for data retrieval: https://api.tidesandcurrents.noaa.gov/api/prod/datagetter. |
beg_int |
int integer of beginning date in YYYYMMDD format. Defaults to
|
end_int |
int integer of ending date in YYYYMMDD format. Defaults to
|
product |
chr string of product type. For options, see Data Products | CO-OPS API.
Defaults to |
datum |
chr string of datum. Defaults to |
time_zone |
Time zone. Defaults to |
units |
chr string of units. Defaults to |
Given the default arguments in (and especially product = "monthly_mean"), this function returns a data frame from reading
path_csv (updated if download_latest = TRUE or newly written if
path_csv does not exist) having the following fields:
station_id: integer column from input argument df_stations
station_name: character column from input argument df_stations
date: first of the month given by year and month from API output
year: year of the data
month: month of the data
mhhw: Mean Higher-High Water
mhw: Mean High Water
msl: Mean Sea Level
mtl: Mean Tide Level
mlw: Mean Low Water
mllw: Mean Lower-Low Water
dtl: Mean Diurnal Tide Level
gt: Great Diurnal Range
mn: Mean Range of Tide
dhq: Mean Diurnal High Water Inequality
dlq: Mean Diurnal Low Water Inequality
hwi: Greenwich High Water Interval (in Hours)
lwi: Greenwich Low Water Interval (in Hours)
highest: Highest Tide
lowest: Lowest Tide
inferred: A flag that when set to 1 indicates that the water level value has been inferred
For more details on these output data columns, see About Tidal Datums | NOAA Tides & Currents.
read_importsealevels(tempfile("sealevels", fileext=".csv"))read_importsealevels(tempfile("sealevels", fileext=".csv"))
Download and import sediment data for Tampa Bay
read_importsediment(path, download_latest = FALSE, remove = FALSE)read_importsediment(path, download_latest = FALSE, remove = FALSE)
path |
chr string for local path where the zipped folder will be downloaded, must include .zip extension |
download_latest |
logical to download latest if a more recent dataset is available |
remove |
logical if the downloaded folder is removed after unzipping |
This function downloads and unzips a folder of results tables from https://epcbocc.sharepoint.com/:u:/s/Share/Ef9utuKCHD9LliarsOPKCJwB5kxgCObf0tY5x5wX20JQUA?e=DuTseb&download=1 (viewable at https://epcbocc.sharepoint.com/:f:/s/Share/EtOJfziTTa9FliL1oROb9OsBRZU-nO60fu_0NRC162hHjQ?e=4gUXgJ).
The row entries for columns "BetweenTELPEL" and "ExceedsPEL" for rows where the "Qualifier" column is "U" or "T" (below detection, not detected) are assigned NA, regardless of the entry in the source data.
A data.frame of sediment data for Tampa Bay
## Not run: # location to download data path <- '~/Desktop/sediment.zip' # load and assign to object sedimentdata <- read_importsediment(path, download_latest = TRUE) ## End(Not run)## Not run: # location to download data path <- '~/Desktop/sediment.zip' # load and assign to object sedimentdata <- read_importsediment(path, download_latest = TRUE) ## End(Not run)
Load local water quality file
read_importwq(xlsx, download_latest = FALSE, na = c("", "NULL"), all = FALSE)read_importwq(xlsx, download_latest = FALSE, na = c("", "NULL"), all = FALSE)
xlsx |
chr string path for local excel file, to overwrite if not current |
download_latest |
logical passed to |
na |
chr vector of strings to interpret as |
all |
logical indicating if all water quality parameters are returned, see details |
Loads the "RWMDataSpreadsheet" worksheet from the file located at xlsx. The file is downloaded from https://epcbocc.sharepoint.com/:x:/s/Share/EYXZ5t16UlFGk1rzIU91VogBa8U37lh8z_Hftf2KJISSHg?e=8r1SUL&download=1. The files can be viewed at https://epcbocc.sharepoint.com/:f:/s/Share/EiypSSYdsEFCi84Sv_6-t7kBUYaXiIqN0B1n2w57Z_V3kQ?e=NdZQcU.
Water quality parameters returned by default are total nitrogen (tn), Secchi depth (sd), chlorophyll-a (chla), salinity (top, mid, and bottom depths, Sal_ prefix), water temperature (top, mid, and bottom depths, Temp_Water_ prefix), turbidity (Turbidity_JTU-NTU), and water color (Color_345_F45). Additional qualifier columns for each that include the _Q suffix are also returned, excluding salinity and water temperature. All other water quality parameters and qualifiers can be returned by setting all = T.
A data.frame of formatted water quality data.
## Not run: # file path xlsx <- '~/Desktop/RWMDataSpreadsheet_ThroughCurrentReportMonth.xlsx' # load and assign to object epcdata <- read_importwq(xlsx, download_latest = T) # get all water quality parameters epcdataall <- read_importwq(xlsx, download_latest = T, all = T) ## End(Not run)## Not run: # file path xlsx <- '~/Desktop/RWMDataSpreadsheet_ThroughCurrentReportMonth.xlsx' # load and assign to object epcdata <- read_importwq(xlsx, download_latest = T) # get all water quality parameters epcdataall <- read_importwq(xlsx, download_latest = T, all = T) ## End(Not run)
Import data from the Water Quality Portal
read_importwqp(org, type, trace = F)read_importwqp(org, type, trace = F)
org |
chr string indicating the organization identifier, see details |
type |
chr string indicating data type to download, one of |
trace |
logical indicating whether to display progress messages, default |
This function retrieves data from the Water Quality Portal API (https://www.waterqualitydata.us/) for selected counties in or around the Tampa Bay watershed. The type of data returned are defined by the type argument as either "wq" or "fib" for water quality of Fecal Indicator Bacteria data, respectively.
The org argument retrieves data for the specific organization. Valid entries for org include "21FLCOSP_WQX" (City of St. Petersburg), "21FLDOH_WQX" (Florida Department of Health), "21FLHILL_WQX" (Hillsborough County), "21FLMANA_WQX" (Manatee County), "21FLPASC_WQX" (Pasco County), "21FLPDEM_WQX" (Pinellas County), "21FLPOLK_WQX" (Polk County), "21FLTPA_WQX" (Florida Department of Environmental Protection, Southwest District), or "21FLHESD_WQX" (Hillsborough County Environmental Services Division). The naming convention follows the Organization ID in the Water Quality Portal.
The function fetches results and station metadata, combines and formats them using the read_formwqp function, and returns the processed data as a data frame. Parameters are specific to the type argument.
A data frame containing the imported data for the selected county
## Not run: # get Manatee County water quality data mancodata <- read_importwqp(org = '21FLMANA_WQX', type = 'wq', trace = T) # get Pinellas County FIB data pincodata <- read_importwqp(org = '21FLPDEM_WQX', type = 'fib', trace = T) ## End(Not run)## Not run: # get Manatee County water quality data mancodata <- read_importwqp(org = '21FLMANA_WQX', type = 'wq', trace = T) # get Pinellas County FIB data pincodata <- read_importwqp(org = '21FLPDEM_WQX', type = 'fib', trace = T) ## End(Not run)
Import data from the Water Atlas API
read_importwqwa( dataSource, parameter, start_date = NULL, end_date = NULL, trace = TRUE )read_importwqwa( dataSource, parameter, start_date = NULL, end_date = NULL, trace = TRUE )
dataSource |
Character for the data source to retrieve, e.g., WIN_21FLHILL |
parameter |
Character for the parameter to retrieve |
start_date |
Numeric for the start date in ISO format, optional |
end_date |
Numeric for the end date in ISO format, optional |
trace |
Logical indicating whether to display progress messages, default |
This function retrieves sampling data from the Water Atlas API (https://dev.api.wateratlas.org/redoc/index.html#tag/Sampling-Data/operation/StreamSamplingData) using the specified data source and parameter. Optional start and end dates can be provided to filter the data by date range. The function processes the NDJSON response stream and returns a data frame of sampling records.
See util_importwqwa for retrieving metadata such as available data sources and parameters.
A data frame containing the imported sampling data
read_importwqwa('WIN_21FLPDEM', 'Chla_ugl', '2023-01-01', '2023-02-01')read_importwqwa('WIN_21FLPDEM', 'Chla_ugl', '2023-01-01', '2023-02-01')
Retrieve water quality data from the Florida Department of Environmental Protection's Watershed Information Network (WIN)
read_importwqwin( start_date, end_date, org_id, verbose = FALSE, max_retries = 5 )read_importwqwin( start_date, end_date, org_id, verbose = FALSE, max_retries = 5 )
start_date |
character string for the start date in the format "YYYY-MM-DD" |
end_date |
character string for the end date in the format "YYYY-MM-DD" |
org_id |
character string for the organization ID |
verbose |
logical indicating whether to print verbose output |
max_retries |
integer indicating maximum number of retries for timeout errors (default = 5) |
This function implements util_importwqwin iteratively to retrieve water quality results for the specified organization ID and start date. Data are retrieved using the API at https://prodapps.dep.state.fl.us/dear-watershed/swagger-ui/index.html.
A data frame containing the water quality data
## Not run: dat <- read_importwqwin("2025-01-15", "2025-02-15", "21FLMANA", verbose = TRUE) head(dat) ## End(Not run)## Not run: dat <- read_importwqwin("2025-01-15", "2025-02-15", "21FLMANA", verbose = TRUE) head(dat) ## End(Not run)
Scan directory for rasters (*.tif) and parse PRISM layer names into columns of a data frame.
read_prism_rasters(dir_tif)read_prism_rasters(dir_tif)
dir_tif |
directory path PRISM daily rasters were downloaded and cropped
using |
Any existing rasters in dir_tif are scanned based on a common naming
structure for the raster file name (prism_daily_{month}-{day}.tif) and
layer names ({date}_{variable}_v{version}-{date_updated}) into a data
frame.
For more on the Parameter-elevation Relationship on Independent Slopes Model (PRISM), see read_importprism().
A data frame with columns for:
path_tif path to GeoTIFF
lyr layer name
date date of modeled weather data
md month-day
variable variable of modeled weather data
version version (1-8)
date_updated date the model was updated
dir_tif <- system.file("prism", package = "tbeptools") read_prism_rasters(dir_tif)dir_tif <- system.file("prism", package = "tbeptools") read_prism_rasters(dir_tif)
Import JSON seagrass transect data from Water Atlas
read_transect(training = FALSE, raw = FALSE)read_transect(training = FALSE, raw = FALSE)
training |
logical if training data are imported or the complete database |
raw |
logical indicating if raw, unformatted data are returned, see details |
The function imports a JSON file from the USF Water Atlas. If training = TRUE, a dataset from the TBEP training survey is imported from https://tampabay.wateratlas.usf.edu/seagrass-transect-data-portal/api/assessments/training. If training = FALSE, the entire transect survey database is imported from https://tampabay.wateratlas.usf.edu/seagrass-transect-data-portal/api/assessments/all__use-with-care.
Abundance is reported as a numeric value from 0 -5 for Braun-Blanquet coverage estimates, blade length is in cm, and short shoot density is number of shoots per square meter. The short density is corrected for quadrat size included in the raw data.
If raw = TRUE, the unformatted data are returned. The default is to use formatting that allows the raw data to be used with the downstream functions. The raw data may have extra information that may be of use outside of the plotting functions in this package.
data frame
## Not run: # get training data transect <- read_transect(training = TRUE) # import all transect data transect <- read_transect() ## End(Not run)## Not run: # get training data transect <- read_transect(training = TRUE) # import all transect data transect <- read_transect() ## End(Not run)
Seagrass coverage by year
seagrassseagrass
A data frame used to create the flagship seagrass coverage graphic:
int
num
num
Original data are from the Southwest Florida Water Management District and available online at https://data-swfwmd.opendata.arcgis.com/. Totals are for all of Tampa Bay.
## Not run: seagrass <- structure(list( Year = c(1950L, 1982L, 1988L, 1990L, 1992L, 1994L, 1996L, 1999L, 2001L, 2004L, 2006L, 2008L, 2010L, 2012L, 2014L, 2016L, 2018L, 2020L, 2022L, 2024L), Acres = c(40420, 21650, 23285, 25226, 25753, 26518, 26916, 24841, 26078, 27021, 28299, 29647, 32897, 34642, 40294.71, 41655.16, 40651.55, 34298, 30137, 31563), Hectares = c(16357.39, 8761.44, 9423.11, 10208.6, 10421.87, 10731.45, 10892.52, 10052.8, 10553.39, 10935.01, 11452.2, 11997.72, 13312.94, 14019.27, 16306.69, 16857.25, 16451.1, 13880, 12196, 12773) ), class = "data.frame", row.names = c(NA, -20L)) save(seagrass, file = 'data/seagrass.RData', compress = 'xz') ## End(Not run)## Not run: seagrass <- structure(list( Year = c(1950L, 1982L, 1988L, 1990L, 1992L, 1994L, 1996L, 1999L, 2001L, 2004L, 2006L, 2008L, 2010L, 2012L, 2014L, 2016L, 2018L, 2020L, 2022L, 2024L), Acres = c(40420, 21650, 23285, 25226, 25753, 26518, 26916, 24841, 26078, 27021, 28299, 29647, 32897, 34642, 40294.71, 41655.16, 40651.55, 34298, 30137, 31563), Hectares = c(16357.39, 8761.44, 9423.11, 10208.6, 10421.87, 10731.45, 10892.52, 10052.8, 10553.39, 10935.01, 11452.2, 11997.72, 13312.94, 14019.27, 16306.69, 16857.25, 16451.1, 13880, 12196, 12773) ), class = "data.frame", row.names = c(NA, -20L)) save(seagrass, file = 'data/seagrass.RData', compress = 'xz') ## End(Not run)
Stations in Tampa Bay with sea level data through CO-OPS Data Retrieval API for use with
read_importsealevels().
sealevelstationssealevelstations
A data frame with 4 rows and 5 columns:
station_id integer station identifier
station_name character station name
longitude double longitude
latitude double latitude
date_est date established
Sediment data for the Tampa Bay current as of 20251210
sedimentdatasedimentdata
A data.frame with 231727 rows and 24 variables:
int
chr
chr
int
chr
int
chr
num
num
chr
chr
chr
num
chr
chr
num
num
num
num
chr
chr
chr
chr
Factor
## Not run: # location to download data path <- '~/Desktop/sediment.zip' # load and assign to object sedimentdata <- read_importsediment(path, download_latest = TRUE, remove = TRUE) save(sedimentdata, file = 'data/sedimentdata.RData', compress = 'xz') ## End(Not run)## Not run: # location to download data path <- '~/Desktop/sediment.zip' # load and assign to object sedimentdata <- read_importsediment(path, download_latest = TRUE, remove = TRUE) save(sedimentdata, file = 'data/sedimentdata.RData', compress = 'xz') ## End(Not run)
Seagrass management areas for Tampa Bay
sgmanagementsgmanagement
A simple features sf object (MULTIPOLYGON) with 30 features and 1 field, +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
int
These polygons are seagrass management areas for Tampa Bay that provide a finer division of areas within major segments (tbseg) having relevance for locations of seagrass beds.
## Not run: library(sf) library(dplyr) library(tools) # NAD83(HARN) / Florida West (ftUS) # same as sgseg prj <- 2882 # create sf object of boundaries sgmanagement <- st_read( dsn = '~/Desktop/TBEP/GISboundaries/Seagrass_Management_Areas/TBEP_SG_MA_FINAL_Projectfix.shp', drivers = 'ESRI Shapefile' ) %>% select(areas = TBEP_SG_MA) %>% st_zm() %>% st_transform(prj) # save save(sgmanagement, file = 'data/sgmanagement.RData', compress = 'xz') ## End(Not run)## Not run: library(sf) library(dplyr) library(tools) # NAD83(HARN) / Florida West (ftUS) # same as sgseg prj <- 2882 # create sf object of boundaries sgmanagement <- st_read( dsn = '~/Desktop/TBEP/GISboundaries/Seagrass_Management_Areas/TBEP_SG_MA_FINAL_Projectfix.shp', drivers = 'ESRI Shapefile' ) %>% select(areas = TBEP_SG_MA) %>% st_zm() %>% st_transform(prj) # save save(sgmanagement, file = 'data/sgmanagement.RData', compress = 'xz') ## End(Not run)
Seagrass segment reporting boundaries for southwest Florida
sgsegsgseg
A simple features sf object (POLYGON) with 22 features and 1 field, +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
chr
These polygons are used by Southwest Florida Water Management District for summarizing seagrass coverage estimates by major coastal and estuarine boundaries.
## Not run: library(sf) library(dplyr) library(tools) # create sf object of boundaries # make sure projection does not change sgseg <- st_read( dsn = '~/Desktop/TBEP/GISboundaries/Seagrass_Segment_Boundaries/Seagrass_Segment_Boundaries.shp', drivers = 'ESRI Shapefile' ) %>% select(segment = SEAGRASSSE) %>% mutate( segment = tolower(segment), segment = case_when( segment == 'terra ciea bay' ~ 'Terra Ceia Bay', T ~ segment ), segment = toTitleCase(segment) ) # save save(sgseg, file = 'data/sgseg.RData', compress = 'xz') ## End(Not run)## Not run: library(sf) library(dplyr) library(tools) # create sf object of boundaries # make sure projection does not change sgseg <- st_read( dsn = '~/Desktop/TBEP/GISboundaries/Seagrass_Segment_Boundaries/Seagrass_Segment_Boundaries.shp', drivers = 'ESRI Shapefile' ) %>% select(segment = SEAGRASSSE) %>% mutate( segment = tolower(segment), segment = case_when( segment == 'terra ciea bay' ~ 'Terra Ceia Bay', T ~ segment ), segment = toTitleCase(segment) ) # save save(sgseg, file = 'data/sgseg.RData', compress = 'xz') ## End(Not run)
Plot a matrix of AMBI scores over time by bay segment
show_ambimatrix( ambiscr, bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB", "All"), yrrng = c(1993, 2024), window = TRUE, alph = 1, txtsz = 2.5, family = "sans", rev = FALSE, position = "top", plotly = FALSE, width = NULL, height = NULL )show_ambimatrix( ambiscr, bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB", "All"), yrrng = c(1993, 2024), window = TRUE, alph = 1, txtsz = 2.5, family = "sans", rev = FALSE, position = "top", plotly = FALSE, width = NULL, height = NULL )
ambiscr |
input data frame as returned by |
bay_segment |
chr string for the bay segment, one to many of "HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB", "All" |
yrrng |
numeric indicating year ranges to evaluate |
window |
logical indicating whether to use a rolling 5-year window (default TRUE) or single year values (FALSE) for the bay segment categories, see details |
alph |
numeric indicating alpha value for score category colors |
txtsz |
numeric for size of text in the plot |
family |
optional chr string indicating font family for text labels |
rev |
logical if factor levels for bay segments are reversed |
position |
chr string of location for bay segment labels, default on top, passed to |
plotly |
logical if matrix is created using plotly |
width |
numeric for width of the plot in pixels, only applies if |
height |
numeric for height of the plot in pixels, only applies if |
An additional summary is provided for the entire bay as an unweighted summary across categories ("All").
The default behavior is to use a rolling five-year window to calculate the percent of sites in each AMBI category by bay segment. This applies only to years 2005 and later, where the counts from the current year and the prior four years are summed to calculate the percentages. This is intended to help smooth out inter-annual variability due to reduced sampling effort from 2005 to present. If window = FALSE, then only single year values are used.
The color scale reflects the adjusted AMBI classification (0-10 scale): Unpolluted (dark green), Slightly Polluted (light green), Meanly Polluted (yellow), Heavily Polluted (orange), and Extremely Polluted (red).
The matrix tile for each bay segment and year shows the dominant AMBI category based on the plurality of sites. The dominant category is the one with the highest proportion of sites in that year and bay segment.
A ggplot object showing trends over time in AMBI scores for each bay segment if plotly = FALSE, otherwise a plotly object
ambiscr <- anlz_ambiscr(benthicdata) show_ambimatrix(ambiscr)ambiscr <- anlz_ambiscr(benthicdata) show_ambimatrix(ambiscr)
Create a summary table of AMBI category percentages by bay segment
show_ambitab( ambiscr, bay_segment = c("OTB", "HB", "MTB", "LTB", "TCB", "MR", "BCB"), yrrng = c(1993, 2024) )show_ambitab( ambiscr, bay_segment = c("OTB", "HB", "MTB", "LTB", "TCB", "MR", "BCB"), yrrng = c(1993, 2024) )
ambiscr |
input data frame as returned by |
bay_segment |
chr string for the bay segment, one to many of "OTB", "HB", "MTB", "LTB", "TCB", "MR", "BCB" |
yrrng |
numeric vector of length two indicating the year range to summarise |
Only sampling funded by TBEP and as part of the routine EPC benthic monitoring program are included. Azoic stations are excluded from counts and percentages. The year range filter applies to all years from yrrng[1] through yrrng[2].
Column header colours match those used in show_ambimatrix: Unpolluted (dark green), Slightly Polluted (light green), Meanly Polluted (yellow), Heavily Polluted (orange), and Extremely Polluted (red).
A flextable object showing the count and percentage of sites in each AMBI category by bay segment over the requested year range. The bottom row ("All") summarises across all included bay segments.
ambiscr <- anlz_ambiscr(benthicdata) show_ambitab(ambiscr)ambiscr <- anlz_ambiscr(benthicdata) show_ambitab(ambiscr)
Plot mean AMBI scores over time by bay segment
show_ambitrend( ambiscr, ambiscr_tb = NULL, bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB", "All"), yrrng = c(1993, 2024), yscl = TRUE, plotly = FALSE, width = NULL, height = NULL )show_ambitrend( ambiscr, ambiscr_tb = NULL, bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB", "All"), yrrng = c(1993, 2024), yscl = TRUE, plotly = FALSE, width = NULL, height = NULL )
ambiscr |
input data frame as returned by |
ambiscr_tb |
optional second input data frame from |
bay_segment |
chr string for the bay segment, one to many of "HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB", "All". When multiple segments are selected (or "All"), scores are averaged across all sites in the selected segments. |
yrrng |
numeric vector of length two indicating the year range to plot |
yscl |
logical indicating whether the y-axis should span the full adjusted AMBI range (0 to 10, default |
plotly |
logical if the plot is created using plotly |
width |
numeric for width of the plot in pixels, only applies if |
height |
numeric for height of the plot in pixels, only applies if |
The background of the plot is shaded by AMBI pollution category using the adjusted score thresholds (0-10 scale, higher = healthier): Unpolluted (8.29-10, dark green), Slightly Polluted (5.29-8.29, light green), Meanly Polluted (2.89-5.29, yellow), Heavily Polluted (1.39-2.89, orange), and Extremely Polluted (0-1.39, red).
Only sampling funded by TBEP and as part of the routine EPC benthic monitoring program are included.
If both ambiscr and ambiscr_tb are provided, both series are shown on the same plot with dark grey used for the first series and black for the second. The AMBI variant for each input is detected automatically from the column names (AMBI or TBAMBI).
A ggplot object showing mean adjusted AMBI scores by year if plotly = FALSE, otherwise a plotly object
ambiscr <- anlz_ambiscr(benthicdata) ambiscr_tb <- anlz_ambiscr(benthicdata, type = 'AMBI-TB') show_ambitrend(ambiscr, ambiscr_tb)ambiscr <- anlz_ambiscr(benthicdata) ambiscr_tb <- anlz_ambiscr(benthicdata, type = 'AMBI-TB') show_ambitrend(ambiscr, ambiscr_tb)
Create a table for the annual management outcome assessments for chlorophyll-a and light attenuation by bay segment
show_annualassess( epcdata, yrsel, partialyr = F, caption = F, family = "Arial", txtsz = 12, width = NULL )show_annualassess( epcdata, yrsel, partialyr = F, caption = F, family = "Arial", txtsz = 12, width = NULL )
epcdata |
data frame of epc data returned by |
yrsel |
numeric indicating chosen year |
partialyr |
logical indicating if incomplete annual data for the most recent year are approximated by five year monthly averages for each parameter |
caption |
logical indicating if a caption is added using |
family |
chr string indicating font family for text labels |
txtsz |
numeric indicating font size |
width |
optional numeric value indicating width in inches |
A flextable object showing the segment-averaged chlorophyll-a and light attenuation for the selected year, with bay segment names colored by the management outcome used in show_matrix.
show_annualassess(epcdata, yrsel = 2025) show_annualassess(epcdata, yrsel = 2025, caption = TRUE)show_annualassess(epcdata, yrsel = 2025) show_annualassess(epcdata, yrsel = 2025, caption = TRUE)
Plot monthly chlorophyll or light attenuation values for a bay segment
show_boxplot( epcdata, param = c("chla", "la"), yrsel = NULL, yrrng = c(1975, 2025), ptsz = 0.5, bay_segment = c("OTB", "HB", "MTB", "LTB"), trgs = NULL, family = "sans", labelexp = TRUE, txtlab = TRUE, partialyr = FALSE, points = TRUE )show_boxplot( epcdata, param = c("chla", "la"), yrsel = NULL, yrrng = c(1975, 2025), ptsz = 0.5, bay_segment = c("OTB", "HB", "MTB", "LTB"), trgs = NULL, family = "sans", labelexp = TRUE, txtlab = TRUE, partialyr = FALSE, points = TRUE )
epcdata |
data frame of epc data returned by |
param |
chr string for which parameter to plot, one of |
yrsel |
numeric for year to emphasize, shown as separate red points on the plot |
yrrng |
numeric vector indicating min, max years to include |
ptsz |
numeric indicating point size of observations not in |
bay_segment |
chr string for the bay segment, one of "OTB", "HB", "MTB", "LTB" |
trgs |
optional |
family |
optional chr string indicating font family for text labels |
labelexp |
logical indicating if y axis and target labels are plotted as expressions, default |
txtlab |
logical indicating if a text label for the target value is shown in the plot |
partialyr |
logical indicating if incomplete annual data for the most recent year are approximated by five year monthly averages for each parameter |
points |
logical indicating if jittered point observations, including outliers, are shown in the plot |
Points not included in yrsel are plotted over the box plots using position_jitter. Use ptsz = -1 to suppress. The dotted line in the plot shows the large exceedance value.
A ggplot object
show_boxplot(epcdata, bay_segment = 'OTB')show_boxplot(epcdata, bay_segment = 'OTB')
Make a bar plot for transect training group comparisons
show_compplot( transect, yr, site, species = c("Halodule", "Syringodium", "Thalassia", "Halophila", "Ruppia"), varplo = c("Abundance", "Blade Length", "Short Shoot Density"), base_size = 18, xtxt = 10, size = 1 )show_compplot( transect, yr, site, species = c("Halodule", "Syringodium", "Thalassia", "Halophila", "Ruppia"), varplo = c("Abundance", "Blade Length", "Short Shoot Density"), base_size = 18, xtxt = 10, size = 1 )
transect |
data frame returned by |
yr |
numeric for year of training data to plot |
site |
chr string indicating site results to plot |
species |
chr string indicating which species to plot |
varplo |
chr string indicating which variable to plot |
base_size |
numeric indicating text scaling size for plot |
xtxt |
numeric indicating text size for x-axis labels |
size |
numeric indicating line size |
A ggplot object
transect <- read_transect(training = TRUE) show_compplot(transect, yr = 2025, site = '3', species = 'Halodule', varplo = 'Abundance')transect <- read_transect(training = TRUE) show_compplot(transect, yr = 2025, site = '3', species = 'Halodule', varplo = 'Abundance')
Map Enterococcus results by month, year, and location
show_enteromap( fibdata, yrsel, mosel, areasel = NULL, wetdry = FALSE, precipdata = NULL, temporal_window = NULL, wet_threshold = NULL, addsta = FALSE )show_enteromap( fibdata, yrsel, mosel, areasel = NULL, wetdry = FALSE, precipdata = NULL, temporal_window = NULL, wet_threshold = NULL, addsta = FALSE )
fibdata |
data frame of Enterococcus sample data as returned by |
yrsel |
optional numeric to filter data by year |
mosel |
optional numeric to filter data by month |
areasel |
optional character string to filter output by stations in the |
wetdry |
logical; if |
precipdata |
input data frame as returned by |
temporal_window |
numeric; required if |
wet_threshold |
numeric; required if |
addsta |
logical to add station labels to the map, default |
Placing the mouse cursor over an item on the map will reveal additional information about a station.
A leaflet map for the selected year, month, and area showing stations and FIB concentration category
anlz_enteromap for details on the categories
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")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")
Map Fecal Indicator Bacteria (FIB) results by month, year, and location
show_fibmap(fibdata, yrsel, mosel, areasel = NULL, addsta = FALSE)show_fibmap(fibdata, yrsel, mosel, areasel = NULL, addsta = FALSE)
fibdata |
input FIB |
yrsel |
optional numeric value to filter output by years in |
mosel |
optional numeric value to filter output by month in |
areasel |
optional character string to filter output by stations in the |
addsta |
logical to add station labels to the map, default |
Placing the mouse cursor over an item on the map will reveal additional information about a station. See the help file for anlz_fibmap for details on the categories and additional arguments.
A leaflet map for the selected year, month, and area showing stations and FIB concentration category
# show selected year, month show_fibmap(fibdata, yrsel = 2023, mosel = 8) # show selected year, month, and area show_fibmap(fibdata, yrsel = 2020, mosel = 7, areasel = 'Alafia River') # Manatee County data show_fibmap(mancofibdata, yrsel = 2020, mosel = 7, areasel = 'Little Manatee River')# show selected year, month show_fibmap(fibdata, yrsel = 2023, mosel = 8) # show selected year, month, and area show_fibmap(fibdata, yrsel = 2020, mosel = 7, areasel = 'Alafia River') # Manatee County data show_fibmap(mancofibdata, yrsel = 2020, mosel = 7, areasel = 'Little Manatee River')
Map Fecal Indicator Bacteria matrix results by year
show_fibmatmap( fibdata, yrsel, areasel, lagyr = 3, subset_wetdry = c("all", "wet", "dry"), precipdata = NULL, temporal_window = NULL, wet_threshold = NULL, addsta = FALSE, listout = FALSE, warn = TRUE )show_fibmatmap( fibdata, yrsel, areasel, lagyr = 3, subset_wetdry = c("all", "wet", "dry"), precipdata = NULL, temporal_window = NULL, wet_threshold = NULL, addsta = FALSE, listout = FALSE, warn = TRUE )
fibdata |
input data frame as returned by |
yrsel |
numeric value indicating the year to map |
areasel |
vector of bay segment or area names to include, see details |
lagyr |
numeric for year lag to calculate categories, see details |
subset_wetdry |
character, subset data frame to only wet or dry samples as defined by |
precipdata |
input data frame as returned by |
temporal_window |
numeric; required if |
wet_threshold |
numeric; required if |
addsta |
logical to add station labels to the map, default |
listout |
logical to return a list of simple feature objects for the data used in the |
warn |
logical to print warnings about stations with insufficient data, default |
Placing the mouse cursor over an item on the map will reveal additional information about a segment or station.
If the input is from EPCHC (from read_importfib, i.e., fibdata), valid entries for areasel include 'Alafia River', 'Hillsborough River', 'Big Bend', 'Cockroach Bay', 'East Lake Outfall', 'Hillsborough Bay', 'Little Manatee River', 'Lower Tampa Bay', 'McKay Bay', 'Middle Tampa Bay', 'Old Tampa Bay', 'Palm River', 'Tampa Bypass Canal', and 'Valrico Lake'. If the input data is from read_importentero (i.e., enterodata)), valid entries for areasel include 'OTB', 'HB', 'MTB', 'LTB', 'BCB', and 'MR'. If the input is from read_importwqp for Manatee County (21FLMANA_WQX, mancofibdata), Pasco County (21FLPASC_WQX, pascofibdata), Polk County (21FLPOLK_WQX, polcofibdata), or Hillsborough County Environmental Services Division (21FLHESD_WQX, hcesdfibdata) valid entries for areasel are any that are present in the area column for the respective input datasets.
Bay segment matrix categories can be shown if input data are from read_importentero. Stations for these data were chosen specifically as downstream endpoints for each bay segment, whereas the other datasets are not appropriate for estimating bay segment outcomes. Bay segment categories are shown using minor sub-basins. The collection of sub-basins that include stations used to estimate the bay segment outcomes are shown and color-coded by the appropriate outcome for each bay segment.
Care should be taken when communicating results at the bay segment scale to ensure appropriate messaging. Baywide scores could be misleading by using a handful of stations to communicate results at the bay segment scale. Reporting at this scale is meant to support assessments that are comparable to other similar indicators used by TBEP. A low grade for a bay segment does not imply hazardous conditions, rather the score reflects the aggregate likelihood for all stations selected for that bay segment. Remediation of conditions that contribute to fecal contamination is best handled at the site scale.
A leaflet map for the selected year and area showing station matrix scores if listout = FALSE (default). Bay segment scores are also shown if the input data are not from EPCHC. A list of simple feature objects is returned if listout = TRUE.
anlz_fibmatrix for details on the categories
# non-EPCHC, non Manatee County data show_fibmatmap(enterodata, yrsel = 2020, areasel = 'OTB') # EPCHC data show_fibmatmap(fibdata, yrsel = 2016, areasel = c("Hillsborough River", "Alafia River")) # Manatee County data show_fibmatmap(mancofibdata, yrsel = 2020, areasel = 'Manatee River')# non-EPCHC, non Manatee County data show_fibmatmap(enterodata, yrsel = 2020, areasel = 'OTB') # EPCHC data show_fibmatmap(fibdata, yrsel = 2016, areasel = c("Hillsborough River", "Alafia River")) # Manatee County data show_fibmatmap(mancofibdata, yrsel = 2020, areasel = 'Manatee River')
Plot a matrix of Fecal Indicator Bacteria categories over time by station or bay segment
show_fibmatrix( fibdata, yrrng = NULL, stas = NULL, bay_segment = NULL, lagyr = 3, subset_wetdry = c("all", "wet", "dry"), precipdata = NULL, temporal_window = NULL, wet_threshold = NULL, txtsz = 3, asreact = FALSE, nrows = 10, family = "sans", angle = 90, size = 10, hjust = 0, plotly = FALSE, width = NULL, height = NULL, warn = TRUE )show_fibmatrix( fibdata, yrrng = NULL, stas = NULL, bay_segment = NULL, lagyr = 3, subset_wetdry = c("all", "wet", "dry"), precipdata = NULL, temporal_window = NULL, wet_threshold = NULL, txtsz = 3, asreact = FALSE, nrows = 10, family = "sans", angle = 90, size = 10, hjust = 0, plotly = FALSE, width = NULL, height = NULL, warn = TRUE )
fibdata |
input data frame as returned by |
yrrng |
numeric vector indicating min, max years to include, defaults to range of years in data, see details |
stas |
optional vector of stations to include, see details |
bay_segment |
optional vector of bay segment names to include, supercedes |
lagyr |
numeric for year lag to calculate categories, see details |
subset_wetdry |
character, subset data frame to only wet or dry samples as defined by |
precipdata |
input data frame as returned by |
temporal_window |
numeric; required if |
wet_threshold |
numeric; required if |
txtsz |
numeric for size of text in the plot, applies only if |
asreact |
logical indicating if a |
nrows |
if |
family |
optional chr string indicating font family for text labels |
angle |
numeric for angle of x-axis text labels |
size |
numeric for size of the x-axis text labels |
hjust |
numeric for horizontal justification of x-axis text labels |
plotly |
logical if matrix is created using plotly |
width |
numeric for width of the plot in pixels, only applies of |
height |
numeric for height of the plot in pixels, only applies of |
warn |
logical to print warnings about stations with insufficient data, default |
The matrix color codes years and stations based on the likelihood of fecal indicator bacteria concentrations exceeding 410 CFU / 100 mL for E. coli (fresh) or 130 CFU / 100 mL for Enterococcus (marine). 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). 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). Methods and rationale for this categorization scheme are provided by the Florida Department of Environmental Protection, Figure 8 in the document at http://publicfiles.dep.state.fl.us/DEAR/BMAP/Tampa/MST%20Report/Fecal%20BMAP%20DST%20Final%20Report%20–%20June%202008.pdf and Morrison et al. 2009 in the BASIS 5 proceedings.
Bay segments scores are used instead of stations if bay_segment is not NULL and the input data are from read_importentero. Care should be taken when communicating results at the bay segment scale to ensure appropriate messaging. Baywide scores could be misleading by using a handful of stations to communicate results at the bay segment scale. Reporting at this scale is meant to support assessments that are comparable to other similar indicators used by TBEP. A low grade for a bay segment does not imply hazardous conditions, rather the score reflects the aggregate likelihood for all stations selected for that bay segment. Remediation of conditions that contribute to fecal contamination is best handled at the site scale.
See anlz_fibmatrix for additional details on the arguments.
A static ggplot object is returned by default. A reactable table is returned if asreact = TRUE. An interactive plotly object is returned if plotly = TRUE.
show_fibmatrix(fibdata) # show matrix for only dry samples show_fibmatrix(enterodata, lagyr = 1, subset_wetdry = "dry", temporal_window = 2, wet_threshold = 0.5)show_fibmatrix(fibdata) # show matrix for only dry samples show_fibmatrix(enterodata, lagyr = 1, subset_wetdry = "dry", temporal_window = 2, wet_threshold = 0.5)
Show Habitat Master Plan progress report card
show_hmpreport( acres, subtacres, hmptrgs, typ, twocol = FALSE, strata = c("Subtidal", "Intertidal", "Supratidal"), totintertid = TRUE, ycollapse = FALSE, text = 2.5, xang = 25, family = "sans", width = NULL, height = NULL )show_hmpreport( acres, subtacres, hmptrgs, typ, twocol = FALSE, strata = c("Subtidal", "Intertidal", "Supratidal"), totintertid = TRUE, ycollapse = FALSE, text = 2.5, xang = 25, family = "sans", width = NULL, height = NULL )
acres |
|
subtacres |
|
hmptrgs |
|
typ |
character string indicating |
twocol |
logical indicating only two colors are shown if target or goals are met and symbols indicate the likelihood of attaining targets or goals, see details |
strata |
character string indicating with strata to plot, one to many of |
totintertid |
logical indicating if total intertidal (mangroves, salt marsh, salt barrens) is shown |
ycollapse |
logical indicating if the y-axis is collapsed to year with data, see details |
text |
numeric indicating text size for proportion of target or goal met for habitat types shown in each cell types or symbol size if |
xang |
numeric for angle of habitat labels on the x-axis (top) |
family |
optional chr string indicating font family for text labels |
width |
numeric for width of the plot in pixels, only applies of |
height |
numeric for height of the plot in pixels, only applies of |
If twocol = F, colors indicate both if the target/goal is met and the likelihood of attaining the target/goal by 2030/2050. Red indicates the target/goal is not met and will likely not be met by 2030/2050 (trending below target/goal), yellow indicates the target/goal is met although it likely will not be met by 2030/2050 (trending below target/goal), light green indicates the target/goal is not met although it will likely be met by 2030/2050 (trending above target/goal), and green indicates the target/goal is met and will likely be met by 2030/2050 (trending above target/goal). Numbers in each cell show the proportion of the target or goal met at each year where data are available. If twocol = T, the colors indicate if the goal is met (green) or not met (red) and the symbols in each cell indicate if the goal is likely to be met (up arrow) or not (down arrow) by 2030/2050. In both cases, the colors and trends are relative to the 2030 targets or 2050 goals using the typ argument.
The report card provides no information on artificial reefs, living shorelines, and hard bottom habitats. These habitats are not assessed in routine data products from the Southwest Florida Water Management District, although targets and goals are provided in the Habitat Master Plan.
The subtidal data in subtacres and the inter/supratidal data in acres are provided as different datasets by the Southwest Florida Water Management District. The years in each dataset typically do not match and each dataset is collected at approximate 2 to 3 year intervals. By default, year on the y-axis is shown as a continuous variable, where gaps are shown in years when each dataset was unavailable. Use ycollapse = TRUE to remove years without data.
A ggplot2 object showing overall progress in attaining Habitat Master Plan targets or goals.
# view summarized data for report card, targets show_hmpreport(acres, subtacres, hmptrgs, typ = "targets") # view summarized data for report card, goals show_hmpreport(acres, subtacres, hmptrgs, typ = "goals") # remove empty years show_hmpreport(acres, subtacres, hmptrgs, typ = "targets", ycollapse = TRUE) # select only subtidal show_hmpreport(acres, subtacres, hmptrgs, typ = "targets", ycollapse = TRUE, strata = 'Subtidal') # show as symbols and colors show_hmpreport(acres, subtacres, hmptrgs, typ = "targets", ycollapse = TRUE, twocol = TRUE)# view summarized data for report card, targets show_hmpreport(acres, subtacres, hmptrgs, typ = "targets") # view summarized data for report card, goals show_hmpreport(acres, subtacres, hmptrgs, typ = "goals") # remove empty years show_hmpreport(acres, subtacres, hmptrgs, typ = "targets", ycollapse = TRUE) # select only subtidal show_hmpreport(acres, subtacres, hmptrgs, typ = "targets", ycollapse = TRUE, strata = 'Subtidal') # show as symbols and colors show_hmpreport(acres, subtacres, hmptrgs, typ = "targets", ycollapse = TRUE, twocol = TRUE)
Create a colorized table for indicator reporting
show_matrix( epcdata, txtsz = 3, trgs = NULL, yrrng = NULL, bay_segment = c("OTB", "HB", "MTB", "LTB"), asreact = FALSE, nrows = 10, abbrev = FALSE, family = "sans", historic = TRUE, plotly = FALSE, partialyr = FALSE, width = NULL, height = NULL )show_matrix( epcdata, txtsz = 3, trgs = NULL, yrrng = NULL, bay_segment = c("OTB", "HB", "MTB", "LTB"), asreact = FALSE, nrows = 10, abbrev = FALSE, family = "sans", historic = TRUE, plotly = FALSE, partialyr = FALSE, width = NULL, height = NULL )
epcdata |
data frame of epc data returned by |
txtsz |
numeric for size of text in the plot, applies only if |
trgs |
optional |
yrrng |
numeric vector indicating min, max years to include, defaults to range of years in |
bay_segment |
chr string for bay segments to include, one to all of "OTB", "HB", "MTB", "LTB" |
asreact |
logical indicating if a |
nrows |
if |
abbrev |
logical indicating if text labels in the plot are abbreviated as the first letter |
family |
optional chr string indicating font family for text labels |
historic |
logical if historic data are used from 2005 and earlier |
plotly |
logical if matrix is created using plotly |
partialyr |
logical indicating if incomplete annual data for the most recent year are approximated by five year monthly averages for each parameter |
width |
numeric for width of the plot in pixels, only applies of |
height |
numeric for height of the plot in pixels, only applies of |
A static ggplot object is returned if asreact = FALSE, otherwise a reactable table is returned
show_matrix(epcdata)show_matrix(epcdata)
Creates a plotly matrix from any matrix function input
show_matrixplotly( mat, family = "sans", tooltip = "Result", width = NULL, height = NULL )show_matrixplotly( mat, family = "sans", tooltip = "Result", width = NULL, height = NULL )
mat |
input matrix as output from |
family |
optional chr string indicating font family for text labels |
tooltip |
chr string indicating the column name for tooltip |
width |
numeric for width of the plot in pixels |
height |
numeric for height of the plot in pixels |
A plotly data object
mat <- show_wqmatrix(epcdata) show_matrixplotly(mat)mat <- show_wqmatrix(epcdata) show_matrixplotly(mat)
Create a bay segment assessment table for the 2022-2026 reasonable assurance period
show_ratab( epcdata, yrsel, bay_segment = c("OTB", "HB", "MTB", "LTB", "RALTB"), partialyr = F, outtxt1 = NULL, outtxt2 = NULL, outtxt3 = NULL, outtxt45 = NULL, txtsz = 13, width = NULL )show_ratab( epcdata, yrsel, bay_segment = c("OTB", "HB", "MTB", "LTB", "RALTB"), partialyr = F, outtxt1 = NULL, outtxt2 = NULL, outtxt3 = NULL, outtxt45 = NULL, txtsz = 13, width = NULL )
epcdata |
data frame of epc data returned by |
yrsel |
numeric indicating chosen year |
bay_segment |
chr string for the bay segment, one of "OTB", "HB", "MTB", "LTB", "RALTB" |
partialyr |
logical indicating if incomplete annual data for the most recent year are approximated by five year monthly averages for each parameter |
outtxt1 |
optional text for NMC action 1, added to the outcome column |
outtxt2 |
optional text for NMC action 2, added to the outcome column |
outtxt3 |
optional text for NMC action 3, added to the outcome column |
outtxt45 |
optional text for NMC actions 4 and 5, added to the outcome column |
txtsz |
numeric indicating font size |
width |
optional numeric value indicating width in inches |
Choosing bay_segment = 'RALTB' will not work with epcdata and additional data are needed to use this option.
A flextable object showing the reasonable assurance compliance of the bay segment for the selected year within the five-year period.
show_ratab(epcdata, yrsel = 2025, bay_segment = 'OTB')show_ratab(epcdata, yrsel = 2025, bay_segment = 'OTB')
Create reactable table from matrix data
show_reactable(totab, colfun, nrows = 10, txtsz = 3)show_reactable(totab, colfun, nrows = 10, txtsz = 3)
totab |
A data frame in wide format of summarized results |
colfun |
Function specifying how colors are treated in cell background |
nrows |
numeric specifying number of rows in the table |
txtsz |
numeric indicating text size in the cells, use |
This function is used internally within show_matrix and show_wqmatrix
A reactable table
data(targets) data(epcdata) library(tidyr) library(dplyr) # data totab <- anlz_avedat(epcdata) %>% .$ann %>% filter(var %in% 'mean_chla') %>% left_join(targets, by = 'bay_segment') %>% select(bay_segment, yr, val, chla_thresh) %>% mutate( bay_segment = factor(bay_segment, levels = c('OTB', 'HB', 'MTB', 'LTB')), outcome = case_when( val < chla_thresh ~ 'green', val >= chla_thresh ~ 'red' ) ) %>% select(bay_segment, yr, outcome) %>% spread(bay_segment, outcome) # color function colfun <- function(x){ out <- case_when( x == 'red' ~ '#FF3333', x == 'green' ~ '#33FF3B' ) return(out) } show_reactable(totab, colfun)data(targets) data(epcdata) library(tidyr) library(dplyr) # data totab <- anlz_avedat(epcdata) %>% .$ann %>% filter(var %in% 'mean_chla') %>% left_join(targets, by = 'bay_segment') %>% select(bay_segment, yr, val, chla_thresh) %>% mutate( bay_segment = factor(bay_segment, levels = c('OTB', 'HB', 'MTB', 'LTB')), outcome = case_when( val < chla_thresh ~ 'green', val >= chla_thresh ~ 'red' ) ) %>% select(bay_segment, yr, outcome) %>% spread(bay_segment, outcome) # color function colfun <- function(x){ out <- case_when( x == 'red' ~ '#FF3333', x == 'green' ~ '#33FF3B' ) return(out) } show_reactable(totab, colfun)
Create a barplot of seagrass coverage over time in Tampa Bay
show_seagrasscoverage( seagrass, maxyr = 2024, family = "sans", lastlab = T, axsbrk = c(0.08, 0.1) )show_seagrasscoverage( seagrass, maxyr = 2024, family = "sans", lastlab = T, axsbrk = c(0.08, 0.1) )
seagrass |
input |
maxyr |
numeric for maximum year to plot |
family |
optional chr string indicating font family for text labels |
lastlab |
logical indicating if text label on |
axsbrk |
numeric vector of length two indicating where the x-axis break occurs |
This function creates the flagship seagrass coverage graphic to report on coverage changes over time. All data were pre-processed and included in the package as the seagrass dataset. Original data are from the Southwest Florida Water Management District and available online at https://data-swfwmd.opendata.arcgis.com/. This function and the data used to create the plot are distinct from those used for the transect monitoring program.
A grid object showing acres of total seagrass coverage in Tampa Bay over time.
show_seagrasscoverage(seagrass)show_seagrasscoverage(seagrass)
Plot metal concentrations against aluminum
show_sedimentalratio( sedimentdata, param, yrrng = c(1993, 2024), bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB"), funding_proj = "TBEP", lnsz = 1, base_size = 12, plotly = FALSE, family = "sans", width = NULL, height = NULL )show_sedimentalratio( sedimentdata, param, yrrng = c(1993, 2024), bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB"), funding_proj = "TBEP", lnsz = 1, base_size = 12, plotly = FALSE, family = "sans", width = NULL, height = NULL )
sedimentdata |
input sediment |
param |
chr string for which parameter to plot, must be a metal |
yrrng |
numeric vector indicating min, max years to include, use single year for one year of data |
bay_segment |
chr string for the bay segment, one to many of "HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB" |
funding_proj |
chr string for the funding project, one to many of "TBEP" (default), "TBEP-Special", "Apollo Beach", "Janicki Contract", "Rivers", "Tidal Streams" |
lnsz |
numeric for line size |
base_size |
numeric indicating text scaling size for plot |
plotly |
logical if matrix is created using plotly |
family |
optional chr string indicating font family for text labels |
width |
numeric for width of the plot in pixels, only applies of |
height |
numeric for height of the plot in pixels, only applies of |
The plot shows the selected contaminant concentration relative to aluminum, the latter being present as a common metal in the Earth's crust. An elevated ratio of a metal parameter relative to aluminum suggests it is higher than background concentrations.
Lines for the Threshold Effect Level (TEL) and Potential Effect Level (PEL) are shown for the parameter, if available.
A ggplot object or a plotly object if plotly = TRUE showing the ratio of the selected parameter plotted against aluminum concentrations collected at the same site. Black lines show the linear fit of a log-log model and the 95% prediction intervals.
Schropp, S. J., Graham Lewis, F., Windom, H. L., Ryan, J. D., Calder, F. D., & Burney, L. C. 1990. Interpretation of metal concentrations in estuarine sediments of Florida using aluminum as a reference element. Estuaries. 13:227-235.
show_sedimentalratio(sedimentdata, param = 'Arsenic')show_sedimentalratio(sedimentdata, param = 'Arsenic')
Plot sediment concentration averages by bay segment
show_sedimentave( sedimentdata, param, yrrng = c(1993, 2024), bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB"), funding_proj = "TBEP", lnsz = 1, base_size = 12, plotly = FALSE, family = "sans", width = NULL, height = NULL )show_sedimentave( sedimentdata, param, yrrng = c(1993, 2024), bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB"), funding_proj = "TBEP", lnsz = 1, base_size = 12, plotly = FALSE, family = "sans", width = NULL, height = NULL )
sedimentdata |
input sediment |
param |
chr string for which parameter to plot |
yrrng |
numeric vector indicating min, max years to include, use single year for one year of data |
bay_segment |
chr string for the bay segment, one to many of "HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB" |
funding_proj |
chr string for the funding project, one to many of "TBEP" (default), "TBEP-Special", "Apollo Beach", "Janicki Contract", "Rivers", "Tidal Streams" |
lnsz |
numeric for line size |
base_size |
numeric indicating text scaling size for plot |
plotly |
logical if matrix is created using plotly |
family |
optional chr string indicating font family for text labels |
width |
numeric for width of the plot in pixels, only applies of |
height |
numeric for height of the plot in pixels, only applies of |
Lines for the Threshold Effect Level (TEL) and Potential Effect Level (PEL) are shown for the parameter, if available. Confidence intervals may not be shown for segments with insufficient data.
A ggplot object or a plotly object if plotly = TRUE showing sediment averages and 95% confidence intervals of the selected parameter concentrations for each bay segment
show_sedimentave(sedimentdata, param = 'Arsenic')show_sedimentave(sedimentdata, param = 'Arsenic')
Make a map for sediment contaminants at stations in Tampa Bay
show_sedimentmap( sedimentdata, param, yrrng = c(1993, 2024), funding_proj = "TBEP", weight = 1.5 )show_sedimentmap( sedimentdata, param, yrrng = c(1993, 2024), funding_proj = "TBEP", weight = 1.5 )
sedimentdata |
input sediment |
param |
chr string for which parameter to plot |
yrrng |
numeric vector indicating min, max years to include, use single year for one year of data |
funding_proj |
chr string for the funding project, one to many of "TBEP" (default), "TBEP-Special", "Apollo Beach", "Janicki Contract", "Rivers", "Tidal Streams" |
weight |
numeric for outline width of station points on the map |
The map shows sediment contaminant concentrations for the selected parameter relative to Threshold Effects Levels (TEL) and Potential Effects Levels (PEL), if available. Green points show concentrations below the TEL, yellow points show concentrations between the TEL and PEL, and red points show concentrations above the PEL. The applicable TEL and PEL values for the parameter are indicated in the legend. If TEL and PEL thresholds are not available, a map of the sediment concentrations is shown and a warning is returned to the console.
A leaflet object
show_sedimentmap(sedimentdata, param = 'Arsenic')show_sedimentmap(sedimentdata, param = 'Arsenic')
Plot summary of PEL averages by bay segment
show_sedimentpelave( sedimentdata, yrrng = c(1993, 2024), bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB"), funding_proj = "TBEP", alph = 1, ylim = c(0, 0.4), lnsz = 1, base_size = 12, plotly = FALSE, family = "sans", width = NULL, height = NULL )show_sedimentpelave( sedimentdata, yrrng = c(1993, 2024), bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB"), funding_proj = "TBEP", alph = 1, ylim = c(0, 0.4), lnsz = 1, base_size = 12, plotly = FALSE, family = "sans", width = NULL, height = NULL )
sedimentdata |
input sediment |
yrrng |
numeric vector indicating min, max years to include, use single year for one year of data |
bay_segment |
chr string for the bay segment, one to many of "HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB" |
funding_proj |
chr string for the funding project, one to many of "TBEP" (default), "TBEP-Special", "Apollo Beach", "Janicki Contract", "Rivers", "Tidal Streams" |
alph |
numeric indicating alpha value for score category colors |
ylim |
numeric for y axis limits |
lnsz |
numeric for line size |
base_size |
numeric indicating text scaling size for plot |
plotly |
logical if matrix is created using plotly |
family |
optional chr string indicating font family for text labels |
width |
numeric for width of the plot in pixels, only applies of |
height |
numeric for height of the plot in pixels, only applies of |
Lines for the grades are shown on the plot. Confidence intervals may not be shown for segments with insufficient data.
A ggplot object or a plotly object if plotly = TRUE showing PEL averages (average of the averages) and 95% confidence intervals for each bay segment
show_sedimentpelave(sedimentdata)show_sedimentpelave(sedimentdata)
Creates a plotly object for average PEL plots
show_sedimentpelaveplotly(p, width = NULL, height = NULL)show_sedimentpelaveplotly(p, width = NULL, height = NULL)
p |
|
width |
numeric for width of the plot in pixels |
height |
numeric for height of the plot in pixels |
A plotly data object
p <- show_sedimentpelave(sedimentdata) show_sedimentpelaveplotly(p)p <- show_sedimentpelave(sedimentdata) show_sedimentpelaveplotly(p)
Make a map for sediment PEL ratios at stations in Tampa Bay
show_sedimentpelmap( sedimentdata, yrrng = c(1993, 2024), bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB"), funding_proj = "TBEP", weight = 1.5 )show_sedimentpelmap( sedimentdata, yrrng = c(1993, 2024), bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB"), funding_proj = "TBEP", weight = 1.5 )
sedimentdata |
input sediment |
yrrng |
numeric vector indicating min, max years to include, use single year for one year of data |
bay_segment |
chr string for the bay segment, one to many of "HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB" |
funding_proj |
chr string for the funding project, one to many of "TBEP" (default), "TBEP-Special", "Apollo Beach", "Janicki Contract", "Rivers", "Tidal Streams" |
weight |
numeric for outline width of station points on the map |
The map shows average PEL ratios graded from A to F for benthic stations monitored in Tampa Bay. The PEL is a measure of how likely a contaminant is to have a toxic effect on invertebrates that inhabit the sediment. The PEL ratio is the contaminant concentration divided by the Potential Effects Levels (PEL) that applies to a contaminant, if available. Higher ratios and lower grades indicate sediment conditions that are likely unfavorable for invertebrates. The station average combines the PEL ratios across all contaminants measured at a station.
A leaflet object
show_sedimentpelmap(sedimentdata)show_sedimentpelmap(sedimentdata)
Create a colorized table for water quality outcomes by segment that includes the management action and chlorophyll, and light attenuation exceedances
show_segmatrix( epcdata, txtsz = 3, trgs = NULL, yrrng = c(1975, 2025), bay_segment = c("OTB", "HB", "MTB", "LTB"), abbrev = FALSE, family = "sans", historic = TRUE, plotly = FALSE, partialyr = FALSE, width = NULL, height = NULL )show_segmatrix( epcdata, txtsz = 3, trgs = NULL, yrrng = c(1975, 2025), bay_segment = c("OTB", "HB", "MTB", "LTB"), abbrev = FALSE, family = "sans", historic = TRUE, plotly = FALSE, partialyr = FALSE, width = NULL, height = NULL )
epcdata |
data frame of epc data returned by |
txtsz |
numeric for size of text in the plot, applies only if |
trgs |
optional |
yrrng |
numeric vector indicating min, max years to include |
bay_segment |
chr string for bay segments to include, only one of "OTB", "HB", "MTB", "LTB" |
abbrev |
logical indicating if text labels in the plot are abbreviated as the first letter |
family |
optional chr string indicating font family for text labels |
historic |
logical if historic data are used from 2005 and earlier |
plotly |
logical if matrix is created using plotly |
partialyr |
logical indicating if incomplete annual data for the most recent year are approximated by five year monthly averages for each parameter |
width |
numeric for width of the plot in pixels, only applies of |
height |
numeric for height of the plot in pixels, only applies of |
This function provides a combined output for the show_wqmatrix and show_matrix functions. Only one bay segment can be plotted for each function call.
A static ggplot object is returned
show_segmatrix(epcdata, bay_segment = 'OTB')show_segmatrix(epcdata, bay_segment = 'OTB')
Plot chlorophyll and secchi data together with matrix outcomes
show_segplotly( epcdata, bay_segment = c("OTB", "HB", "MTB", "LTB"), yrrng = c(1975, 2025), family = NULL, partialyr = FALSE, width = NULL, height = NULL )show_segplotly( epcdata, bay_segment = c("OTB", "HB", "MTB", "LTB"), yrrng = c(1975, 2025), family = NULL, partialyr = FALSE, width = NULL, height = NULL )
epcdata |
data frame of epc data returned by |
bay_segment |
chr string for the bay segment, one of "OTB", "HB", "MTB", "LTB" |
yrrng |
numeric for year range to plot |
family |
optional chr string indicating font family for text labels |
partialyr |
logical indicating if incomplete annual data for the most recent year are approximated by five year monthly averages for each parameter |
width |
numeric for width of the plot in pixels |
height |
numeric for height of the plot in pixels |
This function combines outputs from show_thrplot and show_segmatrix for a selected bay segment. The plot is interactive and can be zoomed by dragging the mouse pointer over a section of the plot. Information about each cell or value can be seen by hovering over a location in the plot.
An interactive plotly object
show_segplotly(epcdata)show_segplotly(epcdata)
Map site attainment categories for a selected year
show_sitemap( epcdata, yrsel, mosel = c(1, 12), param = c("chla", "la"), trgs = NULL, thrs = FALSE, showseg = TRUE, partialyr = FALSE )show_sitemap( epcdata, yrsel, mosel = c(1, 12), param = c("chla", "la"), trgs = NULL, thrs = FALSE, showseg = TRUE, partialyr = FALSE )
epcdata |
data frame of epc data returned by |
yrsel |
numeric for year to plot |
mosel |
optional numeric of length one or two for mapping results for a specific month or month range in a given year, default full year |
param |
chr string for which parameter to plot, one of |
trgs |
optional |
thrs |
logical indicating if attainment category is relative to targets (default) or thresholds, passed to |
showseg |
logical indicating of bay segment labels are included |
partialyr |
logical indicating if incomplete annual data for the most recent year are approximated by five year monthly averages for each parameter, only applies if |
A static ggplot object is returned
show_sitemap(epcdata, yrsel = 2025)show_sitemap(epcdata, yrsel = 2025)
Map site and bay segment attainment categories for a selected year
show_sitesegmap( epcdata, yrsel, param = c("chla", "la"), trgs = NULL, thrs = FALSE, partialyr = FALSE, showseg = TRUE, base_size = 12, family = "sans" )show_sitesegmap( epcdata, yrsel, param = c("chla", "la"), trgs = NULL, thrs = FALSE, partialyr = FALSE, showseg = TRUE, base_size = 12, family = "sans" )
epcdata |
data frame of epc data returned by |
yrsel |
numeric for year to plot |
param |
chr string for which parameter to plot, one of |
trgs |
optional |
thrs |
logical indicating if attainment category is relative to targets (default) or thresholds, passed to |
partialyr |
logical indicating if incomplete annual data for the most recent year are approximated by five year monthly averages for each parameter |
showseg |
logical indicating of bay segment labels are included |
base_size |
numeric indicating text scaling size for plot |
family |
optional chr string indicating font family for text labels |
The map is similar to that returned by show_sitemap with the addition of polygons for each bay segment colored by the annual attainment category and the site points are sized relative to the selected parameter in param.
A static ggplot object is returned
show_sitesegmap(epcdata, yrsel = 2025)show_sitesegmap(epcdata, yrsel = 2025)
This function creates a bar plot with error bars based on two groups split by a year value. It can optionally create an interactive plot and show individual data points.
show_splitbarplot( df, period_col, year_col, value_col, x_label_prefix = "", interactive = TRUE, source = "A", exploded = FALSE, bars_fill = c("#00BFC4", "#F8766D"), bars_alpha = 0.7, label_points = c("min", "max", "median"), label_color = "black", value_round = 2, text_size = 14 )show_splitbarplot( df, period_col, year_col, value_col, x_label_prefix = "", interactive = TRUE, source = "A", exploded = FALSE, bars_fill = c("#00BFC4", "#F8766D"), bars_alpha = 0.7, label_points = c("min", "max", "median"), label_color = "black", value_round = 2, text_size = 14 )
df |
A data frame containing the data to plot |
period_col |
Name of the column containing values "before" and "after" as an ordered factor |
year_col |
Name of the column containing year values |
value_col |
Name of the column containing the values to plot |
x_label_prefix |
Optional prefix for x-axis labels (default: "") |
interactive |
Logical; if TRUE, creates an interactive plot using plotly (default: TRUE) |
source |
if interactive is TRUE, the |
exploded |
Logical; if TRUE, adds individual points with labels for min, max, and mean (default: FALSE) |
bars_fill |
Fill color for bars (default: |
bars_alpha |
Alpha transparency for bars (default: 0.7) |
label_points |
Character vector specifying which points to label in exploded view (default: c("min","max","median")) |
label_color |
Color for labeled points in exploded view (default: "black") |
value_round |
Integer indicating number of decimal places for rounding values (default: 2) |
text_size |
Size of text for labels and hover text (default: 14) |
A ggplot2 object or plotly object (if interactive = TRUE)
# Create example data data <- data.frame( date = seq.Date(as.Date("2010-01-01"), as.Date("2020-12-31"), by = "month"), value = c(rnorm(66, mean = 10, sd = 4), rnorm(66, mean = 20, sd = 4)) ) # Basic analysis with default statistics split_date <- as.Date("2015-06-15") df <- anlz_splitdata(data, split_date, "date", "value") # Basic interactive plot show_splitbarplot(df, "period", "year", "avg") # Custom colors and labels with 1 decimal place show_splitbarplot(df, "period", "year", "avg", bars_fill = c("steelblue", "darkorange"), exploded = TRUE, label_points = c("min", "max"), label_color = "darkred", value_round = 1)# Create example data data <- data.frame( date = seq.Date(as.Date("2010-01-01"), as.Date("2020-12-31"), by = "month"), value = c(rnorm(66, mean = 10, sd = 4), rnorm(66, mean = 20, sd = 4)) ) # Basic analysis with default statistics split_date <- as.Date("2015-06-15") df <- anlz_splitdata(data, split_date, "date", "value") # Basic interactive plot show_splitbarplot(df, "period", "year", "avg") # Custom colors and labels with 1 decimal place show_splitbarplot(df, "period", "year", "avg", bars_fill = c("steelblue", "darkorange"), exploded = TRUE, label_points = c("min", "max"), label_color = "darkred", value_round = 1)
Plot a matrix of Tampa Bay Benthic Index scores over time by bay segment
show_tbbimatrix( tbbiscr, bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB", "All", "All (wt)"), yrrng = c(1993, 2024), window = TRUE, alph = 1, txtsz = 3, family = "sans", rev = FALSE, position = "top", plotly = FALSE, width = NULL, height = NULL )show_tbbimatrix( tbbiscr, bay_segment = c("HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB", "All", "All (wt)"), yrrng = c(1993, 2024), window = TRUE, alph = 1, txtsz = 3, family = "sans", rev = FALSE, position = "top", plotly = FALSE, width = NULL, height = NULL )
tbbiscr |
input data frame as returned by |
bay_segment |
chr string for the bay segment, one to many of "HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB", "All", "All (wt)" |
yrrng |
numeric indicating year ranges to evaluate |
window |
logical indicating whether to use a rolling 5-year window (default TRUE) or single year values (FALSE) for the bay segment categories, see details |
alph |
numeric indicating alpha value for score category colors |
txtsz |
numeric for size of text in the plot |
family |
optional chr string indicating font family for text labels |
rev |
logical if factor levels for bay segments are reversed |
position |
chr string of location for bay segment labels, default on top, passed to |
plotly |
logical if matrix is created using plotly |
width |
numeric for width of the plot in pixels, only applies of |
height |
numeric for height of the plot in pixels, only applies of |
Additional summaries are provided for the entire bay, as a summary across categories ("All") and a summary weighted across the relative sizes of each bay segment ("All (wt)").
The default behavior is to use a rolling five-year window to calculate the percent of sites in each TBBI category by bay segment. This applies only to years 2005 and later, where the counts from the current year and the prior four years are summed to calculate the percentages. This is intended to help smooth out inter-annual variability due to reduced sampling effort from 2005 to present. If window = FALSE, then only single year values are used.
A ggplot object showing trends over time in TBBI scores for each bay segment if plotly = FALSE, otherwise a plotly object
tbbiscr <- anlz_tbbiscr(benthicdata) show_tbbimatrix(tbbiscr)tbbiscr <- anlz_tbbiscr(benthicdata) show_tbbimatrix(tbbiscr)
Plot a matrix of Tampa Bay Nekton Index scores over time by bay segment
show_tbnimatrix( tbniscr, bay_segment = c("OTB", "HB", "MTB", "LTB"), perc = c(32, 46), alph = 1, txtsz = 3, family = "sans", rev = FALSE, position = "top", plotly = FALSE, width = NULL, height = NULL )show_tbnimatrix( tbniscr, bay_segment = c("OTB", "HB", "MTB", "LTB"), perc = c(32, 46), alph = 1, txtsz = 3, family = "sans", rev = FALSE, position = "top", plotly = FALSE, width = NULL, height = NULL )
tbniscr |
input data frame as returned by |
bay_segment |
chr string for the bay segment, one to many of "OTB", "HB", "MTB", "LTB" |
perc |
numeric values indicating break points for score categories |
alph |
numeric indicating alpha value for score category colors |
txtsz |
numeric for size of text in the plot |
family |
optional chr string indicating font family for text labels |
rev |
logical if factor levels for bay segments are reversed |
position |
chr string of location for bay segment labels, default on top, passed to |
plotly |
logical if matrix is created using plotly |
width |
numeric for width of the plot in pixels, only applies of |
height |
numeric for height of the plot in pixels, only applies of |
A ggplot object showing trends over time in TBNI scores for each bay segment
tbniscr <- anlz_tbniscr(fimdata) show_tbnimatrix(tbniscr)tbniscr <- anlz_tbniscr(fimdata) show_tbnimatrix(tbniscr)
Plot Tampa Bay Nekton Index scores over time by bay segment
show_tbniscr( tbniscr, bay_segment = c("OTB", "HB", "MTB", "LTB"), perc = c(32, 46), alph = 1, ylim = c(22, 58), rev = FALSE, plotly = FALSE, family = "sans", width = NULL, height = NULL )show_tbniscr( tbniscr, bay_segment = c("OTB", "HB", "MTB", "LTB"), perc = c(32, 46), alph = 1, ylim = c(22, 58), rev = FALSE, plotly = FALSE, family = "sans", width = NULL, height = NULL )
tbniscr |
input dat frame as returned by |
bay_segment |
chr string for the bay segment, one to many of "OTB", "HB", "MTB", "LTB" |
perc |
numeric values indicating break points for score categories |
alph |
numeric indicating alpha value for score category colors |
ylim |
numeric for y axis limits |
rev |
logical if factor levels for bay segments are reversed |
plotly |
logical if matrix is created using plotly |
family |
optional chr string indicating font family for text labels |
width |
numeric for width of the plot in pixels, only applies of |
height |
numeric for height of the plot in pixels, only applies of |
A ggplot object showing trends over time in TBNI scores for each bay segment or a plotly object if plotly = TRUE
tbniscr <- anlz_tbniscr(fimdata) show_tbniscr(tbniscr)tbniscr <- anlz_tbniscr(fimdata) show_tbniscr(tbniscr)
Plot Tampa Bay Nekton Index scores over time as average across bay segments
show_tbniscrall( tbniscr, perc = c(32, 46), alph = 1, ylim = c(22, 58), rev = FALSE, plotly = FALSE )show_tbniscrall( tbniscr, perc = c(32, 46), alph = 1, ylim = c(22, 58), rev = FALSE, plotly = FALSE )
tbniscr |
input dat frame as returned by |
perc |
numeric values indicating break points for score categories |
alph |
numeric indicating alpha value for score category colors |
ylim |
numeric for y axis limits |
rev |
logical if factor levels for bay segments are reversed |
plotly |
logical if matrix is created using plotly |
A ggplot object showing trends over time in TBNI scores for each bay segment or a plotly object if plotly = TRUE
tbniscr <- anlz_tbniscr(fimdata) show_tbniscrall(tbniscr)tbniscr <- anlz_tbniscr(fimdata) show_tbniscrall(tbniscr)
Creates a plotly object for TBNI score plots
show_tbniscrplotly(p, width = NULL, height = NULL)show_tbniscrplotly(p, width = NULL, height = NULL)
p |
|
width |
numeric for width of the plot in pixels |
height |
numeric for height of the plot in pixels |
A plotly data object
tbniscr <- anlz_tbniscr(fimdata) p <- show_tbniscrall(tbniscr) show_tbniscrplotly(p)tbniscr <- anlz_tbniscr(fimdata) p <- show_tbniscrall(tbniscr) show_tbniscrplotly(p)
Make a map for tidal creek report card
show_tdlcrk(dat, weight = 1.5)show_tdlcrk(dat, weight = 1.5)
dat |
input creek score data returned from |
weight |
numeric for weight of polylines, passed to |
A leaflet object
dat <- anlz_tdlcrk(tidalcreeks, iwrraw, yr = 2025) show_tdlcrk(dat)dat <- anlz_tdlcrk(tidalcreeks, iwrraw, yr = 2025) show_tdlcrk(dat)
Plotly barplots of tidal creek context indicators
show_tdlcrkindic( id, cntdat, yr = 2025, thrsel = FALSE, pal = c("#5C4A42", "#427355", "#004F7E") )show_tdlcrkindic( id, cntdat, yr = 2025, thrsel = FALSE, pal = c("#5C4A42", "#427355", "#004F7E") )
id |
numeric indicating the |
cntdat |
output from |
yr |
numeric indicating reference year |
thrsel |
logical if threshold lines and annotations are shown on the plots |
pal |
vector of colors for the palette |
A plotly object
cntdat <- anlz_tdlcrkindic(tidalcreeks, iwrraw, yr = 2025) set.seed(123) id <- sample(unique(cntdat$id), 1) show_tdlcrkindic(id, cntdat, thrsel = TRUE)cntdat <- anlz_tdlcrkindic(tidalcreeks, iwrraw, yr = 2025) set.seed(123) id <- sample(unique(cntdat$id), 1) show_tdlcrkindic(id, cntdat, thrsel = TRUE)
Plotly empirical CDF plots of tidal creek context indicators
show_tdlcrkindiccdf( id, cntdat, yr = 2025, thrsel = FALSE, pal = c("#5C4A42", "#427355", "#004F7E") )show_tdlcrkindiccdf( id, cntdat, yr = 2025, thrsel = FALSE, pal = c("#5C4A42", "#427355", "#004F7E") )
id |
numeric indicating the |
cntdat |
output from |
yr |
numeric indicating reference year |
thrsel |
logical if threshold lines and annotations are shown on the plots |
pal |
vector of colors for the palette |
This function returns several empirical cumulative distribution plots for the tidal creek context indicators. Points on the plot indicate the observed values and percentiles for the creek specified by id. The percentiles and CDF values are defined by the "population" of creeks in cntdat. Points in the plots are color-coded by sample year to evaluate temporal trends, if any.
A plotly object
cntdat <- anlz_tdlcrkindic(tidalcreeks, iwrraw, yr = 2025) set.seed(123) id <- sample(unique(cntdat$id), 1) show_tdlcrkindiccdf(id, cntdat, thrsel = TRUE)cntdat <- anlz_tdlcrkindic(tidalcreeks, iwrraw, yr = 2025) set.seed(123) id <- sample(unique(cntdat$id), 1) show_tdlcrkindiccdf(id, cntdat, thrsel = TRUE)
Add a line or annotation to a plotly graph for the tidal creek indicators
show_tdlcrkline( varin = c("CHLAC", "TN", "chla_tn_ratio", "DO", "tsi", "no23_ratio"), thrsel = FALSE, horiz = TRUE, annotate = FALSE )show_tdlcrkline( varin = c("CHLAC", "TN", "chla_tn_ratio", "DO", "tsi", "no23_ratio"), thrsel = FALSE, horiz = TRUE, annotate = FALSE )
varin |
chr string for the indicator |
thrsel |
logical if something is returned, otherwise NULL, this is a hack for working with the plotly output |
horiz |
logical indicating if output is horizontal or vertical |
annotate |
logical indicating if output is line or annotation text |
This function is used internally within show_tdlcrkindic and show_tdlcrkindiccdf
A list object passed to the layout argument of plotly, either shapes or annotate depending on user input
# code for vertical line output, chloropyll show_tdlcrkline('CHLAC', thrsel = TRUE)# code for vertical line output, chloropyll show_tdlcrkline('CHLAC', thrsel = TRUE)
Plot the tidal creek report card matrix
show_tdlcrkmatrix( dat, class = c("3M", "2"), score = c("Prioritize", "Investigate", "Caution", "Monitor"), family = "sans", size = 11 )show_tdlcrkmatrix( dat, class = c("3M", "2"), score = c("Prioritize", "Investigate", "Caution", "Monitor"), family = "sans", size = 11 )
dat |
input creek score data returned from |
class |
character vector indicating which creek classes to show, one to many of |
score |
character vector of score categories to include, one to many of |
family |
optional chr string indicating font family for text labels |
size |
numeric for text and line scaling |
The plot shows a matrix with rows for individual creeks and columns for overall creek score. The columns show an overall creek score and the number of years in the prior ten years that nitrogen values at a creek were assigned to each of the four score categories. Number of years is mapped to cell transparency.
A static ggplot object is returned.
dat <- anlz_tdlcrk(tidalcreeks, iwrraw, yr = 2025) show_tdlcrkmatrix(dat)dat <- anlz_tdlcrk(tidalcreeks, iwrraw, yr = 2025) show_tdlcrkmatrix(dat)
Radar plots for tidal creek indicators
show_tdlcrkradar( id, cntdat, col = "#338080E6", ptsz = 1, lbsz = 0.8, valsz = 1, brdwd = 5 )show_tdlcrkradar( id, cntdat, col = "#338080E6", ptsz = 1, lbsz = 0.8, valsz = 1, brdwd = 5 )
id |
numeric indicating the |
cntdat |
output from |
col |
color input for polygon and line portions |
ptsz |
numeric size of points |
lbsz |
numeric for size of text labels |
valsz |
numeric for size of numeric value labels |
brdwd |
numeric for polygon border width |
See details in anlz_tdlcrkindic for an explanation of the indicators
Internal code borrowed heavily from the radarchart function in the fmsb package.
A radar plot
cntdat <- anlz_tdlcrkindic(tidalcreeks, iwrraw, yr = 2025, radar = TRUE) set.seed(123) id <- sample(unique(cntdat$id), 1) show_tdlcrkradar(id, cntdat)cntdat <- anlz_tdlcrkindic(tidalcreeks, iwrraw, yr = 2025, radar = TRUE) set.seed(123) id <- sample(unique(cntdat$id), 1) show_tdlcrkradar(id, cntdat)
Plot annual water quality values, targets, and thresholds for a bay segment
show_thrplot( epcdata, bay_segment = c("OTB", "HB", "MTB", "LTB"), thr = c("chla", "la"), trgs = NULL, yrrng = c(1975, 2025), family = "sans", labelexp = TRUE, txtlab = TRUE, thrs = FALSE, partialyr = FALSE )show_thrplot( epcdata, bay_segment = c("OTB", "HB", "MTB", "LTB"), thr = c("chla", "la"), trgs = NULL, yrrng = c(1975, 2025), family = "sans", labelexp = TRUE, txtlab = TRUE, thrs = FALSE, partialyr = FALSE )
epcdata |
data frame of epc data returned by |
bay_segment |
chr string for the bay segment, one of "OTB", "HB", "MTB", "LTB" |
thr |
chr string indicating which water quality value and appropriate target/threshold to plot, one of "chl" for chlorophyll and "la" for light availability |
trgs |
optional |
yrrng |
numeric vector indicating min, max years to include |
family |
optional chr string indicating font family for text labels |
labelexp |
logical indicating if y axis and target labels are plotted as expressions, default |
txtlab |
logical indicating if a text label for the target value is shown in the plot |
thrs |
logical indicating if reference lines are shown only for the regulatory threshold |
partialyr |
logical indicating if incomplete annual data for the most recent year are approximated by five year monthly averages for each parameter |
A ggplot object
show_thrplot(epcdata, bay_segment = 'OTB', thr = 'chl')show_thrplot(epcdata, bay_segment = 'OTB', thr = 'chl')
Plot results for a seagrass transect by time and location
show_transect( transect, site, species = c("Halodule", "Syringodium", "Thalassia", "Halophila", "Ruppia", "Caulerpa", "Dapis", "Chaetomorpha"), yrrng = c(1998, 2025), varplo = c("Abundance", "Blade Length", "Short Shoot Density"), base_size = 12, facet = FALSE, ncol = NULL, plotly = FALSE, width = NULL, height = NULL, sppcol = NULL )show_transect( transect, site, species = c("Halodule", "Syringodium", "Thalassia", "Halophila", "Ruppia", "Caulerpa", "Dapis", "Chaetomorpha"), yrrng = c(1998, 2025), varplo = c("Abundance", "Blade Length", "Short Shoot Density"), base_size = 12, facet = FALSE, ncol = NULL, plotly = FALSE, width = NULL, height = NULL, sppcol = NULL )
transect |
data frame returned by |
site |
chr string indicating site results to plot |
species |
chr string indicating one to many of which species to plot |
yrrng |
numeric indicating year ranges to evaluate |
varplo |
chr string indicating which variable to plot |
base_size |
numeric indicating text scaling size for plot |
facet |
logical indicating if plots are separated into facets by species |
ncol |
numeric indicating number of columns if |
plotly |
logical if plot is created using plotly |
width |
numeric for width of the plot in pixels, only applies of |
height |
numeric for height of the plot in pixels, only applies of |
sppcol |
character vector of alternative colors to use for each species, must have length of six |
All sites along a transect that were surveyed are shown in the plot, including those where the selected species were not found. The latter is colored in grey hollow points. Species options include Halodule, Syringodium, Thalassia, Halophila, Ruppia, Caulerpa (attached macroalgae), Dapis (cyanobacteria), and/or Chaetomorpha (drift green algae). Drift or attached macroalgae and cyanobacteria (Dapis) estimates may not be accurate prior to 2021.
Note that if plotly = TRUE, the size legend is not shown.
A ggplot object
## Not run: transect <- read_transect() ## End(Not run) # one species show_transect(transect, site = 'S3T10', species = 'Halodule', varplo = 'Abundance') # multiple species, one plot show_transect(transect, site = 'S3T10', species = c('Halodule', 'Syringodium', 'Thalassia', 'Halophila', 'Ruppia', 'Caulerpa', 'Dapis', 'Chaetomorpha'), varplo = 'Abundance') # multiple species, multiple plots show_transect(transect, site = 'S3T10', species = c('Halodule', 'Syringodium', 'Thalassia', 'Halophila', 'Ruppia', 'Caulerpa', 'Dapis', 'Chaetomorpha'), varplo = 'Abundance', facet = TRUE)## Not run: transect <- read_transect() ## End(Not run) # one species show_transect(transect, site = 'S3T10', species = 'Halodule', varplo = 'Abundance') # multiple species, one plot show_transect(transect, site = 'S3T10', species = c('Halodule', 'Syringodium', 'Thalassia', 'Halophila', 'Ruppia', 'Caulerpa', 'Dapis', 'Chaetomorpha'), varplo = 'Abundance') # multiple species, multiple plots show_transect(transect, site = 'S3T10', species = c('Halodule', 'Syringodium', 'Thalassia', 'Halophila', 'Ruppia', 'Caulerpa', 'Dapis', 'Chaetomorpha'), varplo = 'Abundance', facet = TRUE)
Show annual averages of seagrass frequency occurrence by bay segments, year, and species
show_transectavespp( transectocc, bay_segment = c("OTB", "HB", "MTB", "LTB", "BCB"), yrrng = c(1998, 2025), species = c("Halodule", "Syringodium", "Thalassia", "Halophila", "Ruppia", "Caulerpa", "Dapis", "Chaetomorpha"), total = TRUE, alph = 1, family = "sans", plotly = FALSE, asreact = FALSE, width = NULL, height = NULL, sppcol = NULL )show_transectavespp( transectocc, bay_segment = c("OTB", "HB", "MTB", "LTB", "BCB"), yrrng = c(1998, 2025), species = c("Halodule", "Syringodium", "Thalassia", "Halophila", "Ruppia", "Caulerpa", "Dapis", "Chaetomorpha"), total = TRUE, alph = 1, family = "sans", plotly = FALSE, asreact = FALSE, width = NULL, height = NULL, sppcol = NULL )
transectocc |
data frame returned by |
bay_segment |
chr string for the bay segment, one to many of "OTB", "HB", "MTB", "LTB", "BCB" |
yrrng |
numeric indicating year ranges to evaluate |
species |
chr string of species to summarize, one to many of "Halodule", "Syringodium", "Thalassia", "Ruppia", "Halophila", "Caulerpa", "Dapis", "Chaetomorpha" |
total |
logical indicating if total frequency occurrence for all seagrass species is also returned, only applies if |
alph |
numeric indicating alpha value for score category colors |
family |
optional chr string indicating font family for text labels |
plotly |
logical if matrix is created using plotly |
asreact |
logical if a reactable table is returned instead of a plot |
width |
numeric for width of the plot in pixels, only applies of |
height |
numeric for height of the plot in pixels, only applies of |
sppcol |
character vector of alternative colors to use for each species, must have length of six |
Results are based on averages across seagrass species (Halodule, Syringodium, Thalassia, Ruppia, Halophila) by date and transect in each bay segment. Drift or attached macroalgae (e.g., Caulerpa, Chaetomorpha) and cyanobacteria (Dapis) estimates may not be accurate prior to 2021. If total = TRUE, a line showing the total frequency occurrence for all seagrass species is also shown (does not include macroalgae or cyanobacteria).
If asreact = F, a ggplot or plotly (if plotly = T) object is returned showing trends over time by species for selected bay segments. If asreact = T, a reactable table showing results by year, segment, and species is returned.
The plot is a representation of figure 2 in Johansson, R. (2016) Seagrass Transect Monitoring in Tampa Bay: A Summary of Findings from 1997 through 2015, Technical report #08-16, Tampa Bay Estuary Program, St. Petersburg, Florida.
The table is a representation of table 2, p. 163 in Yarbro, L. A., and P. R. Carlson, Jr., eds. 2016. Seagrass Integrated Mapping and Monitoring Program: Mapping and Monitoring Report No. 2. Fish and Wildlife Research Institute Technical Report TR-17 version 2. vi + 281 p.
## Not run: transect <- read_transect() ## End(Not run) transectocc <- anlz_transectocc(transect) show_transectavespp(transectocc)## Not run: transect <- read_transect() ## End(Not run) transectocc <- anlz_transectocc(transect) show_transectavespp(transectocc)
Show matrix of seagrass frequency occurrence by bay segments and year
show_transectmatrix( transectocc, bay_segment = c("OTB", "HB", "MTB", "LTB", "BCB"), total = TRUE, neutral = FALSE, yrrng = c(1998, 2025), alph = 1, txtsz = 3, family = "sans", rev = FALSE, position = "top", plotly = FALSE, width = NULL, height = NULL )show_transectmatrix( transectocc, bay_segment = c("OTB", "HB", "MTB", "LTB", "BCB"), total = TRUE, neutral = FALSE, yrrng = c(1998, 2025), alph = 1, txtsz = 3, family = "sans", rev = FALSE, position = "top", plotly = FALSE, width = NULL, height = NULL )
transectocc |
data frame returned by |
bay_segment |
chr string for the bay segment, one to many of "HB", "OTB", "MTB", "LTB", "TCB", "MR", "BCB" |
total |
logical indicating if average frequency occurrence is calculated for the entire bay across segments |
neutral |
logical indicating if a neutral and continuous color scheme is used |
yrrng |
numeric indicating year ranges to evaluate |
alph |
numeric indicating alpha value for score category colors |
txtsz |
numeric for size of text in the plot |
family |
optional chr string indicating font family for text labels |
rev |
logical if factor levels for bay segments are reversed |
position |
chr string of location for bay segment labels, default on top, passed to |
plotly |
logical if matrix is created using plotly |
width |
numeric for width of the plot in pixels, only applies of |
height |
numeric for height of the plot in pixels, only applies of |
Results are based on averages across seagrass species (Halodule, Syringodium, Thalassia, Ruppia, Halophila) by date and transect in each bay segment
The color scheme is based on arbitrary breaks at 25, 50, and 75 percent frequency occurrence. These don't necessarily translate to any ecological breakpoints. Use neutral = TRUE to use a neutral and continuous color palette.
A ggplot object showing trends over time for each bay segment if plotly = FALSE, otherwise a plotly object
This plot is a representation of Table 1 in R. Johansson (2016) Seagrass Transect Monitoring in Tampa Bay: A Summary of Findings from 1997 through 2015, Technical report #08-16, Tampa Bay Estuary Program, St. Petersburg, Florida.
## Not run: transect <- read_transect() ## End(Not run) transectocc <- anlz_transectocc(transect) show_transectmatrix(transectocc)## Not run: transect <- read_transect() ## End(Not run) transectocc <- anlz_transectocc(transect) show_transectmatrix(transectocc)
Plot frequency occurrence for a seagrass transect by time for all species
show_transectsum( transectocc, site, species = c("Halodule", "Syringodium", "Thalassia", "Halophila", "Ruppia", "Caulerpa", "Dapis", "Chaetomorpha"), yrrng = c(1998, 2025), abund = FALSE, sppcol = NULL )show_transectsum( transectocc, site, species = c("Halodule", "Syringodium", "Thalassia", "Halophila", "Ruppia", "Caulerpa", "Dapis", "Chaetomorpha"), yrrng = c(1998, 2025), abund = FALSE, sppcol = NULL )
transectocc |
data frame returned by |
site |
chr string indicating site results to plot |
species |
chr string indicating which species to plot |
yrrng |
numeric indicating year ranges to evaluate |
abund |
logical indicating if abundance averages are plotted instead of frequency occurrence |
sppcol |
character vector of alternative colors to use for each species, must have length of six |
This plot provides a quick visual assessment of how frequency occurrence or abundance for multiple species has changed over time at a selected transect. Drift or attached macroalgae (e.g., Caulerpa, Chaetomorpha) and cyanobacteria (Dapis) estimates may not be accurate prior to 2021.
A plotly object
## Not run: transect <- read_transect() ## End(Not run) transectocc <- anlz_transectocc(transect) show_transectsum(transectocc, site = 'S3T10')## Not run: transect <- read_transect() ## End(Not run) transectocc <- anlz_transectocc(transect) show_transectsum(transectocc, site = 'S3T10')
Create a colorized table for chlorophyll or light attenuation exceedances
show_wqmatrix( epcdata, param = c("chla", "la"), txtsz = 3, trgs = NULL, yrrng = c(1975, 2025), bay_segment = c("OTB", "HB", "MTB", "LTB"), asreact = FALSE, nrows = 10, abbrev = FALSE, family = "sans", plotly = FALSE, partialyr = FALSE, width = NULL, height = NULL )show_wqmatrix( epcdata, param = c("chla", "la"), txtsz = 3, trgs = NULL, yrrng = c(1975, 2025), bay_segment = c("OTB", "HB", "MTB", "LTB"), asreact = FALSE, nrows = 10, abbrev = FALSE, family = "sans", plotly = FALSE, partialyr = FALSE, width = NULL, height = NULL )
epcdata |
data frame of epc data returned by |
param |
chr string for which parameter to plot, one of |
txtsz |
numeric for size of text in the plot, applies only if |
trgs |
optional |
yrrng |
numeric vector indicating min, max years to include |
bay_segment |
chr string for bay segments to include, one to all of "OTB", "HB", "MTB", "LTB" |
asreact |
logical indicating if a |
nrows |
if |
abbrev |
logical indicating if text labels in the plot are abbreviated as the first letter |
family |
optional chr string indicating font family for text labels |
plotly |
logical if matrix is created using plotly |
partialyr |
logical indicating if incomplete annual data for the most recent year are approximated by five year monthly averages for each parameter |
width |
numeric for width of the plot in pixels, only applies of |
height |
numeric for height of the plot in pixels, only applies of |
A static ggplot object is returned if asreact = FALSE, otherwise a reactable table is returned
show_wqmatrix(epcdata)show_wqmatrix(epcdata)
Bay stations by segment
stationsstations
A data frame with 45 rows and 4 variables:
chr
num
num
num
Tampa Bay subtidal cover for Habitat Master Plan reporting
subtacressubtacres
A data frame
## Not run: load(url("https://github.com/tbep-tech/hmpu-workflow/raw/master/data/subtacres.RData")) save(subtacres, file = 'data/subtacres.RData', compress = 'xz') ## End(Not run)## Not run: load(url("https://github.com/tbep-tech/hmpu-workflow/raw/master/data/subtacres.RData")) save(subtacres, file = 'data/subtacres.RData', compress = 'xz') ## End(Not run)
Spatial data object of SWFWMD Tampa Bay segments
swfwmdtbsegswfwmdtbseg
A simple features sf object (MULTIPOLYGON) with 7 features and 1 fields, +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
## Not run: library(sf) library(dplyr) levs <- c('oldTampaBay', 'hillsboroughBay', 'middleTampaBay', 'lowerTampaBay', 'bocaCiegaBay', 'terraCieaBay', 'manateeRiver') labs <- c('Old Tampa Bay', 'Hillsborough Bay', 'Middle Tampa Bay', 'Lower Tampa Bay', 'Boca Ciega Bay', 'Terra Ceia Bay', 'Manatee River') swfwmdtbseg <- st_read( dsn = 'T:/05_GIS/SWFWMD/Seagrass/2022_Seagrass/DraftMaps2022_1130.gdb', layer = 'suncoastSeagrassSegments' ) %>% filter(waterbodyName %in% levs) %>% mutate( waterbodyName = factor(waterbodyName, levels = levs, labels = labs) ) %>% select(segment = waterbodyName) %>% st_transform(crs = 4326) save(swfwmdtbseg, file = 'data/swfwmdtbseg.RData', compress = 'xz') ## End(Not run)## Not run: library(sf) library(dplyr) levs <- c('oldTampaBay', 'hillsboroughBay', 'middleTampaBay', 'lowerTampaBay', 'bocaCiegaBay', 'terraCieaBay', 'manateeRiver') labs <- c('Old Tampa Bay', 'Hillsborough Bay', 'Middle Tampa Bay', 'Lower Tampa Bay', 'Boca Ciega Bay', 'Terra Ceia Bay', 'Manatee River') swfwmdtbseg <- st_read( dsn = 'T:/05_GIS/SWFWMD/Seagrass/2022_Seagrass/DraftMaps2022_1130.gdb', layer = 'suncoastSeagrassSegments' ) %>% filter(waterbodyName %in% levs) %>% mutate( waterbodyName = factor(waterbodyName, levels = levs, labels = labs) ) %>% select(segment = waterbodyName) %>% st_transform(crs = 4326) save(swfwmdtbseg, file = 'data/swfwmdtbseg.RData', compress = 'xz') ## End(Not run)
Spatial data object of SWFWMD Tampa Bay segments, 2024
swfwmdtbseg2024swfwmdtbseg2024
A simple features sf object (MULTIPOLYGON) with 7 features and 1 fields, +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
2024 segments are slightly different from swfwmdtbseg.
## Not run: library(sf) library(dplyr) labs <- c('Old Tampa Bay', 'Hillsborough Bay', 'Middle Tampa Bay', 'Lower Tampa Bay', 'Boca Ciega Bay', 'Terra Ceia Bay', 'Manatee River') levs <- labs swfwmdtbseg2024 <- st_read( dsn = 'T:/05_GIS/SWFWMD/Seagrass/2024_Seagrass/' ) %>% rename(waterbodyName = waterbodyN) %>% filter(waterbodyName %in% levs) %>% mutate( waterbodyName = factor(waterbodyName, levels = levs, labels = labs) ) %>% select(segment = waterbodyName) %>% st_transform(crs = 4326) save(swfwmdtbseg2024, file = 'data/swfwmdtbseg2024.RData', compress = 'xz') ## End(Not run)## Not run: library(sf) library(dplyr) labs <- c('Old Tampa Bay', 'Hillsborough Bay', 'Middle Tampa Bay', 'Lower Tampa Bay', 'Boca Ciega Bay', 'Terra Ceia Bay', 'Manatee River') levs <- labs swfwmdtbseg2024 <- st_read( dsn = 'T:/05_GIS/SWFWMD/Seagrass/2024_Seagrass/' ) %>% rename(waterbodyName = waterbodyN) %>% filter(waterbodyName %in% levs) %>% mutate( waterbodyName = factor(waterbodyName, levels = levs, labels = labs) ) %>% select(segment = waterbodyName) %>% st_transform(crs = 4326) save(swfwmdtbseg2024, file = 'data/swfwmdtbseg2024.RData', compress = 'xz') ## End(Not run)
Bay segment specific management targets including low and high magnitude exceedance thresholds
targetstargets
A data frame with 4 rows and 8 variables:
chr
chr
num
num
num
num
num
num
## Not run: targets <- structure(list( bay_segment = c("OTB", "HB", "MTB", "LTB", "BCBN", "BCBS", "TCB", "MR", "RALTB"), name = c("Old Tampa Bay", "Hillsborough Bay", "Middle Tampa Bay", "Lower Tampa Bay", "Boca Ciega Bay North", "Boca Ciega Bay South", "Terra Ceia Bay", "Manatee River", "Remainder Lower Tampa Bay"), chla_target = c(8.5, 13.2, 7.4, 4.6, 7.7, 6.1, 7.5, 7.3, NaN), chla_smallex = c(8.9, 14.1, 7.9, 4.8, NaN, NaN, NaN, NaN, NaN), chla_thresh = c(9.3, 15, 8.5, 5.1, 8.3, 6.3, 8.7, 8.8, 5.1), la_target = c(0.83, 1.58, 0.83, 0.63, NaN, NaN, NaN, NaN, NaN), la_smallex = c(0.86, 1.63, 0.87, 0.66, NaN, NaN, NaN, NaN, NaN), la_thresh = c(0.88, 1.67, 0.91, 0.68, NaN, NaN, NaN, NaN, NaN)), class = "data.frame", row.names = c(NA, -9L) ) save(targets, file = 'data/targets.RData') ## End(Not run)## Not run: targets <- structure(list( bay_segment = c("OTB", "HB", "MTB", "LTB", "BCBN", "BCBS", "TCB", "MR", "RALTB"), name = c("Old Tampa Bay", "Hillsborough Bay", "Middle Tampa Bay", "Lower Tampa Bay", "Boca Ciega Bay North", "Boca Ciega Bay South", "Terra Ceia Bay", "Manatee River", "Remainder Lower Tampa Bay"), chla_target = c(8.5, 13.2, 7.4, 4.6, 7.7, 6.1, 7.5, 7.3, NaN), chla_smallex = c(8.9, 14.1, 7.9, 4.8, NaN, NaN, NaN, NaN, NaN), chla_thresh = c(9.3, 15, 8.5, 5.1, 8.3, 6.3, 8.7, 8.8, 5.1), la_target = c(0.83, 1.58, 0.83, 0.63, NaN, NaN, NaN, NaN, NaN), la_smallex = c(0.86, 1.63, 0.87, 0.66, NaN, NaN, NaN, NaN, NaN), la_thresh = c(0.88, 1.67, 0.91, 0.68, NaN, NaN, NaN, NaN, NaN)), class = "data.frame", row.names = c(NA, -9L) ) save(targets, file = 'data/targets.RData') ## End(Not run)
Reference conditions for Tampa Bay Nekton Index metrics
tbnireftbniref
A data frame with 16 rows and 12 variables:
chr
chr
num
num
num
num
num
num
num
num
num
num
## Not run: library(tbeptools) tbniref <- anlz_tbnimet(fimdata) %>% dplyr::filter(between(Year, 1998, 2015)) %>% dplyr::select(Season, bay_segment, NumTaxa, BenthicTaxa, TaxaSelect, NumGuilds, Shannon) %>% dplyr::group_by(bay_segment, Season) %>% dplyr::summarize(NumTaxa_P5 = round(quantile(NumTaxa, probs = 0.05)), NumTaxa_P95 = round(quantile(NumTaxa, probs = 0.95)), BenthicTaxa_P5 = round(quantile(BenthicTaxa, probs = 0.05)), BenthicTaxa_P95 = round(quantile(BenthicTaxa, probs = 0.95)), TaxaSelect_P5 = round(quantile(TaxaSelect, probs = 0.05)), TaxaSelect_P95 = round(quantile(TaxaSelect, probs = 0.95)), NumGuilds_P5 = round(quantile(NumGuilds, probs = 0.05)), NumGuilds_P95 = round(quantile(NumGuilds, probs = 0.95)), Shannon_P5 = quantile(Shannon, probs = 0.05), Shannon_P95 = quantile(Shannon, probs = 0.95)) save(tbniref, file = 'data/tbniref.RData', compress = 'xz') ## End(Not run)## Not run: library(tbeptools) tbniref <- anlz_tbnimet(fimdata) %>% dplyr::filter(between(Year, 1998, 2015)) %>% dplyr::select(Season, bay_segment, NumTaxa, BenthicTaxa, TaxaSelect, NumGuilds, Shannon) %>% dplyr::group_by(bay_segment, Season) %>% dplyr::summarize(NumTaxa_P5 = round(quantile(NumTaxa, probs = 0.05)), NumTaxa_P95 = round(quantile(NumTaxa, probs = 0.95)), BenthicTaxa_P5 = round(quantile(BenthicTaxa, probs = 0.05)), BenthicTaxa_P95 = round(quantile(BenthicTaxa, probs = 0.95)), TaxaSelect_P5 = round(quantile(TaxaSelect, probs = 0.05)), TaxaSelect_P95 = round(quantile(TaxaSelect, probs = 0.95)), NumGuilds_P5 = round(quantile(NumGuilds, probs = 0.05)), NumGuilds_P95 = round(quantile(NumGuilds, probs = 0.95)), Shannon_P5 = quantile(Shannon, probs = 0.05), Shannon_P95 = quantile(Shannon, probs = 0.95)) save(tbniref, file = 'data/tbniref.RData', compress = 'xz') ## End(Not run)
Reference table for Tampa Bay Nekton Index species classifications
tbnispptbnispp
A data frame with 196 rows and 10 variables:
int
chr
chr
chr
chr
chr
chr
chr
chr
chr
## Not run: library(dplyr) # import and clean tbnispp <- read.csv('../tbni-proc/data/TBIndex_spp_codes.csv', header = TRUE, stringsAsFactors = FALSE) %>% mutate( NODCCODE = as.character(NODCCODE), NODCCODE = case_when(NODCCODE == "9.998e+09" ~ "9998000000", TRUE ~ NODCCODE) ) save(tbnispp, file = 'data/tbnispp.RData', compress = 'xz') ## End(Not run)## Not run: library(dplyr) # import and clean tbnispp <- read.csv('../tbni-proc/data/TBIndex_spp_codes.csv', header = TRUE, stringsAsFactors = FALSE) %>% mutate( NODCCODE = as.character(NODCCODE), NODCCODE = case_when(NODCCODE == "9.998e+09" ~ "9998000000", TRUE ~ NODCCODE) ) save(tbnispp, file = 'data/tbnispp.RData', compress = 'xz') ## End(Not run)
Note that these boundaries are not used for formal analysis and are only used as visual aids in mapping.
tbsegtbseg
A simple features sf object (POLYGON) with 4 features and 2 fields, +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
chr
chr
Spatial data object of Tampa Bay segments
library(sf) plot(st_geometry(tbseg))library(sf) plot(st_geometry(tbseg))
Note that these boundaries are not used for formal analysis and are only used as visual aids in mapping. The data object differs from tbseg by including Boca Ciega Bay, Terra Ceia Bay, and Manatee River. The boundaries are also more detailed.
tbsegdetailtbsegdetail
A simple features sf object (POLYGON) with 7 features and 2 fields, +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
chr
chr
Spatial data object of detailed Tampa Bay segments
library(sf) plot(st_geometry(tbsegdetail))library(sf) plot(st_geometry(tbsegdetail))
Note that these boundaries are not used for formal analysis and are only used as visual aids in mapping. The data object differs from tbseg by including Boca Ciega Bay South, Terra Ceia Bay, and Manatee River. The boundaries are also more detailed. This is the same data as tbsegdetail but with Boca Ciega Bay shown only as the southern portion.
tbsegdetailbcbstbsegdetailbcbs
A simple features sf object (POLYGON) with 7 features and 2 fields, +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
chr
chr
Spatial data object of detailed Tampa Bay segments, Boca Ciega Bay as southern portion
library(sf) plot(st_geometry(tbsegdetailbcbs))library(sf) plot(st_geometry(tbsegdetailbcbs))
Spatial data object of lines defining major Tampa Bay segments
tbseglinestbseglines
A simple features sf object (LINESTRING) with 3 features and 1 field, +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
library(sf) plot(st_geometry(tbseglines))library(sf) plot(st_geometry(tbseglines))
Spatial data object of Tampa Bay segments plus waterhseds
tbsegshedtbsegshed
A simple features sf object (POLYGON) with 7 features and 2 fields, +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
chr
chr
library(sf) plot(st_geometry(tbsegshed))library(sf) plot(st_geometry(tbsegshed))
Spatial data object of Tampa Bay watershed, includes the bay proper
tbshedtbshed
A simple features sf object (POLYGON) with 1 feature and 0 fields, +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
library(sf) ## Not run: library(dplyr) tbshed <- st_read('T:/05_GIS/BOUNDARIES/TBEP_Watershed_Correct_Projection.shp') %>% select(-Id, -Name, -Area_m, -Hectares) %>% st_transform(crs = 4326) save(tbshed, file = 'data/tbshed.RData', compress = 'xz') ## End(Not run) plot(st_geometry(tbshed))library(sf) ## Not run: library(dplyr) tbshed <- st_read('T:/05_GIS/BOUNDARIES/TBEP_Watershed_Correct_Projection.shp') %>% select(-Id, -Name, -Area_m, -Hectares) %>% st_transform(crs = 4326) save(tbshed, file = 'data/tbshed.RData', compress = 'xz') ## End(Not run) plot(st_geometry(tbshed))
Spatial data object of tidal creeks in Impaired Waters Rule, Run 67
tidalcreekstidalcreeks
A simple features sf object (MULTILINESTRING) with 623 features and 6 fields, +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
num
chr
chr
chr
chr
num
File was created using workflow at https://tbep-tech.github.io/tidalcreek-stats/Creek_select_tbeptools, example below is old and for Run 61.
## Not run: library(sf) library(dplyr) prj <- 4326 # create sf object of creek population, join with creek length data tidalcreeks <- st_read( dsn = '../../02_DOCUMENTS/tidal_creeks/TidalCreek_ALL_Line_WBID61.shp', drivers = 'ESRI Shapefile' ) %>% st_transform(crs = prj) %>% mutate( id = 1:nrow(.) ) %>% select(id, name = Name, JEI = CreekID, wbid = WBID, class = CLASS, Creek_Length_m = Total_m) # save save(tidalcreeks, file = 'data/tidalcreeks.RData', compress = 'xz') ## End(Not run)## Not run: library(sf) library(dplyr) prj <- 4326 # create sf object of creek population, join with creek length data tidalcreeks <- st_read( dsn = '../../02_DOCUMENTS/tidal_creeks/TidalCreek_ALL_Line_WBID61.shp', drivers = 'ESRI Shapefile' ) %>% st_transform(crs = prj) %>% mutate( id = 1:nrow(.) ) %>% select(id, name = Name, JEI = CreekID, wbid = WBID, class = CLASS, Creek_Length_m = Total_m) # save save(tidalcreeks, file = 'data/tidalcreeks.RData', compress = 'xz') ## End(Not run)
Tidal creek nitrogen targets
tidaltargetstidaltargets
A data frame with 2 rows and 4 variables:
chr
num
num
num
Seagrass transect data for Tampa Bay current as of 12052025
transecttransect
A data frame with 164724 rows and 11 variables:
chr
chr
Date
chr
chr
int
chr
num
chr
num
num
## Not run: transect <- read_transect() save(transect, file = 'data/transect.RData', compress = 'xz') ## End(Not run)## Not run: transect <- read_transect() save(transect, file = 'data/transect.RData', compress = 'xz') ## End(Not run)
Seagrass transect locations
trnlnstrnlns
A sf LINESTRING object
## Not run: library(sf) library(dplyr) trnlns <- st_read('T:/05_GIS/SEAGRASS_TRANSECTS/transect_routes.shp') %>% st_transform(crs = 4326) %>% dplyr::filter(!as.character(Site) %in% c('S8T1', 'S8T2', 'S8T3', 'S3T2')) %>% dplyr::mutate_if(is.factor, as.character) %>% dplyr::filter(Site %in% trnpts$TRAN_ID) # add bearing, positive counter-clockwise from east bearing <- lapply(trnlns$geometry, function(x) geosphere::bearing(x[, c(1:2)])[[1]]) %>% unlist() trnlns$bearing <- bearing # add bay segment using trnpts bayseg <- trnpts %>% dplyr::select(TRAN_ID, bay_segment) %>% sf::st_set_geometry(NULL) trnlns <- trnlns %>% dplyr::left_join(bayseg, by = c('Site' = 'TRAN_ID')) save(trnlns, file = 'data/trnlns.RData', compress = 'xz') ## End(Not run)## Not run: library(sf) library(dplyr) trnlns <- st_read('T:/05_GIS/SEAGRASS_TRANSECTS/transect_routes.shp') %>% st_transform(crs = 4326) %>% dplyr::filter(!as.character(Site) %in% c('S8T1', 'S8T2', 'S8T3', 'S3T2')) %>% dplyr::mutate_if(is.factor, as.character) %>% dplyr::filter(Site %in% trnpts$TRAN_ID) # add bearing, positive counter-clockwise from east bearing <- lapply(trnlns$geometry, function(x) geosphere::bearing(x[, c(1:2)])[[1]]) %>% unlist() trnlns$bearing <- bearing # add bay segment using trnpts bayseg <- trnpts %>% dplyr::select(TRAN_ID, bay_segment) %>% sf::st_set_geometry(NULL) trnlns <- trnlns %>% dplyr::left_join(bayseg, by = c('Site' = 'TRAN_ID')) save(trnlns, file = 'data/trnlns.RData', compress = 'xz') ## End(Not run)
Seagrass transect starting locations
trnptstrnpts
A sf POINT object
## Not run: library(sf) library(dplyr) library(tbeptools) trnpts <- st_read('T:/05_GIS/SEAGRASS_TRANSECTS/TransectBasics2019.shp') %>% st_transform(crs = 4326) %>% dplyr::rename(MonAgency = 'MON_AGENCY') %>% dplyr::filter(!as.character(TRAN_ID) %in% c('S8T1', 'S8T2', 'S8T3', 'S3T2')) # s4t10 is slightly outside boundary for lower tampa bay s4t10 <- trnpts %>% dplyr::filter(TRAN_ID %in% 'S4T10') %>% dplyr::mutate(bay_segment = 'LTB') trnpts <- trnpts %>% sf::st_intersection(sf::st_make_valid(tbsegshed)) %>% dplyr::select(-long_name) %>% dplyr::mutate_if(is.factor, as.character) %>% dplyr::bind_rows(s4t10) save(trnpts, file = 'data/trnpts.RData', compress = 'xz') ## End(Not run)## Not run: library(sf) library(dplyr) library(tbeptools) trnpts <- st_read('T:/05_GIS/SEAGRASS_TRANSECTS/TransectBasics2019.shp') %>% st_transform(crs = 4326) %>% dplyr::rename(MonAgency = 'MON_AGENCY') %>% dplyr::filter(!as.character(TRAN_ID) %in% c('S8T1', 'S8T2', 'S8T3', 'S3T2')) # s4t10 is slightly outside boundary for lower tampa bay s4t10 <- trnpts %>% dplyr::filter(TRAN_ID %in% 'S4T10') %>% dplyr::mutate(bay_segment = 'LTB') trnpts <- trnpts %>% sf::st_intersection(sf::st_make_valid(tbsegshed)) %>% dplyr::select(-long_name) %>% dplyr::mutate_if(is.factor, as.character) %>% dplyr::bind_rows(s4t10) save(trnpts, file = 'data/trnpts.RData', compress = 'xz') ## End(Not run)
Generate a two-column data frame of dates
util_dateseq(start_date, end_date)util_dateseq(start_date, end_date)
start_date |
character for the starting date in "YYYY-MM-DD" format |
end_date |
character for the ending date in "YYYY-MM-DD" format |
A sequence of dates is generated from the start to end date that includes monthly breaks, such that the first and last day of each month between the start and end dates is returned. This function is used within read_importwqwin to create separate API requests in approximate monthly breaks.
A data frame with two columns: start and end, containing dates.
util_dateseq('2023-01-15', '2023-05-04')util_dateseq('2023-01-15', '2023-05-04')
Return leaflet icon set for FIB maps
util_fibicons(indic)util_fibicons(indic)
indic |
character indicating |
Used internally with show_enteromap for wet/dry icons for Enterococcus, with show_fibmap for E. Coli/Enterococcus icons (EPCHC data), and with show_fibmatmap for matrix annual score category icons for EPCHC and non-EPCHC data.
A leaflet icon set as returned by iconList.
util_fibicons(indic = 'entero') util_fibicons(indic = 'entero&ecoli') util_fibicons(indic = 'fibmat')util_fibicons(indic = 'entero') util_fibicons(indic = 'entero&ecoli') util_fibicons(indic = 'fibmat')
A list of Fecal Indicator Bacteria (FIB) factor levels and labels
util_fiblevs()util_fiblevs()
A list with levels (often cutpoints) and labels for FIB categories
util_fiblevs()util_fiblevs()
Takes a vector of years and formats it into a concise string representation. For consecutive years within the same century, the end year is shortened (e.g., "2010-14"). For years spanning different centuries or non-consecutive years, full years are used (e.g., "1998-2001"). Optional prefix and suffix can be added to the formatted range.
util_frmyrrng(years, prefix = "", suffix = "")util_frmyrrng(years, prefix = "", suffix = "")
years |
Numeric vector of years (integers). Can be a single year or multiple years. |
prefix |
Character string to prepend to the formatted range. Default is empty string. |
suffix |
Character string to append to the formatted range. Default is empty string. |
A character string representing the year range in a concise format, with optional prefix and suffix. Returns an empty character vector if input is NULL or empty.
# Basic usage util_frmyrrng(2023) # Returns "2023" util_frmyrrng(2020:2024) # Returns "2020-24" # Using prefix and suffix util_frmyrrng(2023, prefix = "FY ") # Returns "FY 2023" util_frmyrrng(2020:2024, suffix = " AD") # Returns "2020-24 AD" util_frmyrrng(2020:2024, prefix = "Years ", suffix = " CE") # Returns "Years 2020-24 CE" # Other examples util_frmyrrng(1998:2001) # Returns "1998-2001" util_frmyrrng(c(2020, 2022)) # Returns "2020-2022" util_frmyrrng(c(2010, 2011, 2012), prefix = "c. ") # Returns "c. 2010-12" # Empty input util_frmyrrng(numeric(0)) # Returns character(0)# Basic usage util_frmyrrng(2023) # Returns "2023" util_frmyrrng(2020:2024) # Returns "2020-24" # Using prefix and suffix util_frmyrrng(2023, prefix = "FY ") # Returns "FY 2023" util_frmyrrng(2020:2024, suffix = " AD") # Returns "2020-24 AD" util_frmyrrng(2020:2024, prefix = "Years ", suffix = " CE") # Returns "Years 2020-24 CE" # Other examples util_frmyrrng(1998:2001) # Returns "1998-2001" util_frmyrrng(c(2020, 2022)) # Returns "2020-2022" util_frmyrrng(c(2010, 2011, 2012), prefix = "c. ") # Returns "c. 2010-12" # Empty input util_frmyrrng(numeric(0)) # Returns character(0)
Convert character string to html class
util_html(text)util_html(text)
text |
character string input |
Adapted from HTML
The same input character string with html class
util_html('abd')util_html('abd')
Retrieve metadata from the Water Atlas API
util_importwqwa(endpoint, pageSize = 10000, waterbodyId = NULL)util_importwqwa(endpoint, pageSize = 10000, waterbodyId = NULL)
endpoint |
Character indicating which API endpoint to retrieve, see details |
pageSize |
Numeric indicating the number of records to retrieve |
waterbodyId |
Optional numeric indicating a specific waterbody ID if requesting sampling locations |
Endpoints include "dataSources", "parameters", "sampling-locations", or "waterbodies".
Data are retrieved in pages if the total number of records exceeds the page size.
A data frame of results for the given endpoint
# get available parameters util_importwqwa('parameters') # get sampling locations for a specific waterbody waterbodies <- util_importwqwa('waterbodies') waterbodyid <- waterbodies |> dplyr::filter(grepl('Hillsborough Bay', name)) |> dplyr::pull(id) util_importwqwa('sampling-locations', waterbodyId = waterbodyid)# get available parameters util_importwqwa('parameters') # get sampling locations for a specific waterbody waterbodies <- util_importwqwa('waterbodies') waterbodyid <- waterbodies |> dplyr::filter(grepl('Hillsborough Bay', name)) |> dplyr::pull(id) util_importwqwa('sampling-locations', waterbodyId = waterbodyid)
Utility function to retrieve water quality data from the Florida Department of Environmental Protection's Watershed Information Network (WIN)
util_importwqwin(start_date, end_date, org_id, page_num)util_importwqwin(start_date, end_date, org_id, page_num)
start_date |
character string for the start date in the format "YYYY-MM-DD" |
end_date |
character string for the end date in the format "YYYY-MM-DD" |
org_id |
character string for the organization ID |
page_num |
integer for the page number to retrieve |
Used internally with read_importwqwin.
A list containing the results from the API request
## Not run: onepg <- util_importwqwin("2025-01-15", "2025-02-15", "21FLMANA", 1) head(onepg) ## End(Not run)## Not run: onepg <- util_importwqwin("2025-01-15", "2025-02-15", "21FLMANA", 1) head(onepg) ## End(Not run)
Create an empty leaflet map from sf input
util_map(tomap, minimap = "bottomleft")util_map(tomap, minimap = "bottomleft")
tomap |
|
minimap |
character string indicating location of minimap, use |
A leaflet object with optional minimap and ESRI provider tiles
tomap <- tibble::tibble( lon = -82.6365, lat = 27.75822 ) tomap <- sf::st_as_sf(tomap, coords = c('lon', 'lat'), crs = 4326) util_map(tomap)tomap <- tibble::tibble( lon = -82.6365, lat = 27.75822 ) tomap <- sf::st_as_sf(tomap, coords = c('lon', 'lat'), crs = 4326) util_map(tomap)
Get organization name from organization identifier in USEPA Water Quality Portal
util_orgin(org, stanm = FALSE)util_orgin(org, stanm = FALSE)
org |
chr string indicating the organization identifier, see |
stanm |
logical indicating if a character string for a column name specific to the organization is returned |
A character string of the organization name that corresponds to the organization identifier or a column name for the station identifier specific to the organization if stanm = TRUE
util_orgin('21FLHILL_WQX') util_orgin('21FLPASC_WQX', stanm = TRUE)util_orgin('21FLHILL_WQX') util_orgin('21FLPASC_WQX', stanm = TRUE)
Get rainfall data at NOAA NCDC sites
util_rain(station = NULL, start, end, token, ntry = 5, quiet = FALSE)util_rain(station = NULL, start, end, token, ntry = 5, quiet = FALSE)
station |
character for the station id to retrieve |
start |
character for start of time period as YYYY-MM-DD |
end |
character for end of time period as YYYY-MM-DD |
token |
character for the NOAA API key |
ntry |
numeric for the number of times to try to download the data |
quiet |
logical to print progress in the console |
This function is used to retrieve a long-term record of rainfall for the requested station. A NOAA API key is required to use the function.
a single value data frame with the rainfall sum in inches
## Not run: noaa_key <- Sys.getenv('NOAA_KEY') util_rain('GHCND:USW00092806', start = '2021-01-01', end = '2021-12-31', noaa_key) ## End(Not run)## Not run: noaa_key <- Sys.getenv('NOAA_KEY') util_rain('GHCND:USW00092806', start = '2021-01-01', end = '2021-12-31', noaa_key) ## End(Not run)