From e544cfe92b37fbec6e788704cddf1447b76feb5d Mon Sep 17 00:00:00 2001 From: THEERTHA KARIYATHAN Date: Thu, 12 Dec 2024 14:23:26 +0100 Subject: [PATCH 1/6] imprve Quantilemapping doc --- R/CST_QuantileMapping.R | 44 +++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/R/CST_QuantileMapping.R b/R/CST_QuantileMapping.R index cbb76c99..a8e20e18 100644 --- a/R/CST_QuantileMapping.R +++ b/R/CST_QuantileMapping.R @@ -8,18 +8,22 @@ #'@author Nuria Perez-Zanon, \email{nuria.perez@bsc.es} #'@param exp An object of class \code{s2dv_cube}. #'@param obs An object of class \code{s2dv_cube}. -#'@param exp_cor An object of class \code{s2dv_cube} in which the quantile -#' mapping correction should be applied. If it is not specified, the correction -#' is applied in object 'exp'. +#'@param exp_cor A multidimensional array with named dimensions in which the +#' quantile mapping correction should be applied. If it is not specified, the +#' correction is applied to object 'exp' using leave-one-out cross-validation. +#' This is useful to correct a forecast when the hindcast is provided in parameter 'exp'. + #'@param sdate_dim A character string indicating the dimension name in which #' cross-validation would be applied when exp_cor is not provided. 'sdate' by #' default. #'@param memb_dim A character string indicating the dimension name where #' ensemble members are stored in the experimental arrays. It can be NULL if #' there is no ensemble member dimension. It is set as 'member' by default. -#'@param window_dim A character string indicating the dimension name where -#' samples have been stored. It can be NULL (default) in case all samples are -#' used. +#'@param window_dim A character string indicating the dimension name in which extra +#' samples are stored. This dimension is joined to the 'member' dimension. +#' This is useful to correct daily data, for which robust statistics can be obtained +#' by creating a window of dates around the target date. + #'@param method A character string indicating the method to be used:'PTF', #' 'DIST', 'RQUANT', 'QUANT', 'SSPLIN'. By default, the empirical quantile #' mapping 'QUANT' is used. @@ -99,17 +103,19 @@ CST_QuantileMapping <- function(exp, obs, exp_cor = NULL, sdate_dim = 'sdate', #'@param obs A multidimensional array with named dimensions containing the #' reference dataset. #'@param exp_cor A multidimensional array with named dimensions in which the -#' quantile mapping correction should be applied. If it is not specified, the -#' correction is applied on object 'exp'. +#' quantile mapping correction should be applied. If it is not specified, the +#' correction is applied to object 'exp' using leave-one-out cross-validation. +#' This is useful to correct a forecast when the hindcast is provided in parameter 'exp'. #'@param sdate_dim A character string indicating the dimension name in which #' cross-validation would be applied when exp_cor is not provided. 'sdate' by #' default. #'@param memb_dim A character string indicating the dimension name where #' ensemble members are stored in the experimental arrays. It can be NULL if #' there is no ensemble member dimension. It is set as 'member' by default. -#'@param window_dim A character string indicating the dimension name where -#' samples have been stored. It can be NULL (default) in case all samples are -#' used. +#'@param window_dim A character string indicating the dimension name in which extra +#' samples are stored. This dimension is joined to the 'member' dimension. +#' This is useful to correct daily data, for which robust statistics can be obtained +#' by creating a window of dates around the target date. #'@param method A character string indicating the method to be used: 'PTF', #' 'DIST', 'RQUANT', 'QUANT', 'SSPLIN'. By default, the empirical quantile #' mapping 'QUANT' is used. @@ -126,14 +132,14 @@ CST_QuantileMapping <- function(exp, obs, exp_cor = NULL, sdate_dim = 'sdate', #'@seealso \code{\link[qmap]{fitQmap}} and \code{\link[qmap]{doQmap}} #'@examples #'# Use synthetic data -#'exp <- 1 : c(1 * 3 * 5 * 4 * 3 * 2) -#'dim(exp) <- c(dataset = 1, member = 3, sdate = 5, ftime = 4, -#' lat = 3, lon = 2) -#'obs <- 101 : c(100 + 1 * 1 * 5 * 4 * 3 * 2) -#'dim(obs) <- c(dataset = 1, member = 1, sdate = 5, ftime = 4, -#' lat = 3, lon = 2) -#'res <- QuantileMapping(exp, obs) -#' +#'exp <- as.numeric(1:prod(6,10,15)) +#'dim(exp) <- c(member = 6, syear = 10, window = 15) +#'obs <- as.numeric(rnorm(prod(1,10,15), 50)) +#'dim(obs) <- c(member = 1, syear = 10, window = 15) +#'fcst <- 100*(1:prod(8,1,1)) +#'dim(fcst) <- c(member = 8, syear = 1, swindow = 1) +#'res <- QuantileMapping(exp = exp, obs = obs, exp_cor = fcst, +#' memb_dim = 'member', sdate_dim = 'syear', window_dim = 'window') #'@import qmap #'@import multiApply #'@import s2dv -- GitLab From 9c173781225c24b66db6be14df30b99f017d6d49 Mon Sep 17 00:00:00 2001 From: THEERTHA KARIYATHAN Date: Thu, 9 Jan 2025 13:09:31 +0100 Subject: [PATCH 2/6] Remove .Rproj files and update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2f6c062a..52d15b6a 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ Rplots.pdf .nfs* *.RData !data/*.RData +.Rproj.user/ -- GitLab From 198a15fafc9b8e4da5e06cfd0568fd87e21a78ac Mon Sep 17 00:00:00 2001 From: THEERTHA KARIYATHAN Date: Thu, 9 Jan 2025 14:45:31 +0100 Subject: [PATCH 3/6] update quantilemapping doc --- R/CST_QuantileMapping.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/R/CST_QuantileMapping.R b/R/CST_QuantileMapping.R index a8e20e18..acd5259d 100644 --- a/R/CST_QuantileMapping.R +++ b/R/CST_QuantileMapping.R @@ -12,7 +12,6 @@ #' quantile mapping correction should be applied. If it is not specified, the #' correction is applied to object 'exp' using leave-one-out cross-validation. #' This is useful to correct a forecast when the hindcast is provided in parameter 'exp'. - #'@param sdate_dim A character string indicating the dimension name in which #' cross-validation would be applied when exp_cor is not provided. 'sdate' by #' default. @@ -23,7 +22,6 @@ #' samples are stored. This dimension is joined to the 'member' dimension. #' This is useful to correct daily data, for which robust statistics can be obtained #' by creating a window of dates around the target date. - #'@param method A character string indicating the method to be used:'PTF', #' 'DIST', 'RQUANT', 'QUANT', 'SSPLIN'. By default, the empirical quantile #' mapping 'QUANT' is used. @@ -132,6 +130,7 @@ CST_QuantileMapping <- function(exp, obs, exp_cor = NULL, sdate_dim = 'sdate', #'@seealso \code{\link[qmap]{fitQmap}} and \code{\link[qmap]{doQmap}} #'@examples #'# Use synthetic data +#'set.seed(123) #'exp <- as.numeric(1:prod(6,10,15)) #'dim(exp) <- c(member = 6, syear = 10, window = 15) #'obs <- as.numeric(rnorm(prod(1,10,15), 50)) -- GitLab From 9250aa9e05c7c46c672cfc2f4d8f719b91b84970 Mon Sep 17 00:00:00 2001 From: THEERTHA KARIYATHAN Date: Fri, 10 Jan 2025 12:04:32 +0100 Subject: [PATCH 4/6] conflict resolved source vs target --- cstools | 1 + 1 file changed, 1 insertion(+) create mode 160000 cstools diff --git a/cstools b/cstools new file mode 160000 index 00000000..fc486262 --- /dev/null +++ b/cstools @@ -0,0 +1 @@ +Subproject commit fc486262cbf4b7bd70314fd5fec7405cd9089fd9 -- GitLab From 62a9fb0e3347672a67e9e5ea5355c2da07c2f791 Mon Sep 17 00:00:00 2001 From: THEERTHA KARIYATHAN Date: Fri, 10 Jan 2025 13:12:53 +0100 Subject: [PATCH 5/6] conflict resolve --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 52d15b6a..89a262fe 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,4 @@ Rplots.pdf .nfs* *.RData !data/*.RData -.Rproj.user/ +.Rproj.user -- GitLab From f64973f0ff44919c27201b7cae7f93855ca5e82d Mon Sep 17 00:00:00 2001 From: THEERTHA KARIYATHAN Date: Thu, 13 Feb 2025 11:59:44 +0100 Subject: [PATCH 6/6] update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 89a262fe..c5a00972 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ Rplots.pdf *.RData !data/*.RData .Rproj.user +*.Rproj \ No newline at end of file -- GitLab