Skip to content

Commit

Permalink
dataDWD: new argument method. Closes #34
Browse files Browse the repository at this point in the history
  • Loading branch information
brry committed May 12, 2022
1 parent 6060511 commit d49afd2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rdwd
Title: Select and Download Climate Data from 'DWD' (German Weather Service)
Version: 1.5.24
Date: 2022-05-11
Version: 1.5.25
Date: 2022-05-12
Depends: R(>= 2.10)
Imports: berryFunctions (>= 1.21.11), pbapply
Suggests: RCurl, leaflet, knitr, rmarkdown, testthat, roxygen2, devtools, remotes,
Expand Down
6 changes: 5 additions & 1 deletion R/dataDWD.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@
#' See [Website](https://bookdown.org/brry/rdwd/raster-data.html#binary-file-errors)
#' for details.
#' DEFAULT: TRUE
#' @param method [download.file] `method`. Introduced in version 1.5.25 (2022-05-12)
#' as triggered by <https://github.com/brry/rdwd/issues/34>.
#' DEFAULT: `getOption("download.file.method")`
#' @param dfargs Named list of additional arguments passed to [download.file()]
#' Note that mode="wb" is already passed if `dbin=TRUE`
#' @param sleep Number. If not 0, a random number of seconds between 0 and
Expand Down Expand Up @@ -123,6 +126,7 @@ force=FALSE,
overwrite=!isFALSE(force),
read=TRUE,
dbin=TRUE,
method=getOption("download.file.method"),
dfargs=NULL,
sleep=0,
progbar=!quiet,
Expand Down Expand Up @@ -199,7 +203,7 @@ dl_results <- lapply(seq_along(url), function(i)
if(!dontdownload[i])
{
# Actual file download:
dfdefaults <- list(url=url[i], destfile=outfile[i], quiet=TRUE)
dfdefaults <- list(url=url[i], destfile=outfile[i], method=method, quiet=TRUE)
if(dbin) dfdefaults <- c(dfdefaults, mode="wb")
e <- try(suppressWarnings(do.call(download.file,
berryFunctions::owa(dfdefaults, dfargs))), silent=TRUE)
Expand Down
5 changes: 5 additions & 0 deletions man/dataDWD.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d49afd2

Please sign in to comment.