This function generates diagnostic plots for each species found in the evaluation workspace. It produces comparison plots and, when possible, scatter plots highlighting deteriorated variables based on a given threshold.

gen_plots(
  config,
  workspace = EvalWorkspace$new(config$eval_workspace),
  backend = ParallelBackend$new(config$parallel, config$cores),
  scatter_fn = gen_scatter_plot,
  comparison_fn = function(x, dir) x$plot_comparison(dir),
  logger_info = logger::log_info
)

Arguments

config

List. Configuration object created by make_config(), containing all parameters required for the plots generation

workspace

EvalWorkspace. An instance of EvalWorkspace to access the evaluation data. Defaults to a new instance using the eval_workspace parameter from the configuration.

backend

ParallelBackend. An instance of ParallelBackend to run parallel computations. Defaults to a new instance using the parallel and cores parameters from the configuration.

scatter_fn

Function. A function to generate scatter plots. It should accept the following arguments: output_dir, sim, obs, ref_sim, and vars. Defaults to gen_scatter_plot().

comparison_fn

Function. A function to generate comparison plots. It should accept the following arguments: comparison and output_dir. Defaults to a function that calls the plot_comparison() method of the comparison object.

logger_info

Function. A logging function to report progress. It should accept a single string argument. Defaults to logger::log_info().

Value

NULL. This function is called for its side effects (writing plot files).

Details

For each species, the function:

  • Retrieves comparison data between simulation and observation.

  • Generates comparison plots.

  • Identifies deteriorated variables using a threshold percentage.

  • Optionally generates scatter plots if reference simulation data are available.

Scatter plots are only generated when both reference simulation data and deteriorated variables are available.

For each species:

  • Creates a species-specific output directory.

  • Generates comparison plots using gen_comparison_plot().

  • Identifies critical and warning variables using the given percentage.

  • Generates scatter plots using gen_scatter_plot() if reference data and deteriorated variables are available.

Examples

if (FALSE) { # \dontrun{
config <- make_config(
 output_dir = "results/",
 reference_workspace = "ref_dir/"
)
gen_plots(config)
} # }