check_recipe <- function(recipe) {

  # recipe: yaml recipe already read it
  ## TODO: Adapt to decadal case

  info(recipe$Run$logger, paste("Checking recipe:", recipe$recipe_path))

  # ---------------------------------------------------------------------
  # ANALYSIS CHECKS
  # ---------------------------------------------------------------------

  TIME_SETTINGS_SEASONAL <- c("sdate", "ftime_min", "ftime_max", "hcst_start",
                              "hcst_end")
  TIME_SETTINGS_DECADAL <- c("ftime_min", "ftime_max", "hcst_start", "hcst_end") 
  PARAMS <- c("Horizon", "Time", "Variables", "Region", "Regrid", "Workflow",
              "Datasets")
  HORIZONS <- c("subseasonal", "seasonal", "decadal")
  ARCHIVE_SEASONAL <- "conf/archive.yml"
  ARCHIVE_DECADAL <- "conf/archive_decadal.yml"

  # Define error status variable
  error_status <- F

  # Check basic elements in recipe:Analysis:
  if (!("Analysis" %in% names(recipe))) {
    error(recipe$Run$logger,
          "The recipe must contain an element called 'Analysis'.")
    error_status <- T
  }

  if (!all(PARAMS %in% names(recipe$Analysis))) {
    error(recipe$Run$logger, 
          paste0("The element 'Analysis' in the recipe must contain all of ",
                 "the following: ", paste(PARAMS, collapse = ", "), "."))
    error_status <- T
  }

  if (!any(HORIZONS %in% tolower(recipe$Analysis$Horizon))) {
    error(recipe$Run$logger,
          paste0("The element 'Horizon' in the recipe must be one of the ",
                "following: ", paste(HORIZONS, collapse = ", "), "."))
    error_status <- T
  }
  # Check time settings
  if (tolower(recipe$Analysis$Horizon) == "seasonal") {
    ## TODO: Specify filesystem
    archive <- read_yaml(ARCHIVE_SEASONAL)[[recipe$Run$filesystem]]
    if (!all(TIME_SETTINGS_SEASONAL %in% names(recipe$Analysis$Time))) {
      error(recipe$Run$logger,
            paste0("The element 'Time' in the recipe must contain all of the ",
                   "following: ", paste(TIME_SETTINGS_SEASONAL,
                                        collapse = ", "), "."))
      error_status <- T
    }
  } else if (tolower(recipe$Analysis$Horizon) == "decadal") {
    archive <- read_yaml(ARCHIVE_DECADAL)[[recipe$Run$filesystem]]
    if (!all(TIME_SETTINGS_DECADAL %in% names(recipe$Analysis$Time))) {
      error(recipe$Run$logger,
            paste0("The element 'Time' in the recipe must contain all of the ",
                   "following: ", paste(TIME_SETTINGS_DECADAL,
                                        collapse = ", "), "."))
      error_status <- T
    }
  } else {
    archive <- NULL
  }
  # Check system names
  if (!is.null(archive)) {
    if (!all(recipe$Analysis$Datasets$System$name %in% names(archive$System))) {
      error(recipe$Run$logger,
            "The specified System name was not found in the archive.")
      error_status <- T
    }
    # Check reference names
    if (!all(recipe$Analysis$Datasets$Reference$name %in% 
        names(archive$Reference))) {
      error(recipe$Run$logger,
            "The specified Reference name was not found in the archive.")
      error_status <- T
    }
  }
  # Check ftime_min and ftime_max
  if ((!(recipe$Analysis$Time$ftime_min > 0)) ||
      (!is.integer(recipe$Analysis$Time$ftime_min))) {
    error(recipe$Run$logger,
          "The element 'ftime_min' must be an integer larger than 0.")
    error_status <- T
  }
  if ((!(recipe$Analysis$Time$ftime_max > 0)) ||
      (!is.integer(recipe$Analysis$Time$ftime_max))) {
    error(recipe$Run$logger,
          "The element 'ftime_max' must be an integer larger than 0.")
    error_status <- T
  }
  if (recipe$Analysis$Time$ftime_max < recipe$Analysis$Time$ftime_min) {
    error(recipe$Run$logger,
          "'ftime_max' cannot be smaller than 'ftime_min'.")
    error_status <- T
  }
  # Check consistency of hindcast years
  if (!(as.numeric(recipe$Analysis$Time$hcst_start) %% 1 == 0) ||
      (!(recipe$Analysis$Time$hcst_start > 0))) {
    error(recipe$Run$logger,
          "The element 'hcst_start' must be a valid year.")
    error_status <- T
  }
  if (!(as.numeric(recipe$Analysis$Time$hcst_end) %% 1 == 0) ||
      (!(recipe$Analysis$Time$hcst_end > 0))) {
    error(recipe$Run$logger,
          "The element 'hcst_end' must be a valid year.")
    error_status <- T
  }
  if (recipe$Analysis$Time$hcst_end < recipe$Analysis$Time$hcst_start) {
    error(recipe$Run$logger,
          "'hcst_end' cannot be smaller than 'hcst_start'.")
    error_status <- T
  }
  ## TODO: Is this needed?
  if (is.null(recipe$Analysis$Time$fcst_year) || 
      identical(tolower(recipe$Analysis$Time$fcst_year), 'none')) {
    stream <- "hindcast"
    # recipe$Analysis$Time$fcst_year <- 'YYYY'
  } else {
    stream <- "fcst"
  }

  ## TODO: To be implemented in the future
  # if (length(recipe$Analysis$Time$sdate$fcst_day) > 1 &&
  #     tolower(recipe$Analysis$Horizon) != "subseasonal") {
  #   warn(recipe$Run$logger,
  #        paste("Only subseasonal verification allows multiple forecast days."),
  #              "Element fcst_day in recipe set as 1.")
  #   recipe$Analysis$Time$sdate$fcst_day <- '01'
  # }
  ## TODO: Delete, this parameter was deprecated
  # if (is.null(recipe$Analysis$Time$sdate$fcst_sday)) {
  #   error(recipe$Run$logger,
  #         paste("The element 'fcst_sday' in the recipe should be defined."))
  # }

  if (is.null(recipe$Analysis$Time$fcst_year)) {
    warn(recipe$Run$logger,
         paste("The element 'fcst_year' is not defined in the recipe.",
               "No forecast year will be used."))
  }
  ## TODO: Adapt and move this inside 'if'? 
  # fcst.sdate <- NULL
  # for (syear in recipe$Analysis$Time$fcst_year) {
  #   for (sday in recipe$Analysis$Time$sdate) {
  #     fcst.sdate <- c(fcst.sdate, 
  #                     paste0(syear,
  #                            sprintf("%04d", as.numeric(sday))))
  #   }
  # }
  # fcst.sdate <- list(stream = stream, fcst.sdate = fcst.sdate)

  # Regrid checks:
  if (length(recipe$Analysis$Regrid) != 2) {
    error(recipe$Run$logger,
          "The 'Regrid' element must specify the 'method' and 'type'.")
    error_status <- T
  }
  # TODO: Add Workflow checks?
  # ...
  # calculate number of workflows to create for each variable and
  if (length(recipe$Analysis$Horizon) > 1) {
    error(recipe$Run$logger,
          "Only one single Horizon can be specified in the recipe")
    error_status <- T
  }

  ## TODO: Refine this
  # nvar <- length(recipe$Analysis$Variables)
  # if (nvar > 2) {
  #   error(recipe$Run$logger,
  #         "Only two type of Variables can be listed: ECVs and Indicators.")
  #   stop("EXECUTION FAILED")
  # }

  # remove NULL or None Indicators or ECVs from the recipe:
  if (!is.null(recipe$Analysis$Variables$Indicators) &&
      !is.list(recipe$Analysis$Variables$Indicators)) {
    recipe$Analysis$Variables <- recipe$Analysis$Variables[
           -which(names(recipe$Analysis$Variables) == 'Indicators')]
  }
  if (!is.null(recipe$Analysis$Variables$ECVs) &&
      !is.list(recipe$Analysis$Variables$ECVs)) {
    recipe$Analysis$Variables <- recipe$Analysis$Variables[
           -which(names(recipe$Analysis$Variables) == 'ECVs')]
  }

  # Region checks:
  LIMITS <- c('latmin', 'latmax', 'lonmin', 'lonmax')
  # Ordinary recipe
  if (is.null(names(recipe$Analysis$Region))) {
    for (region in recipe$Analysis$Region) {
      if (!all(LIMITS %in% names(region))) {
        error(recipe$Run$logger,
              paste0("There must be 4 elements in 'Region': ",
                   paste(LIMITS, collapse = ", "), "."))
        error_status <- T
      }
    }
    if (length(recipe$Analysis$Region) > 1) {
      for (region in recipe$Analysis$Region) {
        if (!("name" %in% names(region)) || (is.null(region$name))) {
          error(recipe$Run$logger,
                paste("If more than one region has been defined, every region",
                      "must have a unique name."))
        }
      }
    }
  # Atomic recipe
  } else if (!all(LIMITS %in% names(recipe$Analysis$Region))) {
    error(recipe$Run$logger,
          paste0("There must be 4 elements in 'Region': ",
                 paste(LIMITS, collapse = ", "), "."))
    error_status <- T
  }
    ## TODO: Implement multiple regions
    # nregions <- length(recipe$Analysis$Region)
    # for (i in 1:length(recipe$Analysis$Region)) {
    #   if (!all(limits %in% names(recipe$Analysis$Region[[i]]))) {
    #     limits <- paste(limits, collapse = " ")
    #     error(recipe$Run$logger,
    #           paste0("Each region defined in element 'Region' ",
    #                  "should have 4 elements: ",
    #                  paste(limits, collapse = ", "), "."))
    #     error_status <- T
    #   }
    #   if (length(recipe$Analysis$Region) > 1) {
    #     if (!("name" %in% names(recipe$Analysis$Region[[i]]))) {
    #       error(recipe$Run$logger,
    #             paste("If multiple regions are requested, each region must",
    #                   "have a 'name'".)
    #   # are numeric? class list mode list 
    # }
  # ---------------------------------------------------------------------
  # WORKFLOW CHECKS
  # ---------------------------------------------------------------------

  # Only one Calibration method allowed:
  if ((is.logical(recipe$Analysis$Workflow$Calibration$method) &&
       recipe$Analysis$Workflow$Calibration$method == FALSE) ||
      tolower(recipe$Analysis$Workflow$Calibration$method) == 'none' ||
      is.null(recipe$Analysis$Workflow$Calibration$method)) {
    warn(recipe$Run$logger,
         "No Calibration method was specified, raw data verification.")
    recipe$Analysis$Workflow$Calibration$method <- 'raw'
  } else {
    if (is.null(recipe$Analysis$Workflow$Calibration$method)) {
      error(recipe$Run$logger,
            "The 'Calibration' element 'method' must be specified.")
      error_status <- T
    }
    SAVING_OPTIONS_CALIB <- c("all", "none", "exp_only", "fcst_only")
    if ((is.null(recipe$Analysis$Workflow$Calibration$save)) ||
        (!(recipe$Analysis$Workflow$Calibration$save %in% SAVING_OPTIONS_CALIB))) {
      error(recipe$Run$logger,
            paste0("Please specify which Calibration module outputs you want ",
                   "to save with the 'save' parameter. The options are: ",
                   paste(SAVING_OPTIONS_CALIB, collapse = ", "), "."))
      error_status <- T
    }
  }
  # Anomalies
  if ("Anomalies" %in% names(recipe$Analysis$Workflow)) {
    # Computation and cross-validation checks
    if (is.null(recipe$Analysis$Workflow$Anomalies$compute)) {
      error(recipe$Run$logger,
            "Parameter 'compute' must be defined under 'Anomalies'.")
      error_status <- T
    } else if (!(is.logical(recipe$Analysis$Workflow$Anomalies$compute))) {
      error(recipe$Run$logger,
            paste("Parameter 'Anomalies:compute' must be a logical value",
                  "(True/False or yes/no)."))
      error_status <- T
    } else if ((recipe$Analysis$Workflow$Anomalies$compute)) {
      # Cross-validation check
      if (!is.logical(recipe$Analysis$Workflow$Anomalies$cross_validation)) {
        error(recipe$Run$logger,
              paste("If anomaly computation is requested, parameter",
                    "'cross_validation' must be defined under 'Anomalies',
                    and it must be a logical value (True/False or yes/no)."))
        error_status <- T
      }
      # Saving checks
      SAVING_OPTIONS_ANOM <- c("all", "none", "exp_only", "fcst_only")
      if ((is.null(recipe$Analysis$Workflow$Anomalies$save)) ||
          (!(recipe$Analysis$Workflow$Anomalies$save %in% SAVING_OPTIONS_ANOM))) {
        error(recipe$Run$logger,
              paste0("Please specify which Anomalies module outputs you want ",
                     "to save with the 'save' parameter. The options are: ",
                     paste(SAVING_OPTIONS_ANOM, collapse = ", "), "."))
        error_status <- T
      }
    }
  }
  # Indices
  if ("Indices" %in% names(recipe$Analysis$Workflow)) {
    nino_indices <- paste0("nino", c("1+2", "3", "3.4", "4"))
    indices <- c("nao", nino_indices)
    if (!("anomalies" %in% tolower(names(recipe$Analysis$Workflow)))) {
      error(recipe$Run$logger,
            paste0("Indices uses Anomalies as input, but Anomalies are missing",
                   "in the recipe."))
      error_status <- T
    } else if (!(recipe$Analysis$Workflow$Anomalies$compute)) {
        error(recipe$Run$logger,
              paste0("Indices uses Anomalies as input, but the parameter",
                     "'Anomalies:compute' is set as no/False."))
      error_status <- T
    }
    recipe_indices <- tolower(names(recipe$Analysis$Workflow$Indices))
    if (!all(recipe_indices %in% indices)) {
      error(recipe$Run$logger,
            paste0("Some of the indices under 'Indices' are not available.",
                   "The available Indices are: 'NAO', 'Nino1+2', 'Nino3', ",
                   "'Nino3.4' and 'Nino4'."))
      error_status <- T
    }
    # Check that variables correspond with indices requested
    recipe_variables <- strsplit(recipe$Analysis$Variables$name, ", | |,")[[1]]
    if (("nao" %in% recipe_indices) &&
        (!all(recipe_variables %in% c("psl", "z500")))) {
      error(recipe$Run$logger,
            paste0("It is not possible to compute the NAO with some of the ",
                   "variables requested. To compute the NAO, please make sure",
                   "your recipe requests only psl and/or z500."))
      error_status <- T
    }
    if ((any(nino_indices %in% recipe_indices)) &&
        (!all(recipe_variables %in% c("tos", "sst")))) {
      error(recipe$Run$logger,
            paste0("It is not possible to compute El Nino indices with some ",
                   "of the variables requested. To compute El Nino, please ",
                   "make sure your recipe requests only tos."))
      error_status <- T
    }
  }

  # Skill
  AVAILABLE_METRICS <- c("enscorr", "corr", "rps", "rpss", "frps", "frpss",
                         "crps", "crpss", "bss10", "bss90", "mean_bias",
                         "mean_bias_ss", "enssprerr", "rps_clim", "rpss_clim",
                         "enscorr_specs", "frps_specs", "rpss_specs", 
                         "frpss_specs", "bss10_specs", "bss90_specs")
  if ("Skill" %in% names(recipe$Analysis$Workflow)) {
    if (is.null(recipe$Analysis$Workflow$Skill$metric)) {
    error(recipe$Run$logger,
          "Parameter 'metric' must be defined under 'Skill'.")
    error_status <- T
    } else {
      requested_metrics <- strsplit(recipe$Analysis$Workflow$Skill$metric, 
                                    ", | |,")[[1]]
      if (!all(tolower(requested_metrics) %in% AVAILABLE_METRICS)) {
        error(recipe$Run$logger,
              paste0("Some of the metrics requested under 'Skill' are not ",
                     "available in SUNSET. Check the documentation to see the ",
                     "full list of accepted skill metrics."))
        error_status <- T
      }
    }
    # Saving checks
    SAVING_OPTIONS_SKILL <- c("all", "none")
    if ((is.null(recipe$Analysis$Workflow$Skill$save)) ||
        (!(recipe$Analysis$Workflow$Skill$save %in% SAVING_OPTIONS_SKILL))) {
      error(recipe$Run$logger,
            paste0("Please specify whether you want to save the Skill metrics ",
                   "with the 'save' parameter. The options are: ",
                   paste(SAVING_OPTIONS_SKILL, collapse = ", "), "."))
      error_status <- T
    }
  }
  # Probabilities
  if ("Probabilities" %in% names(recipe$Analysis$Workflow)) {
    if (is.null(recipe$Analysis$Workflow$Probabilities$percentiles)) {
      error(recipe$Run$logger,
            "Parameter 'percentiles' must be defined under 'Probabilities'.")
      error_status <- T
    } else if (!is.list(recipe$Analysis$Workflow$Probabilities$percentiles)) {
      error(recipe$Run$logger,
            paste("Parameter 'Probabilities:percentiles' expects a list.",
                  "See documentation in the wiki for examples."))
      error_status <- T
    }
    # Saving checks
    SAVING_OPTIONS_PROBS <- c("all", "none", "bins_only", "percentiles_only")
    if ((is.null(recipe$Analysis$Workflow$Probabilities$save)) ||
        (!(recipe$Analysis$Workflow$Probabilities$save %in% SAVING_OPTIONS_PROBS))) {
      error(recipe$Run$logger,
            paste0("Please specify whether you want to save the percentiles ",
                   "and probability bins with the 'save' parameter. The ",
                   "options are: ",
                   paste(SAVING_OPTIONS_PROBS, collapse = ", "), "."))
      error_status <- T
    }
  }
  # Visualization
  if ("Visualization" %in% names(recipe$Analysis$Workflow)) {
    PLOT_OPTIONS <- c("skill_metrics", "forecast_ensemble_mean",
                      "most_likely_terciles")
    # Separate plots parameter and check if all elements are in PLOT_OPTIONS
    if (is.null(recipe$Analysis$Workflow$Visualization$plots)) {
      error(recipe$Run$logger,
            "The 'plots' element must be defined under 'Visualization'.")
      error_status <- T
    } else {
      plots <- strsplit(recipe$Analysis$Workflow$Visualization$plots,
                        ", | |,")[[1]]
      if (!all(plots %in% PLOT_OPTIONS)) {
        error(recipe$Run$logger,
              paste0("The options available for the plots are: ",
                     paste(PLOT_OPTIONS, collapse = ", "), "."))
        error_status <- T
      }
    }
    # Check multi_panel option
    ## TODO: Multi-panel
    if (is.null(recipe$Analysis$Workflow$Visualization$multi_panel)) {
      warn(recipe$Run$logger,
           paste0("Visualization:multi_panel not specified for the plots, the",
                  " default is 'no/False'."))
    } else if (!is.logical(recipe$Analysis$Workflow$Visualization$multi_panel)) {
      error(recipe$Run$logger,
            paste0("Parameter 'Visualization:multi_panel' must be a logical ",
                   "value: either 'yes/True' or 'no/False'"))
      error_status <- T
    }
    # Check projection
    if (is.null(recipe$Analysis$Workflow$Visualization$projection)) {
      warn(recipe$Run$logger,
           paste0("Visualization:projection not specified for the plots, the ",
                  "default projection is cylindrical equidistant."))
    }
    ## TODO: Add significance?
    if ("most_likely_terciles" %in% plots) {
      if (is.null(recipe$Analysis$Workflow$Visualization$mask_terciles)) {
        warn(recipe$Run$logger,
             paste0("Visualization:mask_terciles not set for tercile plots,",
                    " the default setting is: 'no/False'."))
      } else if (!(recipe$Analysis$Workflow$Visualization$mask_terciles %in%
                   c(TRUE, FALSE, "both"))) {
        error(recipe$Run$logger,
              paste0("Parameter Visualization:mask_terciles must be one of: ",
                     "yes/True, no/False, 'both'"))
        error_status <- T
      }
      if (is.null(recipe$Analysis$Workflow$Visualization$dots)) {
        warn(recipe$Run$logger,
             paste0("Visualization:dots not set for tercile plots, the default",
                    " setting is: 'no/False'."))
      } else if (!(recipe$Analysis$Workflow$Visualization$dots %in%
                   c(TRUE, FALSE, "both"))) {
        error(recipe$Run$logger,
              paste0("Parameter Visualization:plots must be one of: ",
                     "yes/True, no/False, 'both'"))
      }
    }
  }
  # Scorecards
  if ("Scorecards" %in% names(recipe$Analysis$Workflow)) {
    if (is.null(recipe$Analysis$Workflow$Scorecards$metric)) {
    error(recipe$Run$logger,
          "Parameter 'metric' must be defined under 'Scorecards'.")
    error_status <- T
    } else {
      sc_metrics <- strsplit(recipe$Analysis$Workflow$Scorecards$metric, 
                             ", | |,")[[1]]
      if (!all(tolower(sc_metrics) %in% tolower(requested_metrics))) {
        error(recipe$Run$logger,
              paste0("All of the metrics requested under 'Scorecards' must ",
                     "be requested in the 'Skill' section."))
        error_status <- T
      }
    }
  }
  # ---------------------------------------------------------------------
  # RUN CHECKS
  # ---------------------------------------------------------------------

  RUN_FIELDS = c("Loglevel", "Terminal", "output_dir", "code_dir")
  LOG_LEVELS = c("INFO", "DEBUG", "WARN", "ERROR", "FATAL")

  if (!("Run" %in% names(recipe))) {
    stop("The recipe must contain an element named 'Run'.")
  }
  if (!all(RUN_FIELDS %in% names(recipe$Run))) {
    error(recipe$Run$logger, paste("Recipe element 'Run' must contain",
                                   "all of the following fields:",
                                   paste(RUN_FIELDS, collapse=", "), "."))
    error_status <- T
  }
  if (!is.character(recipe$Run$output_dir)) {
    error(recipe$Run$logger,
          paste("The Run element 'output_dir' in", recipe$name, "file",
                "should be a character string indicating the path where",
                "the outputs should be saved."))
    error_status <- T
  }
  if (!is.character(recipe$Run$code_dir)) {
    error(recipe$Run$logger,
          paste("The Run element 'code_dir' in", recipe$name, "file ",
                "should be a character string indicating the path",
                "where the code is."))
    error_status <- T
  }
  if (!is.logical(recipe$Run$Terminal)) {
    error(recipe$Run$logger,
          paste("The Run element 'Terminal' in", recipe$name, "file ",
                "should be a boolean value indicating whether or not to",
                "print the logs in the terminal."))
    error_status <- T
  }
  ## TODO: Review this case, since default value is allowed
  if (!is.character(recipe$Run$Loglevel) || 
      !any(recipe$Run$Loglevel %in% LOG_LEVELS)) {
    error(logger,
          paste("The Run element 'Loglevel' in", recipe$name, "file",
                "should be a character string specifying one of the levels available:",
                paste0(LOG_LEVELS, collapse='/')))
    error_status <- T
  }

  # ---------------------------------------------------------------------
  # AUTOSUBMIT CHECKS
  # ---------------------------------------------------------------------

  AUTO_PARAMS <- c("script", "expid", "hpc_user", "wallclock",
                   "processors_per_job", "platform", "email_notifications",
                   "email_address", "notify_completed", "notify_failed")
  # Autosubmit false by default
  if (is.null(recipe$Run$autosubmit)) {
    recipe$Run$autosubmit <- F
  }
  # Autosubmit configuration checks
  if (recipe$Run$autosubmit) {
    # Read autosubmit info for the specific filesystem (e.g. esarchive)
    auto_specs <- read_yaml("conf/autosubmit.yml")[[recipe$Run$filesystem]]
    # Check that the autosubmit configuration parameters are present
    if (!("auto_conf" %in% names(recipe$Run))) {
      error(recipe$Run$logger,
            "The 'auto_conf' is missing from the 'Run' section of the recipe.")
      error_status <- T
    } else if (!all(AUTO_PARAMS %in% names(recipe$Run$auto_conf))) {
      error(recipe$Run$logger,
            paste0("The element 'Run:auto_conf' must contain all of the ",
                   "following: ", paste(AUTO_PARAMS, collapse = ", "), "."))
      error_status <- T
    }
    # Check that the script is not NULL and exists
    if (is.null(recipe$Run$auto_conf$script)) {
      error(recipe$Run$logger,
            "A script must be provided to run the recipe with autosubmit.")
      error_status <- T
    } else if (!file.exists(recipe$Run$auto_conf$script)) {
      error(recipe$Run$logger,
            "Could not find the file for the script in 'auto_conf'.")
      error_status <- T
    }
    # Check that the experiment ID exists
    if (is.null(recipe$Run$auto_conf$expid)) {
      error(recipe$Run$logger,
            paste("The Autosubmit EXPID is missing. You can create one by",
                  "running the following commands on the autosubmit machine:"))
      error(recipe$Run$logger,
            paste("module load", auto_specs$module_version))
      error(recipe$Run$logger,
            paste("autosubmit expid -H", auto_specs$platform,
                  "-d <Description>"))
    } else if (!dir.exists(paste0(auto_specs$experiment_dir,
                                  recipe$Run$auto_conf$expid))) {
      error(recipe$Run$logger,
            paste0("No folder in ", auto_specs$experiment_dir,
                   " for the EXPID", recipe$Run$auto_conf$expid,
                   ". Please make sure it is correct."))
    }
    if ((recipe$Run$auto_conf$email_notifications) &&
        (is.null(recipe$Run$auto_conf$email_address))) {
      error(recipe$Run$logger,
            "Autosubmit notifications are enabled but email address is empty!")
    }
    if (is.null(recipe$Run$auto_conf$hpc_user)) {
      error(recipe$Run$logger,
            "The 'Run:auto_conf:hpc_user' field can not be empty.")
    } else if ((recipe$Run$filesystem == "esarchive") &&
               (!substr(recipe$Run$auto_conf$hpc_user, 1, 5) == "bsc32")) {
      error(recipe$Run$logger,
            "Please check your hpc_user ID. It should look like: 'bsc32xxx'")
    }
  }

  # ---------------------------------------------------------------------
  # WORKFLOW CHECKS
  # ---------------------------------------------------------------------
  # Check workflow: need to define restrictions? 
  # e.g. only one calibration method
  ## TODO: Implement number of dependent verifications
  #nverifications <- check_number_of_dependent_verifications(recipe)
  # info(recipe$Run$logger, paste("Start Dates:",
  #                               paste(fcst.sdate, collapse = " ")))

  # Return error if any check has failed
  if (error_status) {
    error(recipe$Run$logger, "RECIPE CHECK FAILED.")
    stop("The recipe contains some errors. Find the full list in the",
         " startup.log file.")
  } else {
    info(recipe$Run$logger, "##### RECIPE CHECK SUCCESSFULL #####")
  }
}
