Skip to content

Daily data for visualisation

Hi @vagudets,

Expected Behavior

In a Sunset workflow, I want to use the visualization module to plot monthly data in a seasonal horizon. In my recipe, I download daily data and then convert it to monthly data using an indicator.

Current Behavior

When I run the visualization module, I get an error saying that visualization only works for monthly data, because the function reads the frequency from the recipe instead of the actual dataset.

Example:

> Visualization(recipe = recipe, data = HI_cal, 
+               skill_metrics = HI_metrics,
+               probabilities = HI_cal$probs,
+               significance = TRUE)
ERROR [2025-12-01 11:34:14] Visualization functions not yet implemented
          for daily data.
Error in plot_metrics(recipe = recipe, data_cube = data$hcst, metrics = skill_metrics,  : 
  

Possible Solutions?

Currently, I have to modify the recipe to use monthly data before running the visualization, which works. Is there a way to bypass this check? For example, in sunset/modules/Visualization/R/plot_most_likely_terciles_map.R, the check is:

if (recipe$Analysis$Variables$freq %in% c("daily", "daily_mean")) {
    stop("Visualization functions not yet implemented for daily data.")
  }

Could this check be modified to look directly at the dataset rather than the recipe?

Steps To Reproduce

  • Script:
recipe_file <- "/esarchive/scratch/abojaly/GitLab/sunset/dev_Indicator_HI/recipe_HI.yml"
recipe <- prepare_outputs(recipe_file)

# Load datasets
data_raw <- Loading(recipe)

# Change units
data_units <- Units(recipe, data_raw)

# Indicator
HI <- Indicators(recipe = recipe, data = data_units) #List of all indicators

# Calibration
HI_cal <- Crossval_calibration(recipe, HI)

# Skill Metrics
HI_metrics <- Crossval_metrics(recipe, HI_cal)

# Plot data
recipe$Analysis$Variables$freq <- 'monthly_mean'

Visualization(recipe = recipe, data = HI_cal, 
              skill_metrics = HI_metrics,
              probabilities = HI_cal$probs,
              significance = TRUE)
  • Branch/SUNSET Version: dev_HeatIndex

  • Environment: hub06

Edited by ALBERTO BOJALY CLUA