From 0344b5e2c07dfef5078b8af0e00bbcb2d1c9d495 Mon Sep 17 00:00:00 2001 From: Pakillo Date: Tue, 18 Jan 2022 12:28:15 +0100 Subject: [PATCH] add `check_server` --- DESCRIPTION | 2 +- NAMESPACE | 1 + NEWS.md | 4 ++++ R/check_server.R | 25 +++++++++++++++++++++++++ man/check_server.Rd | 19 +++++++++++++++++++ man/easyclimate-package.Rd | 2 +- 6 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 R/check_server.R create mode 100644 man/check_server.Rd diff --git a/DESCRIPTION b/DESCRIPTION index a7eb8ee..24b7965 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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", , "veronica.cral@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-0642-036X")), diff --git a/NAMESPACE b/NAMESPACE index eeb77b6..bffbd2f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,3 +1,4 @@ # Generated by roxygen2: do not edit by hand +export(check_server) export(get_daily_climate) diff --git a/NEWS.md b/NEWS.md index 3ac570b..20c9416 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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. diff --git a/R/check_server.R b/R/check_server.R new file mode 100644 index 0000000..9ba7b08 --- /dev/null +++ b/R/check_server.R @@ -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) +} diff --git a/man/check_server.Rd b/man/check_server.Rd new file mode 100644 index 0000000..90cd432 --- /dev/null +++ b/man/check_server.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/check_server.R +\name{check_server} +\alias{check_server} +\title{Check climate data server} +\usage{ +check_server() +} +\value{ +TRUE if the server seems available, FALSE otherwise. +} +\description{ +Check that the online climate data server is available and working correctly. +} +\examples{ +\dontrun{ +check_server() +} +} diff --git a/man/easyclimate-package.Rd b/man/easyclimate-package.Rd index 0c7c968..1d370f1 100644 --- a/man/easyclimate-package.Rd +++ b/man/easyclimate-package.Rd @@ -6,7 +6,7 @@ \alias{easyclimate-package} \title{easyclimate: Easy Access to High-Resolution Daily Climate Data for Europe} \description{ -Get high-resolution (1 km) daily climate data (precipitation, minimum and maximum temperatures) for points and polygons within Europe, from the European climatic database hosted at ftp://palantir.boku.ac.at/Public/ClimateData/. +Get high-resolution (1 km) daily climate data (precipitation, minimum and maximum temperatures) for points and polygons within Europe. } \seealso{ Useful links: