diff --git a/modules/Visualization/R/plot_ensemble_mean.R b/modules/Visualization/R/plot_ensemble_mean.R index a753c23ae1a5a3b7134088ea7e9f30417e337848..c4e54d305df07cf9815e351b6ac414efda85b8f5 100644 --- a/modules/Visualization/R/plot_ensemble_mean.R +++ b/modules/Visualization/R/plot_ensemble_mean.R @@ -58,9 +58,16 @@ plot_ensemble_mean <- function(recipe, fcst, mask = NULL, dots = NULL, outdir, o cols <- c("#33BFD1", "white", "#FF764D") col_fun <- colorRampPalette(cols) } - brks <- pretty(range(var_ens_mean, na.rm = T), n = 15, min.n = 8) - cols <- col_fun(length(brks)-1) - + if (all(is.na(var_ens_mean))) { + brks <- NULL + } else { + brks <- pretty(range(var_ens_mean, na.rm = T), n = 15, min.n = 8) + } + if (is.null(brks)) { + cols <- NULL + } else { + cols <- col_fun(length(brks) - 1) + } } for (i_syear in start_date) { diff --git a/recipes/tests/recipe_seasonal_vizNA.yml b/recipes/tests/recipe_seasonal_vizNA.yml new file mode 100644 index 0000000000000000000000000000000000000000..fac86933b4046c1f49fe79d45917cb250fd6e507 --- /dev/null +++ b/recipes/tests/recipe_seasonal_vizNA.yml @@ -0,0 +1,85 @@ +################################################################################ +## RECIPE DESCRIPTION +################################################################################ + +Description: + Author: An-Chi Ho + Info: Test Visualization module to handle var is all NA + +################################################################################ +## ANALYSIS CONFIGURATION +################################################################################ + +Analysis: + Horizon: Seasonal + Variables: + name: tas + freq: monthly_mean + Datasets: + System: + name: [ECMWF-SEAS5] + Multimodel: no + Reference: + name: ERA5 + Time: + sdate: + - '1101' + fcst_year: '2020' + hcst_start: '2014' + hcst_end: '2016' + ftime_min: 1 + ftime_max: 2 + Region: + latmin: 0 + latmax: 3 + lonmin: 0 + lonmax: 2 + Regrid: + method: bilinear + type: 'r180x90' + Workflow: + Anomalies: + compute: no + cross_validation: no + save: 'none' + Calibration: + method: raw + save: 'none' + Skill: + metric: RPSS, CRPSS + save: 'none' + Probabilities: + percentiles: [[1/3, 2/3], [1/10, 9/10], [1/4, 2/4, 3/4]] + save: 'none' + Visualization: + plots: forecast_ensemble_mean + multi_panel: no + projection: cylindrical_equidistant + Indicators: + index: no + ncores: 8 + remove_NAs: yes + Output_format: S2S4E + +################################################################################ +## Run CONFIGURATION +################################################################################ +Run: + Loglevel: INFO + Terminal: yes + filesystem: esarchive + output_dir: /esarchive/scratch/aho/tmp/auto-s2s_outputs + code_dir: /esarchive/scratch/aho/git/auto-s2s/ + autosubmit: no + # fill only if using autosubmit + auto_conf: + script: /esarchive/scratch/vagudets/repos/auto-s2s/example_scripts/test_parallel_workflow.R + expid: # autosubmit experiment ID + hpc_user: bsc32762 # your hpc username + wallclock: 04:00 # hh:mm + processors_per_job: 8 # use ncores parameter? + platform: nord3v2 # make this constant? + email_notifications: yes # enable/disable email notifications + email_address: victoria.agudetse@bsc.es # email address for notifications + notify_completed: no # notify me by email when a job finishes + notify_failed: yes # notify me by email when a job fails