Skip to content

Commit

Permalink
add check_server
Browse files Browse the repository at this point in the history
  • Loading branch information
Pakillo committed Jan 18, 2022
1 parent 9679a45 commit 0344b5e
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: easyclimate
Title: Easy Access to High-Resolution Daily Climate Data for Europe
Version: 0.1.5
Version: 0.1.6
Authors@R: c(
person("Verónica", "Cruz-Alonso", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-0642-036X")),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Generated by roxygen2: do not edit by hand

export(check_server)
export(get_daily_climate)
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# easyclimate 0.1.6

* New function `check_server()` to check that the climate data server is working correctly.

# easyclimate 0.1.5

* Now giving the possibility to download multiple climatic variables at once.
Expand Down
25 changes: 25 additions & 0 deletions R/check_server.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#' Check climate data server
#'
#' Check that the online climate data server is available and working correctly.
#'
#' @return TRUE if the server seems available, FALSE otherwise.
#' @export
#'
#' @examples
#' \dontrun{
#' check_server()
#' }
check_server <- function() {

cog.url <- build_url(climatic_var_single = "Prcp", year = 2010)

server.ok <- RCurl::url.exists(cog.url)

if (isTRUE(server.ok)) {
message("The server seems to be running correctly.")
} else {
message("The server seems unavailable at the moment. Please try later.")
}

return(server.ok)
}
19 changes: 19 additions & 0 deletions man/check_server.Rd

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

2 changes: 1 addition & 1 deletion man/easyclimate-package.Rd

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

0 comments on commit 0344b5e

Please sign in to comment.