# Load sample data as in Load() example:
example(Load)
clim <- Clim(sampleData$mod, sampleData$obs)
ano_exp <- Ano(sampleData$mod, clim$clim_exp)
ano_obs <- Ano(sampleData$obs, clim$clim_obs)
runmean_months <- 12
smooth_ano_exp <- Smoothing(data = ano_exp, runmeanlen = runmean_months)
smooth_ano_obs <- Smoothing(data = ano_obs, runmeanlen = runmean_months)
dim_to_mean <- 'member' # mean along members
required_complete_row <- 'ftime' # discard startdates for which there are NA leadtimes
leadtimes_per_startdate <- 60
corr <- Corr(MeanDims(smooth_ano_exp, dim_to_mean),
MeanDims(smooth_ano_obs, dim_to_mean),
comp_dim = required_complete_row, dat_dim = 'dataset',
limits = c(ceiling((runmean_months + 1) / 2),
leadtimes_per_startdate - floor(runmean_months / 2)))
# Combine corr results for plotting
corr_combine <- abind::abind(corr$conf.lower, corr$corr, corr$conf.upper, corr$p.val,
along = 0)
corr_combine <- Reorder(corr_combine, c(2, 3, 1, 4))
# \donttest{
PlotVsLTime(corr_combine, toptitle = "correlations", ytitle = "correlation",
monini = 11, limits = c(-1, 2), listexp = c('CMIP5 IC3'),
listobs = c('ERSST'), biglab = FALSE, hlines = c(-1, 0, 1))
# }
Run the code above in your browser using DataLab