Commit 9ef0bcf8 authored by Nicolau Manubens's avatar Nicolau Manubens
Browse files

Small bugfix in nc2a, solving crash when all dims in file are singleton and...

Small bugfix in nc2a, solving crash when all dims in file are singleton and expect_all_indices = TRUE.
parent 36e23cf3
......@@ -217,7 +217,12 @@ NcToArray <- function(file_to_read, dim_indices = NULL, vars_to_read = NULL,
names(dim(var_result)) <- names(indices_to_take)
# Drop extra dims
if (!is.null(extra_dims) && expect_all_indices) {
dim(var_result) <- dim(var_result)[-which(names(indices_to_take) %in% names(extra_dims))]
reduced_dims <- dim(var_result)[-which(names(indices_to_take) %in% names(extra_dims))]
if (length(reduced_dims) > 0) {
dim(var_result) <- reduced_dims
} else {
dim(var_result) <- NULL
}
}
# Reorder if needed
reorder_back <- NULL
......
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