rvn_annual_peak_error {RavenR}R Documentation

Annual Peak Errors

Description

rvn_annual_peak_error creates a plot of the annual observed and simulated peak percent errors, based on the water year.

Usage

rvn_annual_peak_error(
  sim,
  obs,
  mm = 9,
  dd = 30,
  add_line = TRUE,
  add_labels = TRUE
)

Arguments

sim

time series object of simulated flows

obs

time series object of observed flows

mm

month of water year (default 9)

dd

day of water year (default 30)

add_line

optionally adds a 1:1 line to the plot for reference (default TRUE)

add_labels

optionally adds labels for overpredict/underpredict on right side axis (default TRUE)

Details

Creates a plot of the percent errors in simulated peaks for each water year. The peaks are calculated as the magnitude of the largest event in each water year. Note that the rvn_annual_peak_error function is first used to obtain the peaks in each year, then the percent errors are calculated.

The percent errors are calculated as (QPsim-QPobs)/QPobs*100, where QP is the peak flow event.

The sim and obs should be of time series (xts) format and are assumed to be of the same length and time period. The flow series are assumed to be daily flows with units of m3/s.

The add_labels will add the labels of 'overprediction' and 'underprediction' to the right hand side axis if set to TRUE. This is useful in interpreting the plots.

Note that a plot title is purposely omitted in order to allow the automatic generation of plot titles.

Value

returns a list with peak errors in a data frame, and a ggplot object

df_peak_error

data frame of the calculated peak errors

p1

ggplot object with plotted annual peak errors

See Also

rvn_annual_peak_event to consider the timing of peak events rvn_annual_peak_event_error to calculate errors in peak events.

Examples


system.file("extdata","run1_Hydrographs.csv", package="RavenR") %>%
rvn_hyd_read(.) %>%
rvn_hyd_extract(subs="Sub36",.) ->
hyd_data

sim <- hyd_data$sim
obs <- hyd_data$obs

# create a plot of annual peak errors with default options
peak1 <- rvn_annual_peak_error(sim, obs)
peak1$df_peak_error
peak1$p1

# plot directly and without labels
rvn_annual_peak_error(sim, obs, add_line=TRUE, add_labels=FALSE)


[Package RavenR version 2.2.2 Index]