DownRToS2dv <- function(data_exp, data_obs) {
  library(abind)
  names(dim(tmin$Data)) <- attr(tmin$Data, 'dimensions')
  names(dim(tmin.obs$Data)) <- attr(tmin.obs$Data, 'dimensions')
  start_indices <- which(tmin$Dates$start %in% gsub("11-01", "12-01", tmin$InitializationDates))
  total_dates <- length(tmin$Dates$start)
  ftime_amounts <- c(start_indices, total_dates + 1)[2:(length(start_indices) + 1)] - start_indices
  largest_ftime <- max(ftime_amounts)
  # Reordering data
  new_tmin <- tmin$Data
  new_tmin.obs <- tmin.obs$Data
  new_dates <- tmin$Dates
  chunk_dims <- dim(tmin$Data)
  chunk_dims.obs <- dim(tmin.obs$Data)
  for (i in 1:length(ftime_amounts)) {
    ftime_amount <- ftime_amounts[i]
    if (ftime_amount < largest_ftime) {
      # Fill in exp array and dates
      step_new_tmin <- NULL
      step_new_dates_s <- NULL
      step_new_dates_e <- NULL
      #if (largest_ftime * (i - 1) + ftime_amount > 0) {
      step_new_tmin <- Subset(new_tmin, 'time', 1:(largest_ftime * (i - 1) + ftime_amount))
      step_new_dates_s <- new_dates$start[1:(largest_ftime * (i - 1) + ftime_amount)]
      step_new_dates_e <- new_dates$end[1:(largest_ftime * (i - 1) + ftime_amount)]
      #}
      chunk_dims['time'] <- largest_ftime - ftime_amount
      step_new_tmin <- abind(step_new_tmin, array(dim = chunk_dims), along = which(names(chunk_dims) == 'time'))
      names(dim(step_new_tmin)) <- names(chunk_dims)
      step_new_dates_s <- c(step_new_dates_s, rep(NA, chunk_dims['time']))
      step_new_dates_e <- c(step_new_dates_e, rep(NA, chunk_dims['time']))
      if (dim(new_tmin)[which(names(chunk_dims) == 'time')] > (largest_ftime * (i - 1) + ftime_amount)) {
        step_new_tmin <- abind(step_new_tmin, 
                               Subset(new_tmin, 'time', (largest_ftime * (i - 1) + ftime_amount + 1):
                                                        (dim(new_tmin)[which(names(chunk_dims) == 'time')])),
                               along = which(names(chunk_dims) == 'time'))
        names(dim(step_new_tmin)) <- names(chunk_dims)
        step_new_dates_s <- c(step_new_dates_s, 
                              new_dates$start[(largest_ftime * (i - 1) + ftime_amount + 1):
                                              (dim(new_tmin)[which(names(chunk_dims) == 'time')])]
                             )
        step_new_dates_e <- c(step_new_dates_e, 
                              new_dates$end[(largest_ftime * (i - 1) + ftime_amount + 1):
                                            (dim(new_tmin)[which(names(chunk_dims) == 'time')])]
                             )
      }
      new_dates <- list(start = step_new_dates_s,
                        end = step_new_dates_e)
      new_tmin <- step_new_tmin
      rm(step_new_tmin)
      rm(step_new_dates_s)
      rm(step_new_dates_e)
      gc()
      # Fill in obs array
      step_new_tmin <- NULL
      if (largest_ftime * (i - 1) + ftime_amount > 0) {
        step_new_tmin <- Subset(new_tmin.obs, 'time', 1:(largest_ftime * (i - 1) + ftime_amount))
      }
      chunk_dims.obs['time'] <- largest_ftime - ftime_amount
      step_new_tmin <- abind(step_new_tmin, array(dim = chunk_dims.obs), along = which(names(chunk_dims.obs) == 'time'))
      names(dim(step_new_tmin)) <- names(chunk_dims.obs)
      if (dim(new_tmin.obs)[which(names(chunk_dims.obs) == 'time')] > (largest_ftime * (i - 1) + ftime_amount)) {
        step_new_tmin <- abind(step_new_tmin, 
                               Subset(new_tmin.obs, 'time', (largest_ftime * (i - 1) + ftime_amount + 1):
                                                            (dim(new_tmin.obs)[which(names(chunk_dims.obs) == 'time')])),
                               along = which(names(chunk_dims.obs) == 'time'))
        names(dim(step_new_tmin)) <- names(chunk_dims.obs)
      }
      new_tmin.obs <- step_new_tmin
      rm(step_new_tmin)
      gc()
  #    new_dates$start <- c(head(new_dates$start, largest_ftime * (i - 1) + ftime_amount),
  #                         rep(NA, largest_ftime - ftime_amount),
  #                         new_dates$start[(largest_ftime * (i - 1) + ftime_amount + 1):
  #                                         (dim(new_tmin.obs)[which(names(chunk_dims.obs) == 'time')])]
  #                         )
  #    new_dates$end <- c(head(new_dates$end, largest_ftime * (i - 1) + ftime_amount),
  #                       rep(NA, largest_ftime - ftime_amount),
  #                       new_dates$end[(largest_ftime * (i - 1) + ftime_amount + 1):
  #                                       (dim(new_tmin.obs)[which(names(chunk_dims.obs) == 'time')])]
  ##                       tail(new_dates$end, length(new_dates$end) - (largest_ftime * (i - 1) + ftime_amount))
  #                       )
    }
  }
  # Defining exp new dims
  new_dims <- dim(tmin$Data)
  time_dim <- which(names(new_dims) == 'time')
  before_dims <- NULL
  if (time_dim > 1) {
    before_dims <- new_dims[1:(time_dim - 1)]
  }
  after_dims <- NULL
  if (time_dim < length(new_dims)) {
    after_dims <- new_dims[(time_dim + 1):length(new_dims)]
  }
  new_dims <- c(before_dims, largest_ftime, length(tmin$InitializationDates), after_dims)
  names(new_dims)[time_dim:(time_dim + 1)] <- c('ftime', 'sdate')
  new_dims <- c(c(dataset = 1), new_dims)
  dim(new_tmin) <- new_dims
  perm <- 1:length(new_dims)
  perm[c(time_dim, time_dim + 1) + 1] <- perm[c(time_dim + 1, time_dim) + 1]
  new_tmin <- aperm(new_tmin, perm)
  # Defining obs new dims
  new_dims['member'] <- 1
  # Defining date new dims
  dim(new_dates$start) <- dim(new_tmin)[c('ftime', 'sdate')]
  new_dates$start <- t(new_dates$start)
  names(dim(new_dates$start)) <- c('sdate', 'ftime')
  dim(new_dates$end) <- dim(new_tmin)[c('ftime', 'sdate')]
  new_dates$end <- t(new_dates$end)
  names(dim(new_dates$end)) <- c('sdate', 'ftime')
  dim(new_tmin.obs) <- new_dims
  new_tmin.obs <- aperm(new_tmin.obs, perm)
  # Casting output
  tmin.bk <- tmin
  tmin.obs.bk <- tmin.obs
  tmin <- list()
  tmin$mod <- new_tmin
  tmin$obs <- new_tmin.obs
  tmin$Dates <- new_dates
  tmin$lon <- tmin.bk$xyCoords$x
  tmin$lat <- tmin.bk$xyCoords$y
  tmin$InitializationDates <- tmin.bk$InitializationDates
  tmin$Variable <- tmin.bk$Variable
  tmin$Members <- tmin.bk$Members
  attributes(tmin) <- c(attributes(tmin), 
                        attributes(tmin.bk)[-which(names(attributes(tmin.bk)) %in% c('names', 'dataset'))])
  attributes(tmin.obs) <- c(attributes(tmin.obs), 
                            attributes(tmin.obs.bk)[-which(names(attributes(tmin.obs.bk)) %in% c('names', 'dataset'))])
  attr(tmin$mod, 'dataset') <- attr(tmin.bk, 'dataset')
  attr(tmin$obs, 'dataset') <- attr(tmin.obs.bk, 'dataset')

  tmin
}
