diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4db1f228e5b3890e93423d8c9200cf3617c8b51c..0873a3f93a877059b3067dfeb9874a5364513428 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ stages: build: stage: build script: - - module load R/3.6.1-foss-2015a-bare + - module load R/4.1.2-foss-2015a-bare - R CMD build --resave-data . - R CMD check --as-cran --no-manual --run-donttest CSIndicators_*.tar.gz - R -e 'covr::package_coverage()' diff --git a/tests/testthat/test-AbsToProbs.R b/tests/testthat/test-AbsToProbs.R index 9ef6df223f17b5e4e2e68ad8110f7d8a1141e725..2905cf30c9af3dfe14a8fd1a19f125a734e72f19 100644 --- a/tests/testthat/test-AbsToProbs.R +++ b/tests/testthat/test-AbsToProbs.R @@ -14,7 +14,7 @@ test_that("Sanity checks", { test_that("Seasonal forecasts", { - exp <- CSTools::lonlat_data$exp$data[1,1:3,1:3,,1:5,1:5] + exp <- CSTools::lonlat_temp$exp$data[1,1:3,1:3,,1:5,1:5] exp_probs <- AbsToProbs(exp) expect_equal(dim(exp)[3:5], dim(exp_probs)[3:5]) expect_equal(round(exp_probs[,1,1,1,1]), c(1, 0, 1)) diff --git a/tests/testthat/test-AccumulationExceedingThreshold.R b/tests/testthat/test-AccumulationExceedingThreshold.R index 90056b90a3ade8f50a1b3ca9a0a035adbbe461d7..a0ad194cf45113454508980eb774d0276b440237 100644 --- a/tests/testthat/test-AccumulationExceedingThreshold.R +++ b/tests/testthat/test-AccumulationExceedingThreshold.R @@ -55,7 +55,7 @@ test_that("Sanity checks", { test_that("Seasonal forecasts", { - exp <- CSTools::lonlat_data$exp + exp <- CSTools::lonlat_temp$exp exp$data <- exp$data[,1:4,1:2,,,] res <- CST_AccumulationExceedingThreshold(exp, threshold = 280) expect_equal(round(res$data[,2,2,2]), @@ -76,9 +76,9 @@ test_that("Seasonal forecasts", { GDD <- AccumulationExceedingThreshold(exp - 17, threshold = 0, dates = Dates, time_dim = 'ftime', start = list(1, 4), end = list(31, 10), na.rm = TRUE) expect_equal(round(GDD[,1,1,1]), - c(538, 372, 116, 525, 220, 330)) + c(538, 367, 116, 519, 219, 282)) expect_equal(dim(GDD), - c(member = 6, sdate = 3, lat =4, lon = 4)) + c(member = 6, sdate = 3, lat = 4, lon = 4)) expect_error(AccumulationExceedingThreshold(exp - 17, threshold = 0, dates = Dates, start = list(1, 4), end = list(31, 10)), "Could not find dimension 'time' in 1th object provided in 'data'.") expect_equal(all(is.na(AccumulationExceedingThreshold(exp - 17, threshold = 0, dates = Dates, time_dim = 'ftime',start = list(1, 4), end = list(31, 10)))), diff --git a/tests/testthat/test-QThreshold.R b/tests/testthat/test-QThreshold.R index 14fd5d1892d35e6a3a29b1ad29a76b8a2cfad4c2..708c00a41d43db813d6b00bbb3f63cc88aae2bd3 100644 --- a/tests/testthat/test-QThreshold.R +++ b/tests/testthat/test-QThreshold.R @@ -58,7 +58,7 @@ test_that("Sanity checks", { test_that("Seasonal forecasts", { - obs <- CSTools::lonlat_data$obs$data - 248 + obs <- CSTools::lonlat_temp$obs$data - 248 obs_percentile <- QThreshold(obs, threshold = 35) expect_equal(dim(obs)[4:6], dim(obs_percentile)[4:6]) expect_equal(obs_percentile[, 1, 1, 3, 20, 53], c(rep(0.4, 4), rep(0.2, 2))) diff --git a/tests/testthat/test-Threshold.R b/tests/testthat/test-Threshold.R index 44f12914d3beee5647760f4af6af16d39c68453a..7ff0ec9bb4b9dd3f8d34766399d02d7a959ae1ca 100644 --- a/tests/testthat/test-Threshold.R +++ b/tests/testthat/test-Threshold.R @@ -38,7 +38,7 @@ test_that("Sanity checks", { test_that("Seasonal forecasts", { - exp <- CSTools::lonlat_data$exp$data + exp <- CSTools::lonlat_temp$exp$data thresholdP <- Threshold(exp, threshold = 0.9) expect_equal(dim(exp)[4:6], dim(thresholdP)[2:4]) expect_equal(round(thresholdP[1, , 2, 2]), c(283, 281, 280)) diff --git a/tests/testthat/test-TotalSpellTimeExceedingThreshold.R b/tests/testthat/test-TotalSpellTimeExceedingThreshold.R index e09fb155ce5e0312f0d64a460331b71822e42ba0..4c55098dac48293136dcb6a8fbae1ce1230a1256 100644 --- a/tests/testthat/test-TotalSpellTimeExceedingThreshold.R +++ b/tests/testthat/test-TotalSpellTimeExceedingThreshold.R @@ -38,7 +38,7 @@ test_that("Sanity checks", { test_that("Seasonal Forecasts", { - exp <- CSTools::lonlat_data$exp + exp <- CSTools::lonlat_temp$exp exp$data <- exp$data[1,1:3,1:3,,,] res <- CST_TotalSpellTimeExceedingThreshold(exp, threshold = 260, spell = 2) expect_equal(res$data[,,1,1], diff --git a/tests/testthat/test-TotalTimeExceedingThreshold.R b/tests/testthat/test-TotalTimeExceedingThreshold.R index 408764b734b2621ebbce9edcfcf84666214fdb04..a1104b461f7e5a4cb443de833517a743abbcbb2e 100644 --- a/tests/testthat/test-TotalTimeExceedingThreshold.R +++ b/tests/testthat/test-TotalTimeExceedingThreshold.R @@ -57,12 +57,12 @@ test_that("Sanity checks", { test_that("Seasonal forecasts", { # compare with scalar fixed threshold - exp <- CSTools::lonlat_data$exp + exp <- CSTools::lonlat_temp$exp exp$data <- exp$data[1,1:3,,,,] - 247 SU35_NoP <- CST_TotalTimeExceedingThreshold(exp, threshold = 35)$data expect_equal(SU35_NoP[1,,15,3], c(0,1,1,1,0,0)) # convert to percentile - obs <- CSTools::lonlat_data$obs + obs <- CSTools::lonlat_temp$obs exp_percentile <- AbsToProbs(exp$data) obs_percentile <- drop(QThreshold(obs$data, threshold = 35)) data <- exp