###############################################################################
## Author: An-Chi Ho
## Description: Script to test developments for decadal workflows. Please,
##              do not modify.
###############################################################################

source("modules/Loading/Loading.R")
source("modules/Calibration/Calibration.R")
source("modules/Skill/Skill.R")
source("modules/Saving/Saving.R")
source("modules/Visualization/Visualization.R")
source("modules/Aggregation/Aggregation.R")
recipe_file <- "recipes/atomic_recipes/recipe_decadal.yml"
recipe <- prepare_outputs(recipe_file)
# archive <- read_yaml(paste0(recipe$Run$code_dir, "conf/archive_decadal.yml"))$archive

# Load datasets
data <- Loading(recipe)

data <- Aggregation(recipe = recipe, data = data)
# Calibrate datasets
calibrated_data <- Calibration(recipe, data)

# Compute skill metrics
skill_metrics <- Skill(recipe, data)

# Compute percentiles and probability bins
probabilities <- Probabilities(recipe, data)

# Plot data
Visualization(recipe = recipe, data = data,
              skill_metrics = skill_metrics,
              probabilities = probabilities,
	      significance = T)

