Skip to content

Commit

Permalink
assertions for telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
bczernecki committed Sep 20, 2023
1 parent b0cefd9 commit 261d4ef
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion R/meteo_imgw_datastore.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ meteo_imgw_datastore = function(year,
coords = TRUE,
allow_failure = TRUE) {

# assertions for year
if (!any(is.character(year) || is.numeric(year))) {
stop("year argument must be character or numeric")

Check warning on line 52 in R/meteo_imgw_datastore.R

View check run for this annotation

Codecov / codecov/patch

R/meteo_imgw_datastore.R#L51-L52

Added lines #L51 - L52 were not covered by tests
}

if (!all(as.numeric(year) >= 2008)) {
stop("year argument must be provided and all elements must be >= 2008")

Check warning on line 56 in R/meteo_imgw_datastore.R

View check run for this annotation

Codecov / codecov/patch

R/meteo_imgw_datastore.R#L55-L56

Added lines #L55 - L56 were not covered by tests
}

if (allow_failure) {
tryCatch(meteo_imgw_datastore_bp(year,
parameters,
Expand Down Expand Up @@ -80,7 +89,7 @@ meteo_imgw_datastore_bp = function(year,
telemetry_stations$river = NULL

Check warning on line 89 in R/meteo_imgw_datastore.R

View check run for this annotation

Codecov / codecov/patch

R/meteo_imgw_datastore.R#L88-L89

Added lines #L88 - L89 were not covered by tests

if (!is.null(stations)) {
telemetry_stations = telemetry_stations[telemetry_stations$name %in% stations, ]
telemetry_stations = telemetry_stations[telemetry_stations$name %in% toupper(stations), ]

Check warning on line 92 in R/meteo_imgw_datastore.R

View check run for this annotation

Codecov / codecov/patch

R/meteo_imgw_datastore.R#L91-L92

Added lines #L91 - L92 were not covered by tests
}

urls = as.character(
Expand Down

0 comments on commit 261d4ef

Please sign in to comment.