plotBaseflow | R Documentation |
Plot output of flow, with daily and instantaneous flow (when available).
plotBaseflow(
sampleDates,
Daily,
INFO,
site,
HYSEPReturn,
baseflowColumns = "flowConditionHYSEP_localMin",
HYSEPcolNames = "LocalMin",
xlabel = TRUE,
showLegend = TRUE,
plotTitle = TRUE,
instantFlow = NA,
whatDischarge,
value = "Flow",
valueInst = "Flow_Inst"
)
sampleDates |
dataframe with two columns "Discharge_cubic_feet_per_second" and "maxSampleTime" |
Daily |
dataframe from getNWISDaily function in the dataRetrieval package |
INFO |
dataframe from getNWISInfo function in dataRetrieval package. Alternatively, a dataframe with a column "station.nm" |
site |
string USGS site identification |
HYSEPReturn |
dataframe with one column Dates, and at least 1 column of baseflow |
baseflowColumns |
string. Names of columns in the sampleDates dataframe with "Baseflow" or "Event" indicators. |
HYSEPcolNames |
string. Name of column in HYSEPReturn. |
xlabel |
logical. Whether or not to print x label |
showLegend |
logical. Whether or not to print legend |
plotTitle |
logical. Whether or not to print title |
instantFlow |
dataframe returned from retrieveUnitNWISData. If none available, NA. |
whatDischarge |
dataframe returned from |
value |
character name of discharge column in Daily |
valueInst |
character name of discharge column in instantFlow |
site <- "04085427"
sampleDates <- sampleDates
Start_extend <- as.character(as.Date(min(sampleDates$ActivityStartDateGiven, na.rm=TRUE))-60)
End_extend <- as.character(as.Date(max(sampleDates$ActivityStartDateGiven, na.rm=TRUE))+60)
Daily <- dataRetrieval::readNWISdv(site,'00060', Start_extend, End_extend)
Daily <- dataRetrieval::renameNWISColumns(Daily)
sampleDates <- findSampleQ(site, sampleDates, Daily)
startEnd <- getMaxStartEnd(Daily)
Start <- startEnd$Start
End <- startEnd$End
naFreeDaily <- Daily[!is.na(Daily$Flow),]
INFO <- dataRetrieval::readNWISsite(site)
DA_mi <- as.numeric(INFO$drain_area_va)
HYSEPReturn <- exampleHYSEP
sampleDates <- determineHYSEPEvents(HYSEPReturn, sampleDates,0.8)
whatDischarge <- dataRetrieval::whatNWISdata(siteNumber = site)
whatDischarge <- whatDischarge[whatDischarge$parm_cd == "00060", ]
Start <- as.character(as.Date(min(sampleDates$ActivityStartDateGiven, na.rm=TRUE)))
End <- as.character(as.Date(max(sampleDates$ActivityStartDateGiven, na.rm=TRUE)))
if ("uv" %in% whatDischarge$data_type_cd){
if(any(whatDischarge$begin_date[whatDischarge$data_type_cd == "uv"] < End, na.rm = TRUE)){
instantFlow <- dataRetrieval::readNWISuv(site,"00060",Start,End)
instantFlow <- dataRetrieval::renameNWISColumns(instantFlow)
}
}
plotBaseflow(sampleDates,Daily,INFO,site,HYSEPReturn,
baseflowColumns="flowConditionHYSEP_localMin",
HYSEPcolNames = "LocalMin",plotTitle=TRUE,
instantFlow=instantFlow,whatDischarge=whatDischarge,xlabel=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.