source("/esarchive/scratch/nperez/git/multiApply/R/zzz.R")

data <- list(array(rnorm(1000), c(5, 10, 20)), 
              array(rnorm(500), c(5, 10, 10)), 
              array(rnorm(50), c(5, 10)))
 test_fun <- function(x, y, z) {
   ((sum(x > z) / (length(x))) / 
   (sum(y > z) / (length(y)))) * 100
 }
test <- Apply(data, target = list(3, 3, NULL), test_fun)

mod <- seq(1, 2 * 3)
obs  <- seq(1, 2 * 3)
dim(mod) <- c(dataset = 2, member = 3)
dim(obs) <- c(dataset = 2, member = 3)
dimnames(mod)[[1]] <- c("MF", "UKMO")
dimnames(obs)[[1]] <- c("MF", "UKMO")

test.fun <- function(obs, mod) {return(obs == mod)}

outp <- Apply(data = list(obs = obs, mod = mod),
  target_dims = list(obs = c("member"), mod = c("member")),
  fun = test.fun) 
