From 877ed246bf4b05007b3fea5d840c0c788758f1dd Mon Sep 17 00:00:00 2001 From: aho Date: Mon, 22 Nov 2021 19:30:23 +0100 Subject: [PATCH 1/2] Return error if chunk over an inner dim that crosses a file dim. --- R/Start.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/R/Start.R b/R/Start.R index 56e9491..09ae2ab 100644 --- a/R/Start.R +++ b/R/Start.R @@ -3056,6 +3056,13 @@ Start <- function(..., # dim = indices/selectors, print("-> THE INNER DIMENSION GOES ACROSS A FILE DIMENSION.") } } + # If "_across = + merge_across_dims = FALSE + chunk over ", return error because this instance is not logically correct. + if (chunks[[inner_dim]]["n_chunks"] > 1 & inner_dim %in% inner_dims_across_files) { + stop("Chunk over dimension '", inner_dim, "' is not allowed because '", + inner_dim, "' is across '", + names(inner_dims_across_files)[which(inner_dim %in% inner_dims_across_files)], "'.") + } + if (inner_dim %in% names(dim(sub_array_of_selectors))) { if (is.null(var_with_selectors_name)) { if (any(na.omit(unlist(sub_array_of_selectors)) < 1) || -- GitLab From c514ea191ddb41ed86ff350fe0ee14ee9b1706b7 Mon Sep 17 00:00:00 2001 From: aho Date: Wed, 24 Nov 2021 15:13:48 +0100 Subject: [PATCH 2/2] Add comments --- R/Start.R | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/R/Start.R b/R/Start.R index 09ae2ab..ba01959 100644 --- a/R/Start.R +++ b/R/Start.R @@ -2538,7 +2538,9 @@ Start <- function(..., # dim = indices/selectors, print(file_dim) } } - #???????????????? + + # The inner dim selector is an array in which have file dim (e.g., time = [sdate = 2, time = 4], + # or the inner dim doesn't go across any file dim (e.g., no time_across = 'sdate') if ((!is.null(file_dim) && (file_dim %in% names(selector_file_dims))) || is.null(file_dim)) { if (length(sub_array_of_selectors) > 0) { if (debug) { @@ -3050,7 +3052,8 @@ Start <- function(..., # dim = indices/selectors, taken_chunks <- TRUE } } - } else { #???????????? + } else { + # The inner dim goes across a file dim (e.g., time_across = 'sdate') if (debug) { if (inner_dim %in% dims_to_check) { print("-> THE INNER DIMENSION GOES ACROSS A FILE DIMENSION.") -- GitLab