knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(easyrbi)
library(dplyr)

Summary

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.

Introduction

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")

Uses

Retrieving USGS gauge station data

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).

Example

sitedata(c("01078000", "01129200", "01144000"), "1970-10-01", "1980-09-30") %>%
  head(10)

Calculate the Richard Bakers' Flashiness Index (RBI) values for given sites

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.

Example 1

rbi_df("01564500", "1970-10-01", "1980-09-30")

Example 2

rbi_df(c("01564500", "01567000", "01052500", "01038000"), "1970-10-01", "1980-09-30")

Calculate the RBI trends over time

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().

Example

ex_data <- rbi_df(c("01038000", "01567000", "01052500"), "1970-10-01", "1980-09-30")

trends(x = ex_data) 

Watershed Identification

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.

Example

basin_id(c("01567000", "01490000", "01492500"))

How many dams have been removed close to your study sites?

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.

Example

dam_removal("01066000")

Investigate the RBI trends at sites where dams were removed.

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.

Example

dam_trends(c("01092000", "01100000", "01208500"), "1970-10-01", "1990-09-30")


amutaya/easyrbi documentation built on May 9, 2022, 4:04 p.m.