From 304b32a0908b4ff23a4a5445456b89a1d8f1138a Mon Sep 17 00:00:00 2001 From: Eva Rifa Date: Tue, 10 Jan 2023 16:21:02 +0100 Subject: [PATCH] Correct .RMS() when dat_dim is NULL and conf is FALSE. Added a test for this case --- R/RMS.R | 6 ++++-- tests/testthat/test-RMS.R | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/R/RMS.R b/R/RMS.R index b3188fc..2c77d0a 100644 --- a/R/RMS.R +++ b/R/RMS.R @@ -255,8 +255,10 @@ RMS <- function(exp, obs, time_dim = 'sdate', dat_dim = 'dataset', # Remove nexp and nobs if dat_dim = NULL if (is.null(dat_dim)) { dim(rms) <- NULL - dim(conf.lower) <- NULL - dim(conf.upper) <- NULL + if (conf) { + dim(conf.lower) <- NULL + dim(conf.upper) <- NULL + } } ################################### diff --git a/tests/testthat/test-RMS.R b/tests/testthat/test-RMS.R index f69cfd8..aac0672 100644 --- a/tests/testthat/test-RMS.R +++ b/tests/testthat/test-RMS.R @@ -205,6 +205,10 @@ test_that("4. Output checks: dat3", { c(1.6458118, 0.8860392, 0.8261295, 1.1681939, 2.1693538, 1.3064454, 0.5384229, 1.1215333), tolerance = 0.00001 ) + expect_equal( + dim(RMS(exp3, obs3, dat_dim = NULL, conf = FALSE)$rms), + c(ftime = 2, lon = 1, lat = 4) + ) }) ############################################## \ No newline at end of file -- GitLab