source("tools/libs.R")
## TODO: Remove with the next release
source("modules/Loading/load_datasets.R")

Loading <- function(recipe) {
  # Source correct function depending on time horizon
  ## TODO: Add condition for GRIB files
  time_horizon <- tolower(recipe$Analysis$Horizon)
  if (time_horizon == "seasonal") {
    source("modules/Loading/R/load_seasonal.R")
    data <- load_seasonal(recipe)
  } else if (time_horizon == "decadal") {
    source("modules/Loading/R/load_decadal.R")
    data <- load_decadal(recipe)
  } else {
    stop("Incorrect time horizon.")
  }
  return(data)
}
