# AnoAgree examples:
library(multiApply)

AnoAgree() 
AnoAgree(ano = NULL)
AnoAgree(ano = 0)
AnoAgree(ano = 0, membersdim = 1)
AnoAgree(ano = 1:10)
AnoAgree(ano = 1:10, membersdim = 1)
AnoAgree(ano = 1:10, membersdim = 0)
AnoAgree(ano = 1:10, membersdim = 2)
AnoAgree(ano = 1:10, membersdim = 3)
AnoAgree(ano = 1:10, membersdim = 'mod')
AnoAgree(ano = 1:10, membersdim = NULL)
AnoAgree(ano = 1:10, membersdim = 1, na.rm = TRUE)
AnoAgree(ano = 1:10, membersdim = 1, na.rm = FALSE)
AnoAgree(ano = 1:10, membersdim = 1, na.rm = 1)
AnoAgree(ano = 1:10, membersdim = 1, na.rm = 'mod')
a <- 1:10
a[4] = NA
AnoAgree(ano = a, membersdim = 1, na.rm = FALSE)
AnoAgree(ano = a, membersdim = 1, na.rm = TRUE)
dim(a) <- c(2,5)
AnoAgree(ano = a, membersdim = 1, na.rm = FALSE)
AnoAgree(ano = a, membersdim = 1, na.rm = TRUE)
a <- NULL
for(i in 1:4) { a <- c(a, rnorm(6)) }
dim(a) <- c(lat = 2, lon = 3, var = 4)
AnoAgree(ano = a, membersdim = 1, na.rm = FALSE)
AnoAgree(ano = a, membersdim = 1, na.rm = TRUE)
a[1,2,3] <- NA
AnoAgree(ano = a, membersdim = 1, na.rm = FALSE)
AnoAgree(ano = a, membersdim = 1, na.rm = TRUE)
AnoAgree(ano = a, membersdim = 1, na.rm = FALSE, ncores = 1)
AnoAgree(ano = a, membersdim = 1, na.rm = FALSE, ncores = 2)
AnoAgree(ano = a, membersdim = 1, na.rm = FALSE, ncores = TRUE)
AnoAgree(ano = a, membersdim = 1, na.rm = FALSE, ncores = 1.4)
AnoAgree(ano = a, membersdim = 1, na.rm = FALSE, ncores = "as")
AnoAgree(ano = a, membersdim = 1, na.rm = FALSE, ncores = 0)
AnoAgree(ano = a, membersdim = 1, na.rm = FALSE, ncores = -2)

a <- NULL
for(i in 1:20) { a <- c(a, rnorm(6)) }
dim(a) <- c(lat = 2, lon = 3, var = 4, mod = 5)

agree <- AnoAgree(ano = a, membersdim = which(names(dim(a)) == 'mod'), na.rm = TRUE)
print(agree)

a <- rnorm(6)
agree <- AnoAgree(ano = a, membersdim = 1)
print(agree)

