diff --git a/modules/Visualization/R/plot_ensemble_mean.R b/modules/Visualization/R/plot_ensemble_mean.R index 5988186458fe9a469e86e1c73c887e684f107358..bada0a6e9ec87527a41dafb2d288680e32295fea 100644 --- a/modules/Visualization/R/plot_ensemble_mean.R +++ b/modules/Visualization/R/plot_ensemble_mean.R @@ -53,6 +53,8 @@ plot_ensemble_mean <- function(recipe, fcst, mask = NULL, dots = NULL, outdir, o palette = "RdBu" rev = T } + # Define NA color + colNA <- recipe$Analysis$Workflow$Visualization$NA_color # Define brks, centered around zero in the case of anomalies if (grepl("anomaly", var_long_name)) { variable <- paste(variable, "anomaly") @@ -138,6 +140,7 @@ plot_ensemble_mean <- function(recipe, fcst, mask = NULL, dots = NULL, outdir, o titles = titles, units = units, cols = cols, + colNA = colNA, brks = brks, fileout = paste0(outfile, ".pdf"), bar_label_digits = 4, diff --git a/modules/Visualization/R/plot_metrics.R b/modules/Visualization/R/plot_metrics.R index 92b707fa9da431075e906c9f8ba6e7941a2db235..5efaa45b876b0571c365658e492f0ed47362b98a 100644 --- a/modules/Visualization/R/plot_metrics.R +++ b/modules/Visualization/R/plot_metrics.R @@ -58,6 +58,8 @@ plot_metrics <- function(recipe, data_cube, metrics, diverging_palette <- "bluered" sequential_palette <- "Reds" } + # Define NA color + colNA <- recipe$Analysis$Workflow$Visualization$NA_color # Group different metrics by type skill_scores <- c("rpss", "bss90", "bss10", "frpss", "crpss", "mean_bias_ss", "enscorr", "rpss_specs", "bss90_specs", "bss10_specs", @@ -242,6 +244,7 @@ plot_metrics <- function(recipe, data_cube, metrics, title_scale = 0.6, filled.continents = F, brks = brks, cols = cols, col_inf = col_inf, col_sup = col_sup, + colNA = colNA, units = units, font.main = 2, bar_label_digits = 3, bar_label_scale = 1.5, axes_label_scale = 1, width = 8, height = 5) diff --git a/tools/check_recipe.R b/tools/check_recipe.R index 42cb832c0fd5be6d2f64bc630308f5a7ec3ce705..ce411a735d60b0e7e8a9a3bd2836cedf75406c19 100644 --- a/tools/check_recipe.R +++ b/tools/check_recipe.R @@ -612,6 +612,17 @@ check_recipe <- function(recipe) { paste0("Visualization:projection not specified for the plots, the ", "default projection is cylindrical equidistant.")) } + # Check NA color + if (is.null(recipe$Analysis$Workflow$Visualization$NA_color)) { + warn(recipe$Run$logger, + paste0("Visualization:NA_color not specified for the plots, the ", + "default color is pink.")) + recipe$Analysis$Workflow$Visualization$NA_color <- "pink" + } else if (!.IsColor(recipe$Analysis$Workflow$Visualization$NA_color)) { + error(recipe$Run$logger, + paste0("Visualization:NA_color value is not a valid color.")) + error_status <- TRUE + } ## TODO: Add significance? if ("most_likely_terciles" %in% plots) { if (is.null(recipe$Analysis$Workflow$Visualization$mask_terciles)) {