S2dvToDownR <- function(data) {
  if (!is.null(data$Dates)) {
    dim_bk <- dim(data$Dates$start)
    new_dates_start <- strftime(data$Dates$start, usetz = TRUE)
    dim(new_dates_start) <- dim_bk
    new_dates_start <- aperm(new_dates_start, c(2, 1))
    dim(new_dates_start) <- c(time = prod(dim_bk))
    
    dim_bk <- dim(data$Dates$end)
    new_dates_end <- strftime(data$Dates$end, usetz = TRUE)
    dim(new_dates_end) <- dim_bk
    new_dates_end <- aperm(new_dates_end, c(2, 1))
    dim(new_dates_end) <- c(time = prod(dim_bk))
  }

  if (!is.null(data$mod)) {
    dim(data$Dates$start) <- dim(data$mod)[c('ftime', 'sdate')]
    dim(data$Dates$end) <- dim(data$mod)[c('ftime', 'sdate')]
  } else {
    dim(data$Dates$start) <- dim(data$obs)[c('ftime', 'sdate')]
    dim(data$Dates$end) <- dim(data$obs)[c('ftime', 'sdate')]
  }

  # Convert experimental data
  new_exp <- NULL
  if (!is.null(data$exp)) {
    new_data_exp <- aperm(data$mod, c(1, 2, 4, 3, 5, 6))
    new_exp_dims <- c(dim(data$mod)[2], 
                      time = prod(dim(data$mod)[3:4]), 
                      dim(data$mod)[5:6])
    dim(new_data_exp) <- new_exp_dims
    
    new_exp <- list(Variable = data$Variable,
                    Data = new_data_exp,
                    xyCoords = list(x = data$lon, 
                                    y = data$lat),
                    Dates = list(start = new_dates_start,
                                 end = new_dates_end),
                    InitializationDates = data$Datasets$exp[[1]][[1]],
                    Members = data$Datasets$exp[[1]][[2]])
    attr(new_exp$xyCoords, 'projection') <- attr(data$lon, 'projection')
    attr(new_exp, 'dataset') <- attr(data$Dataset$exp[[1]], 'dataset')
    attr(new_exp, 'source') <- attr(data$Dataset$exp[[1]], 'source')
    attr(new_exp, 'URL') <- attr(data$Dataset$exp[[1]], 'URL')
  }
  
  # Convert observational data
  new_obs <- NULL
  if (!is.null(data$obs)) {
    new_data_obs <- aperm(data$obs, c(1, 2, 4, 3, 5, 6))
    new_obs_dims <- c(time = prod(dim(data$obs)[3:4]),
                      dim(data$obs)[5:6])
    dim(new_data_obs) <- new_obs_dims
    
    new_obs <- list(Variable = data$Variable,
                    Data = new_data_obs,
                    xyCoords = list(x = data$lon,
                                    y = data$lat),
                    Dates = list(start = new_dates_start,
                                 end = new_dates_end))
    attr(new_obs$xyCoords, 'projection') <- attr(data$lon, 'projection')
    attr(new_obs, 'dataset') <- attr(data$Dataset$obs[[1]], 'dataset')
  }
  
  list(exp = new_exp, obs = new_obs)
}
