From e1f450685f1739842af785507b7c558d88511aab Mon Sep 17 00:00:00 2001 From: vagudets Date: Tue, 26 Mar 2024 09:38:45 +0100 Subject: [PATCH 1/8] Fix bug in merging of Dates attribute --- R/CST_MergeDims.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/CST_MergeDims.R b/R/CST_MergeDims.R index dabdc57f..6756ce79 100644 --- a/R/CST_MergeDims.R +++ b/R/CST_MergeDims.R @@ -53,7 +53,8 @@ CST_MergeDims <- function(data, merge_dims = c('ftime', 'monthly'), # attrs if (all(merge_dims %in% names(dim(data$attrs$Dates)))) { - dim(data$attrs$Dates) <- dim(data$data)[rename_dim] + data$attrs$Dates <- MergeDims(data$attrs$Dates, merge_dims = merge_dims, + rename_dim = rename_dim, na.rm = na.rm) } else if (any(merge_dims %in% names(dim(data$attrs$Dates)))) { warning("The dimensions of 'Dates' array will be different from ", "the temporal dimensions in 'data'. Parameter 'merge_dims' ", -- GitLab From 8068b4d9f6996dfb803ca79967fbcffb48cf7702 Mon Sep 17 00:00:00 2001 From: vagudets Date: Tue, 26 Mar 2024 09:38:56 +0100 Subject: [PATCH 2/8] Revert "Fix bug in merging of Dates attribute" This reverts commit e1f450685f1739842af785507b7c558d88511aab. --- R/CST_MergeDims.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/R/CST_MergeDims.R b/R/CST_MergeDims.R index 6756ce79..dabdc57f 100644 --- a/R/CST_MergeDims.R +++ b/R/CST_MergeDims.R @@ -53,8 +53,7 @@ CST_MergeDims <- function(data, merge_dims = c('ftime', 'monthly'), # attrs if (all(merge_dims %in% names(dim(data$attrs$Dates)))) { - data$attrs$Dates <- MergeDims(data$attrs$Dates, merge_dims = merge_dims, - rename_dim = rename_dim, na.rm = na.rm) + dim(data$attrs$Dates) <- dim(data$data)[rename_dim] } else if (any(merge_dims %in% names(dim(data$attrs$Dates)))) { warning("The dimensions of 'Dates' array will be different from ", "the temporal dimensions in 'data'. Parameter 'merge_dims' ", -- GitLab From 20d72dcce82df2f4167a5c1e9dd0c6e479529023 Mon Sep 17 00:00:00 2001 From: ARIADNA BATALLA FERRES Date: Mon, 15 Apr 2024 17:22:34 +0200 Subject: [PATCH 3/8] Namespace problem fix: CST_Start use startR functions without the explicit namespace --- R/CST_Start.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/R/CST_Start.R b/R/CST_Start.R index bc688557..3107afce 100644 --- a/R/CST_Start.R +++ b/R/CST_Start.R @@ -44,7 +44,11 @@ #'@import startR #'@export CST_Start <- function(...) { - res <- Start(...) + inputs <- as.list(substitute(list(...)))[-1] + for (i in 1:length(inputs)) { + inputs[[i]] <- eval(inputs[[i]]) + } + res <- do.call(Start, inputs) res <- as.s2dv_cube(res) return(res) -} \ No newline at end of file +} -- GitLab From 0eba41bdeeba804d00212f2043b48456ab717a8f Mon Sep 17 00:00:00 2001 From: ARIADNA BATALLA FERRES Date: Tue, 16 Apr 2024 17:14:38 +0200 Subject: [PATCH 4/8] Namespace problem fix: adapted documentation and added newline --- R/CST_Start.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/CST_Start.R b/R/CST_Start.R index 3107afce..4768a08e 100644 --- a/R/CST_Start.R +++ b/R/CST_Start.R @@ -9,10 +9,9 @@ #'`s2dv_cube` object. #' #'It receives any number of parameters (`...`) that are automatically forwarded -#'to the `startR::Start` function. See details in `?startR::Start`. The -#'auxiliary functions used to define dimensions need to be called within the -#'startR namespace (e.g. startR::indices(), startR::values(), startR::Sort(), -#'startR::CircularSort(), startR::CDORemapper(), ...). +#'to the `startR::Start` function. See details in `?startR::Start`. These +#'auxiliary functions (e.g. indices(), values(), Sort(), CircularSort(), +#'CDORemapper(), ...) are used to define dimensions. #' #'@param ... Parameters that are automatically forwarded to the `startR::Start` #' function. See details in `?startR::Start`. @@ -52,3 +51,4 @@ CST_Start <- function(...) { res <- as.s2dv_cube(res) return(res) } + -- GitLab From 82acb0bb9702e59ba5de4591736610cfd730f4c3 Mon Sep 17 00:00:00 2001 From: ARIADNA BATALLA FERRES Date: Wed, 17 Apr 2024 12:23:53 +0200 Subject: [PATCH 5/8] updated documentation and test to check if newline issue is resolved --- R/CST_Start.R | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/R/CST_Start.R b/R/CST_Start.R index 4768a08e..353f7f3e 100644 --- a/R/CST_Start.R +++ b/R/CST_Start.R @@ -9,9 +9,9 @@ #'`s2dv_cube` object. #' #'It receives any number of parameters (`...`) that are automatically forwarded -#'to the `startR::Start` function. See details in `?startR::Start`. These -#'auxiliary functions (e.g. indices(), values(), Sort(), CircularSort(), -#'CDORemapper(), ...) are used to define dimensions. +#'to the `startR::Start` function. See details in `?startR::Start`. The +#'auxiliary startR functions (e.g. indices(), values(), Sort(), CircularSort(), +#'CDORemapper(), ...) can be used to define dimensions. #' #'@param ... Parameters that are automatically forwarded to the `startR::Start` #' function. See details in `?startR::Start`. @@ -50,5 +50,6 @@ CST_Start <- function(...) { res <- do.call(Start, inputs) res <- as.s2dv_cube(res) return(res) +\n } - +\n -- GitLab From 9ba3a53b067c7a7f7d08a98b8c1a7ef9d9f8cec7 Mon Sep 17 00:00:00 2001 From: ARIADNA BATALLA FERRES Date: Wed, 17 Apr 2024 14:57:03 +0200 Subject: [PATCH 6/8] Updated CST_Start.R modified from main --- R/CST_Start.R | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/R/CST_Start.R b/R/CST_Start.R index bc688557..89271afd 100644 --- a/R/CST_Start.R +++ b/R/CST_Start.R @@ -10,9 +10,8 @@ #' #'It receives any number of parameters (`...`) that are automatically forwarded #'to the `startR::Start` function. See details in `?startR::Start`. The -#'auxiliary functions used to define dimensions need to be called within the -#'startR namespace (e.g. startR::indices(), startR::values(), startR::Sort(), -#'startR::CircularSort(), startR::CDORemapper(), ...). +#'auxiliary startR functions (e.g. indices(), values(), Sort(), CircularSort(), +#'CDORemapper(), ...) can be used to define dimensions. #' #'@param ... Parameters that are automatically forwarded to the `startR::Start` #' function. See details in `?startR::Start`. @@ -44,7 +43,11 @@ #'@import startR #'@export CST_Start <- function(...) { - res <- Start(...) + inputs <- as.list(substitute(list(...)))[-1] + for (i in 1:length(inputs)) { + inputs[[i]] <- eval(inputs[[i]]) + } + res <- do.call(Start, inputs) res <- as.s2dv_cube(res) return(res) -} \ No newline at end of file +} -- GitLab From eadc77d12939f74f00e25efce81b092ca646a3fb Mon Sep 17 00:00:00 2001 From: vagudets Date: Wed, 17 Apr 2024 16:07:50 +0200 Subject: [PATCH 7/8] Change end of file --- R/CST_Start.R | 1 - 1 file changed, 1 deletion(-) diff --git a/R/CST_Start.R b/R/CST_Start.R index 4b78ee0c..89271afd 100644 --- a/R/CST_Start.R +++ b/R/CST_Start.R @@ -51,4 +51,3 @@ CST_Start <- function(...) { res <- as.s2dv_cube(res) return(res) } - -- GitLab From 60e65a796c887685e4434b52fbb5a1a5e2843e8a Mon Sep 17 00:00:00 2001 From: vagudets Date: Wed, 17 Apr 2024 16:15:16 +0200 Subject: [PATCH 8/8] Copy and modify original function --- R/CST_Start.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/R/CST_Start.R b/R/CST_Start.R index 89271afd..73301388 100644 --- a/R/CST_Start.R +++ b/R/CST_Start.R @@ -9,10 +9,10 @@ #'`s2dv_cube` object. #' #'It receives any number of parameters (`...`) that are automatically forwarded -#'to the `startR::Start` function. See details in `?startR::Start`. The -#'auxiliary startR functions (e.g. indices(), values(), Sort(), CircularSort(), -#'CDORemapper(), ...) can be used to define dimensions. -#' +#'to the `startR::Start` function. See details in `?startR::Start`. These +#'auxiliary functions (e.g. indices(), values(), Sort(), CircularSort(), +#'CDORemapper(), ...) are used to define dimensions.#' +#' #'@param ... Parameters that are automatically forwarded to the `startR::Start` #' function. See details in `?startR::Start`. #'@examples @@ -47,7 +47,7 @@ CST_Start <- function(...) { for (i in 1:length(inputs)) { inputs[[i]] <- eval(inputs[[i]]) } - res <- do.call(Start, inputs) + res <- do.call(Start, inputs) res <- as.s2dv_cube(res) return(res) } -- GitLab