knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(easyrbi) library(dplyr)
The easyrbi
package is made with users and hydrologists who are interested in studying stream discharge data in mind. The package contains functions that retrieve streamflow data (pCode = 00060) from the USGS website and dam removal time series data from USGS Gages II collected between 1931-01-01 and 2014-12-31. All functions return tidy dataframes which are easy to work with.
To get started, install the easyrbi
package and load all the necessary packages
# If you haven't installed remotes yet, do so: # install.packages("remotes") remotes::install_github("amutaya/easyrbi")
Hydrologists might want more information about given sites, so the sitedata()
function provides drainage per day, the drainage area and the corresponding water year. This function provides the site names and locations (geographic coordinates).
sitedata()
returns 18 variables each recorded at a daily scale. Here, we have to decided to show only the first 10 observations because the output dataframe is large. sitedata(c("01078000", "01129200", "01144000"), "1970-10-01", "1980-09-30") %>% head(10)
Stream flashiness is the rapidity and frequency of short term changes in the stream flow especially during runoff events. The flashiness is calculated as the ratio between the sum of daily changes in discharge and sum of daily discharge as shown by the Richard Bakers' Flashiness Index (RBI). For any given site or sites, the rbi_df()
function outputs the respective RBI values for each site and the corresponding water year over a given time period. The function will take in the site numbers, and the start and end date as characters then return a data frame.
rbi_df("01564500", "1970-10-01", "1980-09-30")
rbi_df(c("01564500", "01567000", "01052500", "01038000"), "1970-10-01", "1980-09-30")
After one has obtained the RBI values for their different sites, they can also use the trends()
function to get the summary statistics for the any of the USGS gauge sites. This allows them to see if the stream flashiness values have changed over the given time frame. trends()
returns a dataframe with summary statistics from the sens.slope()
and Mann-Kendall()
functions. It is important to note that trends()
takes in data frames obtained after running rbi_df()
.
trends()
returns a dataframe wit 14 observations.ex_data <- rbi_df(c("01038000", "01567000", "01052500"), "1970-10-01", "1980-09-30") trends(x = ex_data)
Ever wondered how large the watershed you are studying is? Or whether the watershed is consired a reference or non-refence site? For any given site numbers, the basin_id()
function generates a dataframe that consists of the watershed identification information as provided by the U.S. Geological Survey (USGS) Geospatial Attributes of Gages for Evaluating Streamflow II (GAGES-II) dataset. The basin_id()
function is interactive, so you can choose to overwrite previously downloaded data files.
basin_id(c("01567000", "01490000", "01492500"))
easyrbi
allows the user to also download dam removal data recorded between 1931 and 2014 using a simple function that only takes in the site number(s) as an argument. The dam_removal()
function is also interactive, so you can choose to overwrite previously downloaded data files.
dam_removal("01066000")
The easyrbi
package also help you get a better understanding of the impacts of dam removals on stream flashiness. For any given gauge stations, check if there is a relationship between stream flashiness trends and dam removals.
dam_trends(c("01092000", "01100000", "01208500"), "1970-10-01", "1990-09-30")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.