Plot mean annual cycle by evaluation periods
Source:R/performance-04-plots.R
plot_mean_annual_cycle.RdGenerates a plot of the mean annual cycle for simulated and observed values (e.g., streamflow) by evaluation periods. Includes an option to adjust the starting month for the water year.
Usage
plot_mean_annual_cycle(
data,
water_year = FALSE,
water_year_start,
x_label = "Month",
y_label = "Q [m3/s]",
show_legend = TRUE
)Arguments
- data
data frame. Mean monthly values of simulated and observed data, typically the
mean_annual_cycleoutput from evaluate_swat. Must include columns:source,period,month, andvalue.- water_year
logical. Whether the data should follow a water year (starting in a month other than January). Default:
FALSE.- water_year_start
numeric. The month number (1 to 12) that the water year starts. Required when
water_year = TRUEand ignored whenwater_year = FALSE.- x_label
character. Label for the x-axis. Default: "Month".
- y_label
character. Label for the y-axis. Default: "Q [m3/s]".
- show_legend
logical. Whether to display the legend. Default:
TRUE.
See also
Other Performance evaluation:
evaluate_swat(),
fdc_signature(),
gof_metrics(),
pbias_fdc_midsegment(),
pbias_fdc_target_segment(),
plot_fdc(),
plot_timeseries()
Examples
tmpdir <- tempdir()
get_swat_example(tmpdir)
rch_file <- file.path(tmpdir, "TxtInOut", "output.rch")
rch_data <- output_rch(
file = rch_file, variable = "FLOW_OUTcms",
target_id = 3, time_step = "daily",
output_start_date = "2011-01-01"
)
observed_data <- tibble::tibble(
Date = qobserved$Date,
value = qobserved$Flow,
target_id = 3
)
evaluation_results <- evaluate_swat(
rch_output = rch_data,
observed_data = observed_data,
target_id = 3,
variable = "FLOW_OUTcms",
metrics = c("NSE","KGE","MAE","PBIAS"),
start_dates = c("2011-01-01","2014-01-01"),
end_dates = c("2013-12-31","2015-12-31")
)
# Plot mean annual cycle by evaluation periods
plot_mean_annual_cycle(evaluation_results$mean_annual_cycle)