From 053033851ea42fcc4a0430e043729211e4fd0d4a Mon Sep 17 00:00:00 2001 From: Bart Date: Tue, 20 Jan 2026 14:13:21 +0100 Subject: [PATCH 1/2] Fix (#167) romania deviating files once in a while --- NEWS.md | 1 + R/get_pvol_ro.R | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 672e5562..e57fd35b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ # getRad (development version) * Clarify HTTP 429 error for the Netherlands (#165). +* For Romania match deviating file format (thanks to Sorin Burcea, #167). # getRad 0.2.4 diff --git a/R/get_pvol_ro.R b/R/get_pvol_ro.R index bc52ff81..5286b916 100644 --- a/R/get_pvol_ro.R +++ b/R/get_pvol_ro.R @@ -3,5 +3,19 @@ get_pvol_ro <- function(radar, time, ..., call = rlang::caller_env()) { urls <- glue::glue( "https://opendata.meteoromania.ro/radar/{toupper(substr(radar,3,5))}/{toupper(substr(radar,3,5))}_{strftime(time,'%Y%m%d%H%M', tz='UTC')}0200{params}.hdf" ) - read_pvol_from_url_per_param(urls, param = "all", call = call) + tryCatch( + read_pvol_from_url_per_param(urls, param = "all", call = call), + error = function(cnd) { + urls <- glue::glue( + "https://opendata.meteoromania.ro/radar/{toupper(substr(radar,3,5))}/{toupper(substr(radar,3,5))}_{strftime(time,'%Y%m%d%H%M', tz='UTC')}0300{params}.hdf" + ) + if ( + rlang::has_name(cnd, "parent") && inherits(cnd$parent, "httr2_http_404") + ) { + read_pvol_from_url_per_param(urls, param = "all", call = call) + } else { + return(cnd) + } + } + ) } From cdf1c952571a8e0217a27cfba512653220dddfe5 Mon Sep 17 00:00:00 2001 From: bart1 <1662852+bart1@users.noreply.github.com> Date: Thu, 5 Mar 2026 11:32:41 +0100 Subject: [PATCH 2/2] update url variable name --- R/get_pvol_ro.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/get_pvol_ro.R b/R/get_pvol_ro.R index 5286b916..6a7d0e63 100644 --- a/R/get_pvol_ro.R +++ b/R/get_pvol_ro.R @@ -6,13 +6,13 @@ get_pvol_ro <- function(radar, time, ..., call = rlang::caller_env()) { tryCatch( read_pvol_from_url_per_param(urls, param = "all", call = call), error = function(cnd) { - urls <- glue::glue( + urls_updated <- glue::glue( "https://opendata.meteoromania.ro/radar/{toupper(substr(radar,3,5))}/{toupper(substr(radar,3,5))}_{strftime(time,'%Y%m%d%H%M', tz='UTC')}0300{params}.hdf" ) if ( rlang::has_name(cnd, "parent") && inherits(cnd$parent, "httr2_http_404") ) { - read_pvol_from_url_per_param(urls, param = "all", call = call) + read_pvol_from_url_per_param(urls_updated, param = "all", call = call) } else { return(cnd) }