preprocess_datasets <- function(recipe, data) {
  # Remove 'var_dir' dimension
  for (element in names(data)) {
    if ("var_dir" %in% names(dim(data[[element]]))) {
      data[[element]] <- Subset(x = data[[element]],
                                along = c('var_dir'),
                                indices = list(1),
                                drop = 'selected')
    }
    if (!("sday" %in% names(dim(data[[element]])))) {
      dim(data[[element]]) <- c(dim(data[[element]]), sday = 1)
    }
    if (!("sweek" %in% names(dim(data[[element]])))) {
      dim(data[[element]]) <- c(dim(data[[element]]), sweek = 1)
    }
  }
  # Add 'ensemble' dimension to obs
  dim(data$obs) <- c(dim(data$obs), ensemble = 1)
  return(data)
}
