
Calculate non-point source (NPS) loads for gaged basins
Source:R/anlz_nps_gaged.R
anlz_nps_gaged.Rd
Calculate non-point source (NPS) loads for gaged basins
Usage
anlz_nps_gaged(
yrrng = c("2021-01-01", "2023-12-31"),
mancopth = NULL,
pincopth = NULL,
lakemanpth,
tampabypth,
bellshlpth,
verbose = TRUE
)
Arguments
- yrrng
A vector of two dates in 'YYYY-MM-DD' format, specifying the date range to retrieve flow data. Default is from '2021-01-01' to '2023-12-31'.
- mancopth
character, path to the Manatee County water quality data file, see details
- pincopth
character, path to the Pinellas County water quality data file, see details
- lakemanpth
character, path to the file containing the Lake Manatee flow data
- tampabypth
character, path to the file containing the Tampa Bypass flow data
- bellshlpth
character, path to the file containing the Bell shoals data
- verbose
logical indicating whether to print verbose output
Value
A data frame with columns for basin, year, month, TN in mg/L, TP in mg/L, TSS in mg/L, BOD in mg/L, flow in liters/month, hydrologic load in million m3/month, TN load in kg/month, TP load in kg/month, TSS load in kg/month, and BOD load in kg/month.
Details
The function uses util_nps_getflow
to retrieve flow data and util_nps_getwq
to retrieve water quality data. It then combines these datasets and calculates loads for TN, TP, TSS, BOD, and hydrologic load. See the help files for each function for more details.
Required external data inputs are Lake Manatee, Tampa Bypass, and Alafia River Bell Shoals flow data. These are not available from the USGS API and must be obtained from the contacts listed in util_nps_getextflow
. USGS flow data are for stations 02299950, 02300042, 02300500, 02300700, 02301000, 02301300, 02301500, 02301750, 02303000, 02303330, 02304500, 02306647, 02307000, 02307359, and 02307498. The USGS flow data are from the NWIS database as returned by readNWISdv
.
Water Quality data are obtained from the FDEP WIN database API, tbeptools, or local files as described in util_nps_getwq
. Chosen stations are ER2 and UM2 for Manatee County and station 06-06 for Pinellas County. Environmental Protection Commission (EPC) of Hillsborough County stations retained are 105, 113, 114, 132, 141, 138, 142, and 147. Manatee or Pinellas County data can be imported from local files using the mancopth
and pincopth
arguments, respectively. If these are not provided, the function will attempt to retrieve data from the FDEP WIN database using read_importwqwin
from tbeptools. The EPC data are retrieved using read_importepc
from tbeptools.
The function assumes that the water quality data are in mg/L and flow data are in cfs. Missing water quality data are filled with previous five year averages for the end months, then linearly interpolated using util_nps_fillmiswq
. This function will need to be updated for future load calculations.
Examples
if (FALSE) { # \dontrun{
mancopth <- system.file('extdata/nps_wq_manco.txt', package = 'tbeploads')
pincopth <- system.file('extdata/nps_wq_pinco.txt', package = 'tbeploads')
lakemanpth <- system.file('extdata/nps_extflow_lakemanatee.xlsx', package = 'tbeploads')
tampabypth <- system.file('extdata/nps_extflow_tampabypass.xlsx', package = 'tbeploads')
bellshlpth <- system.file('extdata/nps_extflow_bellshoals.xls', package = 'tbeploads')
nps_gaged <- anlz_nps_gaged(yrrng = c('2021-01-01', '2023-12-31'), mancopth = mancopth,
pincopth = pincopth, lakemanpth = lakemanpth, tampabypth = tampabypth,
bellshlpth = bellshlpth, verbose = TRUE)
head(nps_gaged)
} # }