Hi @vagudets
This is the fix for the point 3 in #69 (comment 231091). When plotting forecast data, if all the data are NAs, brks and cols are numeric(0) and character(0), which are not accepted by PlotEquiMap() (user-unfriendly errors are returned). I simply added the if condition to make them be NULL in that situation. I needed to tune the fcst data to create this situation. And note that I sourced PlotEquiMap() and ColorBar() from s2dv master too.
Script:
source("modules/Loading/Loading.R")
source("modules/Calibration/Calibration.R")
source("modules/Anomalies/Anomalies.R")
source("modules/Skill/Skill.R")
source("modules/Saving/Saving.R")
source("modules/Visualization/Visualization.R")
# Source new ColorBar and PlotEquiMap
source("https://earth.bsc.es/gitlab/es/s2dv/-/raw/master/R/Utils.R")
source("https://earth.bsc.es/gitlab/es/s2dv/-/raw/master/R/PlotEquiMap.R")
source("https://earth.bsc.es/gitlab/es/s2dv/-/raw/master/R/ColorBar.R")
# Read recipe
recipe_file <- "recipes/tests/recipe_seasonal_vizNA.yml"
recipe <- prepare_outputs(recipe_file)
# Load datasets
data <- load_datasets(recipe)
# Tune fcst to have NAs
data$fcst$data[1,1,1,1,1,,,,26:51] <- NA
plot_data(recipe, data, significance = T)
INFO [2023-09-12 15:58:00] ##### SKILL METRIC PLOTS SAVED TO OUTPUT DIRECTORY #####
Warning messages:
1: ! Warning: All the data are NAs. The map will be filled with colNA.
2: ! Warning: All data are NAs. Color bar won't be drawn. If you want to have
!color bar still, define parameter 'brks' or 'bar_limits'.
3: ! Warning: All the data are NAs. The map will be filled with colNA.
4: ! Warning: All data are NAs. Color bar won't be drawn. If you want to have
!color bar still, define parameter 'brks' or 'bar_limits'.
Best,
An-Chi