From 20ad5bc298512dc122cfe84930b15c534c6b9dbe Mon Sep 17 00:00:00 2001 From: allabres Date: Fri, 23 Aug 2024 14:48:44 +0200 Subject: [PATCH 1/4] solved issue dates parameter --- R/PeriodStandardization.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/PeriodStandardization.R b/R/PeriodStandardization.R index 6ab707e..93a77dd 100644 --- a/R/PeriodStandardization.R +++ b/R/PeriodStandardization.R @@ -108,6 +108,7 @@ CST_PeriodStandardization <- function(data, data_cor = NULL, time_dim = 'syear', } } res <- PeriodStandardization(data = data$data, data_cor = data_cor$data, + dates = data$attrs$Dates, time_dim = time_dim, leadtime_dim = leadtime_dim, memb_dim = memb_dim, ref_period = ref_period, -- GitLab From 743dae5c85d8651471f5044012941ce53c3ccf40 Mon Sep 17 00:00:00 2001 From: ARIADNA BATALLA FERRES Date: Fri, 30 Aug 2024 13:01:02 +0200 Subject: [PATCH 2/4] Fix grammatical errors in documentation and warning --- R/PeriodStandardization.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/R/PeriodStandardization.R b/R/PeriodStandardization.R index 93a77dd..b71270f 100644 --- a/R/PeriodStandardization.R +++ b/R/PeriodStandardization.R @@ -12,12 +12,12 @@ #'coordinates and therefore, the result will be filled with NA for the #'specific coordinates. When NAs are not removed, if the length of the data for #'a computational step is smaller than 4, there will not be enough data for -#'standarize and the result will be also filled with NAs for that coordinates. +#'standardization and the result will be also filled with NAs for those coordinates. #'About the distribution used to fit the data, there are only two possibilities: -#''log-logistic' and 'Gamma'. The 'Gamma' method only works when only -#'precipitation is provided and other variables are 0 because it is positive +#''log-logistic' and 'Gamma'. The 'Gamma' method works only when precipitation +#'is the sole variable provided, and all other variables are 0 because it is positive #'defined (SPI indicator). When only 'data' is provided ('data_cor' is NULL) the -#'standardization is computed with cross validation. This function is build to +#'standardization is computed with cross validation. This function is built to #'be compatible with other tools in that work with 's2dv_cube' object #'class. The input data must be this object class. If you don't work with #''s2dv_cube', see PeriodStandardization. For more information on the SPEI @@ -338,7 +338,7 @@ PeriodStandardization <- function(data, data_cor = NULL, dates = NULL, "will not be used.") ref_period <- NULL } else if (!all(unlist(ref_period) %in% years_dates)) { - warning("Parameter 'ref_period' contain years outside the dates. ", + warning("Parameter 'ref_period' contains years outside the dates. ", "It will not be used.") ref_period <- NULL } else { -- GitLab From 939eba075bef67c0dc912dd6ac088678482bdf32 Mon Sep 17 00:00:00 2001 From: ARIADNA BATALLA FERRES Date: Fri, 30 Aug 2024 13:12:31 +0200 Subject: [PATCH 3/4] Fix warning in test-PeriodStandardization.R --- tests/testthat/test-PeriodStandardization.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-PeriodStandardization.R b/tests/testthat/test-PeriodStandardization.R index 7673db2..1e816c0 100644 --- a/tests/testthat/test-PeriodStandardization.R +++ b/tests/testthat/test-PeriodStandardization.R @@ -130,7 +130,7 @@ test_that("1. Initial checks PeriodStandardization", { expect_warning( PeriodStandardization(data = dat1, ref_period = list(2020, 2021), dates = dates1), - paste0("Parameter 'ref_period' contain years outside the dates. ", + paste0("Parameter 'ref_period' contains years outside the dates. ", "It will not be used.") ) # handle_infinity -- GitLab From cc19ae17e948949b36f25755f38036535a173f5d Mon Sep 17 00:00:00 2001 From: ARIADNA BATALLA FERRES Date: Fri, 30 Aug 2024 13:29:36 +0200 Subject: [PATCH 4/4] Update man/CST_PeriodStandardization.Rd --- man/CST_PeriodStandardization.Rd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/man/CST_PeriodStandardization.Rd b/man/CST_PeriodStandardization.Rd index fe0dd3b..95f6474 100644 --- a/man/CST_PeriodStandardization.Rd +++ b/man/CST_PeriodStandardization.Rd @@ -105,12 +105,12 @@ parameter 'na.rm', the standardization cannot be carried out for those coordinates and therefore, the result will be filled with NA for the specific coordinates. When NAs are not removed, if the length of the data for a computational step is smaller than 4, there will not be enough data for -standarize and the result will be also filled with NAs for that coordinates. +standardization and the result will be also filled with NAs for those coordinates. About the distribution used to fit the data, there are only two possibilities: -'log-logistic' and 'Gamma'. The 'Gamma' method only works when only -precipitation is provided and other variables are 0 because it is positive +'log-logistic' and 'Gamma'. The 'Gamma' method works only when precipitation +is the sole variable provided, and all other variables are 0 because it is positive defined (SPI indicator). When only 'data' is provided ('data_cor' is NULL) the -standardization is computed with cross validation. This function is build to +standardization is computed with cross validation. This function is built to be compatible with other tools in that work with 's2dv_cube' object class. The input data must be this object class. If you don't work with 's2dv_cube', see PeriodStandardization. For more information on the SPEI -- GitLab