Skip to contents

This function computes and plots the Flow Duration Curve (FDC) for observed and simulated discharge data. If multiple simulations are provided, a shaded band (min–max) and median line are shown. If only one simulation is provided, a single line is plotted.

Usage

plot_fdc(
  sim,
  obs,
  run_ids = NULL,
  scale_log = TRUE,
  x_label = "Exceedance Probability (%)",
  y_label = "Discharge (log scale)",
  title = "Flow Duration Curve: Observed vs Simulated"
)

Arguments

sim

A data frame or matrix of simulated discharge time series. Columns are assumed to represent different simulation runs, and one column should be named "date" for the date/time information. If only one simulation is provided, it will be plotted as a single line.

obs

A data frame with two columns: "date" and "discharge", where "date" contains the date/time information and "discharge" contains the observed discharge values.

run_ids

Optional. A character, numeric or a vector of character strings specifying which simulation run IDs to include (e.g., c("0001", "0002")). Matching is done by name, so exact character matching is recommended.

scale_log

Logical. If TRUE (default), a log-10 transformation is applied to the y-axis.

x_label

Label for the x-axis. Defaults to "Exceedance Probability (%)".

y_label

Label for the y-axis. Defaults to "Discharge (log scale)".

title

Plot title. Defaults to "Flow Duration Curve: Observed vs Simulated".

Value

A ggplot object showing the flow duration curve with observed and simulated data.

See also

Examples

if (FALSE) {
# Example with simulated and observed time series
plot_fdc(sim = sim_data, obs = obs_data, run_ids = c("0001", "0002"))
}