Skip to contents

Generates and saves diagnostic plots for hydrological model simulations using the airGR plotting functions. This function supports both airGR and non-airGR models by converting simulation results into a compatible format.

Usage

save_airGR_plot(
  file,
  model,
  simulation_results,
  ind = seq_along(simulation_results$date),
  hydro_data = NULL
)

Arguments

file

A string specifying the filename for the saved plot (e.g., "airGR_plot.pdf").

model

A string indicating the model name (e.g., "CemaNeigeGR4J"), used to determine if the model is from the airGR family. For a complete list see table in vignette("model_overview").

simulation_results

A list containing simulation outputs, typically from simulate_model. Must include at least Qsim, Qobs, and optionally snow-related variables like SWE, psolid, and pliquid.

ind

A vector of indices specifying the time period to plot. Defaults to the full time range.

hydro_data

Optional list containing BasinObs and BasinInfo, required if the model is not from the airGR family.

Value

A logical value indicating whether the plot was successfully saved.

Details

If the model is not from the airGR family, the function reconstructs an airGR::OutputsModel object using create_input and simulate_model, and overrides it with the provided simulation results. If snow-related outputs are present, additional snow plots are included.

Note

  • Currently supports only one CemaNeige snow layer.

  • A future version may support plotting without requiring Qobs.

Examples

save_airGR_plot(
  file = "airGR_plot.pdf",
  model = "CemaNeigeGR4J",
  simulation_results = simulation_results,
  hydro_data = hydro_data
)
#> Error in save_airGR_plot(file = "airGR_plot.pdf", model = "CemaNeigeGR4J",     simulation_results = simulation_results, hydro_data = hydro_data): object 'simulation_results' not found