###############################################################################
## Author: An-Chi Ho
## Description: Computes some skill metrics and plots scorecards with Autosubmit
## Instructions: Follow the steps described in: 
##               use_cases/ex1_2_autosubmit_scorecards/ex1_2-handson.md
##               This script should be called by bash script launch_SUNSET.sh.
###############################################################################

# Load modules
source("modules/Loading/Loading.R")
source("modules/Anomalies/Anomalies.R")
source("modules/Skill/Skill.R")
source("modules/Statistics/Statistics.R")
source("modules/Saving/Saving.R")

# Read recipe
args = commandArgs(trailingOnly = TRUE)
recipe_file <- args[1]
recipe <- read_atomic_recipe(recipe_file)

# Load data
data <- Loading(recipe)
# Compute tos anomalies
data <- Anomalies(recipe, data)
# Compute skill metrics
skill_metrics <- Skill(recipe, data)
# Compute statistics
statistics <- Statistics(recipe, data)
