long_term_flood: Return flood metrics by county codes for a data frame input

Description Usage Arguments Value Examples

View source: R/user_fun.R

Description

Access USGS databases to retrieve gages and flow data for the specified county FIPS codes and the specified date ranges. Flooding at these gage locations are assessed by one of two metrics. Data can be returned at the gage level or the county level. This is the same as the run_flood function but accepts a data frame as input with multiple county codes and date ranges for each.

Usage

1
2
long_term_flood(input_df, threshold = "Q2", flood_type = "flood",
  weight = "Q2")

Arguments

input_df

Data frame with three columns: county_cd, start_date, and end_date

threshold

Character string of the flood threshold to be used in the analysis (either "Q2" or "NWS"). Defaults to "Q2".

flood_type

Character string of the defined flood type based on NWS classifications (one of "action", "flood", "moderate", or "major")

weight

Character string of variable to be used to scale by river size for weighted averages and scaling point sizes on maps. Options are median annual flood ("Q2") or drainage area ("DA"). Defaults to "Q2"

Value

A list with two data frames summarizing data by gage and by county.

Gage:

Name Type Description
start_date date Input start date
end_date date Input end date
site_no character USGS gage ID
county_cd character FIPS code of gage county location
lat numeric Gage latitude
long numeric Gage longitude
avg_peak numeric Mean flood ratio for date range (discharge/flood threshold)
flood_dur numeric Number of days in date range discharge above flood threshold
max_peak numeric Maximum value of flood ratio for date range (discharge/flood threshold)
num_missing numeric Number of days in given date range with no discharge data at that gage
Q2 numeric Median annual discharge (cubic feet per second)
DA numeric Drainage area of the gage (square miles)
size numeric Relative river size, logarithm of either Q2 or DA depending on user specified weight
state character State name
county character County name
flood character Flood magnitude category based on peak

County:

Name Type Description
county_cd character FIPS code of gage county location
start_date date Input start date
end_date date Input end date
county character County name
state character State name
num_gage numeric Number of analyzed gages in county
max_peak numeric Maximum observed flood ratio
avg_peak numeric Average flood ratio among county gages
minor numeric Percentage of gages at or above "minor" flood class (flood ratio > 1)
moderate numeric Percentage of gages at or above "moderate" flood class (flood ratio > 1.5)
major numeric Percentage of gages at or above "major" flood class (flood ratio > 2)
extreme numeric Percentage of gages at or above "extreme" flood class (flood ratio > 5)
max_dur numeric Maximum flood duration in county
avg_dur numeric Average flood duration in county

If threshold = "NWS", the columns "minor", "moderate", "major", and "extreme" are replaced with two columns: "no_flood" and "yes_flood" which show the percentage of gages in the county with or without flooding.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
#Northern VA flooding every April
county_cd <- c(rep("51013", 5), rep("51107", 5), rep("51059", 5))
start_date <- rep(c("2010-04-01", "2011-04-01", "2012-04-01", "2013-04-01", "2014-04-01"), 3)
end_date <- rep(c("2010-04-30", "2011-04-30", "2012-04-30", "2013-04-30", "2014-04-30"), 3)
input_df <- data.frame(county_cd = county_cd, start_date = start_date, end_date = end_date,
                      stringsAsFactors = FALSE)

#With default values
VA_floods <- long_term_flood(input_df)

#Using NWS values
VA_floods <- long_term_flood(input_df, threshold = "NWS")

## End(Not run)

countyfloods documentation built on May 2, 2019, 2:38 a.m.