From 0757ad0f4a4814254a39634ba081d27eb122d96f Mon Sep 17 00:00:00 2001 From: Bart Date: Mon, 3 Aug 2026 14:21:42 +0200 Subject: [PATCH 1/6] make error messages runable --- R/get_pvol_nl.R | 4 ++-- R/secrets.R | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/get_pvol_nl.R b/R/get_pvol_nl.R index 9dfbe45..adec387 100644 --- a/R/get_pvol_nl.R +++ b/R/get_pvol_nl.R @@ -67,7 +67,7 @@ get_pvol_nl <- function(radar, time, ..., call = rlang::caller_env()) { "There was an authorization error. You may have used an invalid API key.", "i" = "Please check if you set the correct {.val nl_api_key} with - {.code get_secret(\"nl_api_key\")}." + {.run getRad::get_secret(\"nl_api_key\")}." ), cnd = cnd, class = "getRad_error_get_pvol_nl_authorization_failure", @@ -80,7 +80,7 @@ get_pvol_nl <- function(radar, time, ..., call = rlang::caller_env()) { "There was a rate limitation error (HTTP 429) while getting data from the Netherlands.", "i" = "This frequently occurs when using the anonymous key, if it occurs repeatedly consider requesting a registered key ({.url https://developer.dataplatform.knmi.nl/open-data-api#token}). ", "i" = "You can check the current value of {.val nl_api_key} with - {.code get_secret(\"nl_api_key\")}." + {.run getrad::get_secret(\"nl_api_key\")}." ), cnd = cnd, class = "getRad_error_get_pvol_nl_429_failure", diff --git a/R/secrets.R b/R/secrets.R index 6675beb..a2dab8e 100644 --- a/R/secrets.R +++ b/R/secrets.R @@ -79,7 +79,7 @@ get_secret <- function(name) { cli::cli_abort( c( "Can't find secret {.arg {sname}} in the keyring.", - "i" = "Please use {.code set_secret(\"{name}\")} to store the secret. Note that the prefix is automatically added in {.fun set_secret}." + "i" = "Please use {.run getRad::set_secret(\"{name}\")} to store the secret. Note that the prefix is automatically added in {.fun set_secret}." ), class = "getRad_error_secret_not_found" ) From 343822ab346dd90d3b2cdffaca149e9dcb1aec74 Mon Sep 17 00:00:00 2001 From: Bart Date: Mon, 3 Aug 2026 21:57:25 +0200 Subject: [PATCH 2/6] nicer print --- R/get_pvol_nl.R | 4 ++-- R/secrets.R | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/get_pvol_nl.R b/R/get_pvol_nl.R index adec387..6d65b97 100644 --- a/R/get_pvol_nl.R +++ b/R/get_pvol_nl.R @@ -67,7 +67,7 @@ get_pvol_nl <- function(radar, time, ..., call = rlang::caller_env()) { "There was an authorization error. You may have used an invalid API key.", "i" = "Please check if you set the correct {.val nl_api_key} with - {.run getRad::get_secret(\"nl_api_key\")}." + {.run [get_secret(\"nl_api_key\")](getRad::get_secret(\"nl_api_key\"))}." ), cnd = cnd, class = "getRad_error_get_pvol_nl_authorization_failure", @@ -80,7 +80,7 @@ get_pvol_nl <- function(radar, time, ..., call = rlang::caller_env()) { "There was a rate limitation error (HTTP 429) while getting data from the Netherlands.", "i" = "This frequently occurs when using the anonymous key, if it occurs repeatedly consider requesting a registered key ({.url https://developer.dataplatform.knmi.nl/open-data-api#token}). ", "i" = "You can check the current value of {.val nl_api_key} with - {.run getrad::get_secret(\"nl_api_key\")}." + {.run [get_secret(\"nl_api_key\")](getrad::get_secret(\"nl_api_key\"))}." ), cnd = cnd, class = "getRad_error_get_pvol_nl_429_failure", diff --git a/R/secrets.R b/R/secrets.R index a2dab8e..a617b9e 100644 --- a/R/secrets.R +++ b/R/secrets.R @@ -79,7 +79,7 @@ get_secret <- function(name) { cli::cli_abort( c( "Can't find secret {.arg {sname}} in the keyring.", - "i" = "Please use {.run getRad::set_secret(\"{name}\")} to store the secret. Note that the prefix is automatically added in {.fun set_secret}." + "i" = "Please use {.run [set_secret(\"{name}\")](getRad::set_secret(\"{name}\"))} to store the secret. Note that the prefix is automatically added in {.fun set_secret}." ), class = "getRad_error_secret_not_found" ) From 39b415541a0891f0dbaf2d5cc5a966eab991dcf5 Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 5 Aug 2026 08:55:25 +0200 Subject: [PATCH 3/6] do not use rspm as it causes issues on bioconductor --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 2e08859..56c02e7 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -42,7 +42,7 @@ jobs: with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} - use-public-rspm: true + use-public-rspm: false - uses: r-lib/actions/setup-r-dependencies@v2 with: From 78be2b0462b69bf9a27030c0024ca399fab6c174 Mon Sep 17 00:00:00 2001 From: bart1 <1662852+bart1@users.noreply.github.com> Date: Fri, 7 Aug 2026 10:33:16 +0200 Subject: [PATCH 4/6] Enable use of public RSPM in workflow revert change --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 56c02e7..2e08859 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -42,7 +42,7 @@ jobs: with: r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} - use-public-rspm: false + use-public-rspm: true - uses: r-lib/actions/setup-r-dependencies@v2 with: From 92ff1ef5e9ed2f22724c9bab757f50b5bdea6a7a Mon Sep 17 00:00:00 2001 From: bart1 <1662852+bart1@users.noreply.github.com> Date: Fri, 7 Aug 2026 10:39:01 +0200 Subject: [PATCH 5/6] Comment out R version 4.1.0 in workflow Comment out the R version 4.1.0 due to installation issue. --- .github/workflows/R-CMD-check.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 2e08859..4112258 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -26,7 +26,8 @@ jobs: - {os: ubuntu-latest, r: 'release'} - {os: ubuntu-latest, r: 'oldrel-1'} # And minimum supported version in DESCRIPTION - - {os: ubuntu-latest, r: '4.1.0'} + # this seems to be failing due to a issue installing rhdf5 from bioconductor + # - {os: ubuntu-latest, r: '4.1.0'} env: getRad_nl_api_key: ${{ secrets.GETRAD_NL_API_KEY }} From a3d4ca7445c43a9fad82113a1575c35a2ecb9e8a Mon Sep 17 00:00:00 2001 From: Bart Date: Mon, 17 Aug 2026 15:28:36 +0200 Subject: [PATCH 6/6] skip if package is not installed --- tests/testthat/test-get_pvol.R | 3 +++ tests/testthat/test-get_pvol_at.R | 9 ++++++--- tests/testthat/test-get_pvol_us.R | 4 ++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test-get_pvol.R b/tests/testthat/test-get_pvol.R index b9c2ffc..720a045 100644 --- a/tests/testthat/test-get_pvol.R +++ b/tests/testthat/test-get_pvol.R @@ -130,6 +130,7 @@ test_that("multiple timestamps and radars work", { test_that("Mixed radar vector (single timestamp)", { skip_if_offline() + skip_if_not_installed("vol2birdR", "1.3.0") time_utc <- lubridate::as_datetime("2021-01-20 05:01:00") suppressMessages(pvols <- getRad::get_pvol(c("KABR", "finur"), time_utc)) expect_true(is.list(pvols)) @@ -152,6 +153,8 @@ test_that("Mixed radar vector (single timestamp)", { test_that("Mixed radar vector + 9 minute interval", { skip_if_offline() + skip_if_not_installed("vol2birdR", "1.3.0") + time_utc <- lubridate::as_datetime("2025-01-20 03:55:50") dt_int <- lubridate::interval(time_utc, time_utc + lubridate::minutes(9)) suppressMessages(pvols <- getRad::get_pvol(c("KABR", "fikan"), dt_int)) diff --git a/tests/testthat/test-get_pvol_at.R b/tests/testthat/test-get_pvol_at.R index e77f9db..892b4fb 100644 --- a/tests/testthat/test-get_pvol_at.R +++ b/tests/testthat/test-get_pvol_at.R @@ -1,5 +1,5 @@ test_that("Pvol for hochficht in austria can be downloaded", { - skip_if_offline("public.hub.geosphere.at") + skip_if_offline(host = "public.hub.geosphere.at") time <- as.POSIXct(Sys.time() - 10000, tz = "Europe/Helsinki") pvol <- expect_s3_class(get_pvol("hochficht", time, param = "all"), "pvol") expect_true(bioRad::is.pvol(pvol)) @@ -10,7 +10,7 @@ test_that("Pvol for hochficht in austria can be downloaded", { }) test_that("Pvol for hochficht in austria can be downloaded", { - skip_if_offline("public.hub.geosphere.at") + skip_if_offline(host = "public.hub.geosphere.at") time <- as.POSIXct( Sys.time() - 10000 - 24 * 3 * 60 * 60, tz = "Europe/Helsinki" @@ -21,7 +21,10 @@ test_that("Pvol for hochficht in austria can be downloaded", { ) }) test_that("hochficht can be combined with other radars", { - skip_if_offline("public.hub.geosphere.at") + skip_if_offline(host = "public.hub.geosphere.at") + skip_if_offline(host = "unidata-nexrad-level2.s3.amazonaws.com") + skip_if_offline(host = "opendata.dwd.de") + skip_if_not_installed("vol2birdR", "1.3.0") suppressMessages(expect_type( pvol_lst <- get_pvol( c("depro", "hochficht", "KABX"), diff --git a/tests/testthat/test-get_pvol_us.R b/tests/testthat/test-get_pvol_us.R index 02d6120..0c8e28b 100644 --- a/tests/testthat/test-get_pvol_us.R +++ b/tests/testthat/test-get_pvol_us.R @@ -3,6 +3,8 @@ dt_int <- lubridate::interval(time_utc, time_utc + lubridate::minutes(9)) test_that("NEXRAD polar volume can be downloaded", { skip_if_offline(host = "unidata-nexrad-level2.s3.amazonaws.com") + skip_if_not_installed("vol2birdR", "1.3.0") + suppressMessages( expect_s3_class( getRad::get_pvol("KABR", time_utc), @@ -24,6 +26,8 @@ test_that("pvol us internal functions", { test_that("NEXRAD polar volume correct time is downloaded", { skip_if_offline(host = "unidata-nexrad-level2.s3.amazonaws.com") + skip_if_not_installed("vol2birdR", "1.3.0") + t <- as.POSIXct("2025-1-10 18:00:00", tz = "UTC") suppressMessages(expect_identical( getRad::get_pvol("KABX", t)$datetime,