library(startR)
ft <- 1  # For forecast year 1
sdates_new <- paste(seq(as.Date("1960/11/01"),as.Date("2018/12/01"), "months"),sep="-")
#sdates_new <- substr(sdates_new, 0,7)
sdates_ok <- gsub("-","",sdates_new)
sd_init <- seq(1+((ft-1)*12),698, by=12)
sd_fin <- seq(14+((ft-1)*12),698, by=12)
dates <- array(NA,c(54,14)) #dates: dim(sdates, ftime (in months))
for (i in 1:54) {
  dates[i,] <- sdates_ok[sd_init[i]:sd_fin[i]]
}


dates <- as.character(c(seq(as.Date("1960-11-01",format = "%Y-%m-%d"),
             as.Date("1970-10-30", format = "%Y-%m-%d"), "day"), 
             seq(as.Date("1961-11-01",format = "%Y-%m-%d"),
             as.Date("1971-10-30", format = "%Y-%m-%d"), "day")))
dim(dates) <- c(sdate = 2, day = 3651)

path <- '/esarchive/exp/ncar/lens/daily/$var$/$var$_$date$.nc'
data <- Start(dat = path,
             var = 'tasmax',
             member = 1:2,
             date = dates,
             time = values(dates),  #dim: [sdate = 4, time = 3]
             lat = 'first',
             lon = 'first',
             #time_across = 'date',
             merge_across_dims = TRUE,
             split_multiselected_dims = TRUE,
             synonims = list(#time = c('fday','time'),
                             lat = c('lat', 'latitude'),
                             lon = c('lon', 'longitude'),
                             member = c('ensemble','realization')),
             return_vars = list(lon = NULL,
                                lat = NULL,
                                time = NULL), #'sdate'),
             retrieve = FALSE)
