Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • SUNSET SUNSET
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 42
    • Issues 42
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Terraform modules
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Earth SciencesEarth Sciences
  • SUNSETSUNSET
  • Merge requests
  • !86

Make brks and cols be NULLif all data are NAs

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged aho requested to merge dev-Visualization_brksNA into master Sep 12, 2023
  • Overview 2
  • Commits 2
  • Pipelines 0
  • Changes 2

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.

Recipe: https://earth.bsc.es/gitlab/es/sunset/-/blob/dev-Visualization_brksNA/recipes/tests/recipe_seasonal_vizNA.yml?ref_type=heads

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

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: dev-Visualization_brksNA