Commit ed90d01e authored by Nicolau Manubens Gil's avatar Nicolau Manubens Gil
Browse files

Merge branch 'develop-bugfixes-2.1.0' into 'master'

Develop bugfixes 2.1.0

See merge request !16
parents 79bb9d6b 2b7a338e
Pipeline #940 canceled with stage
......@@ -506,7 +506,7 @@ Apply <- function(data, target_dims = NULL, fun, ...,
chunk_sizes <- c(chunk_sizes, total_size %% chunk_size)
}
fun_env <- new.env()
fun_env <- new.env(parent = parent.frame())
for (i in seq_along(extra_info)) {
assign(names(extra_info)[i], extra_info[[i]], envir = fun_env)
}
......
......@@ -1357,6 +1357,22 @@ test_that("Dimension names are propagated correctly.", {
f)
})
# Test nested environments are linked properly
test_that("Nested environments are linked properly.", {
#create input
forecast <- array(dim = c('31', '12', '4'),
rnorm(31 * 12 * 4))
names(dim(forecast)) <- c('sday', 'syear', 'ensemble')
anomaly_simple <- function(data) {
avg <- Apply(data, c('syear', 'ensemble'), mean)[[1]]
anom <- Apply(data, c('sday'), function(x) x - avg)[[1]]
return(anom)
}
anomaly <- anomaly_simple(forecast)
})
# TODOS:
# TESTS FOR MARGINS
# TESTS FOR DISORDERED TARGET_DIMS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment