Skip to content

Commit

Permalink
Remove pingr dependency. All servers of Hydroscope are currently not …
Browse files Browse the repository at this point in the history
…working
  • Loading branch information
kvantas committed Jul 19, 2024
1 parent 771c833 commit 5f92c0e
Show file tree
Hide file tree
Showing 31 changed files with 349 additions and 443 deletions.
7 changes: 3 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: hydroscoper
Type: Package
Title: Interface to the Greek National Data Bank for Hydrometeorological Information
Version: 1.6.0
Version: 1.7.0
Authors@R: c(person("Konstantinos", "Vantas",
role = c("aut", "cre"),
email = "[email protected]",
Expand All @@ -24,15 +24,14 @@ Depends: R (>= 3.4)
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.0
RoxygenNote: 7.3.2
Imports: stringi (>= 1.8),
stringr (>= 1.5),
tibble(>= 3.2),
pingr (>= 2.0),
readr (>= 2.1),
jsonlite (>= 1.8)
Suggests:
ggplot2 (>= 3.4),
ggplot2 (>= 3.5),
knitr (>= 1.45),
rmarkdown (>= 2.25),
testthat (>= 3.2)
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# hydroscoper 1.7.0 (Release date: 2024-07-19)

* remove pingr dependency

# hydroscoper 1.6.0 (Release date: 2024-01-15)

* Update dependencies
Expand Down
31 changes: 15 additions & 16 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,29 @@ server_address <- function(subdomain) {
paste0(subdomain, ".hydroscope.gr")
}

#' Ping a remote server to see if its alive
#' Check if a remote server is alive
#' @noRd
server_alive <- function(subdomain) {

err_msg <- paste(
"The server for that data source is probably down,",
"get more info at [email protected] or try",
"again later."
)
tryCatch({
pingr::ping_port(server_address(subdomain),
port = 80L,
count = 1
)
if (all(is.na(pingr::ping_port(server_address(subdomain),
port = 80L,
count = 3
)))) {
stop()
}
},
error = function(e) {
stop(err_msg, call. = FALSE)

# test the http capabilities of the current R build
if (!capabilities(what = "http/ftp")) {
stop("The current R build has no http capabilities")
}
)

# test connection by trying to read first line of url
test <- try(suppressWarnings(readLines(url, n = 1)), silent = TRUE)

# return FALSE if test inherits 'try-error' class
if (inherits(test, "try-error")) {
stop(err_msg)
}

}

#' create coords from points
Expand Down
18 changes: 12 additions & 6 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,28 @@ knitr::opts_chunk$set(
chk_online <- FALSE
library(pingr)
# helper function to check if a sub-domain is online
online <- function(h_url){
!is.na(pingr::ping(h_url, count = 1))
online <- function(url = "kyy.hydroscope.gr") {
# test the http capabilities of the current R build
if (!capabilities(what = "http/ftp")) return(FALSE)
# test connection by trying to read first line of url
test <- try(suppressWarnings(readLines(url, n = 1)), silent = TRUE)
# return FALSE if test inherits 'try-error' class
!inherits(test, "try-error")
}
# check if sub-domains are online
chk_online <- online("kyy.hydroscope.gr")
chk_online <- online()
```
[![tic](https://github.com/ropensci/hydroscoper/workflows/tic/badge.svg?branch=master)](https://github.com/ropensci/hydroscoper/actions)
[![codecov](https://codecov.io/github/ropensci/hydroscoper/branch/master/graphs/badge.svg)](https://app.codecov.io/gh/ropensci/hydroscoper)
[![minimal R version](https://img.shields.io/badge/R%3E%3D-3.4-6666ff.svg)](https://cran.r-project.org/)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/hydroscoper)](https://cran.r-project.org/package=hydroscoper)
[![packageversion](https://img.shields.io/badge/Package%20version-1.6.0-orange.svg?style=flat-square)](https://github.com/ropensci/hydroscoper)
[![packageversion](https://img.shields.io/badge/Package%20version-1.7.0-orange.svg?style=flat-square)](https://github.com/ropensci/hydroscoper)
[![](https://cranlogs.r-pkg.org/badges/grand-total/hydroscoper)](https://cran.r-project.org/package=hydroscoper)
[![ropensci](https://badges.ropensci.org/185_status.svg)](https://github.com/ropensci/software-review/issues/185)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1196540.svg)](https://doi.org/10.5281/zenodo.1196540)
Expand Down
18 changes: 1 addition & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ hydroscoper
[![minimal R
version](https://img.shields.io/badge/R%3E%3D-3.4-6666ff.svg)](https://cran.r-project.org/)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/hydroscoper)](https://cran.r-project.org/package=hydroscoper)
[![packageversion](https://img.shields.io/badge/Package%20version-1.6.0-orange.svg?style=flat-square)](https://github.com/ropensci/hydroscoper)
[![packageversion](https://img.shields.io/badge/Package%20version-1.7.0-orange.svg?style=flat-square)](https://github.com/ropensci/hydroscoper)
[![](https://cranlogs.r-pkg.org/badges/grand-total/hydroscoper)](https://cran.r-project.org/package=hydroscoper)
[![ropensci](https://badges.ropensci.org/185_status.svg)](https://github.com/ropensci/software-review/issues/185)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1196540.svg)](https://doi.org/10.5281/zenodo.1196540)
Expand Down Expand Up @@ -75,20 +75,6 @@ library(ggplot2)

ts_raw <- get_data(subdomain = "kyy", time_id = 56)
ts_raw
#> # A tibble: 147,519 × 3
#> date value comment
#> <dttm> <dbl> <chr>
#> 1 1985-05-06 08:00:00 0 1
#> 2 1985-05-06 08:30:00 0 1
#> 3 1985-05-06 09:00:00 0 1
#> 4 1985-05-06 09:30:00 0 1
#> 5 1985-05-06 10:00:00 0 1
#> 6 1985-05-06 10:30:00 0 1
#> 7 1985-05-06 11:00:00 0 1
#> 8 1985-05-06 11:30:00 0 1
#> 9 1985-05-06 12:00:00 0 1
#> 10 1985-05-06 12:30:00 0 1
#> # ℹ 147,509 more rows
```

Let’s create a plot:
Expand All @@ -101,8 +87,6 @@ ggplot(data = ts_raw, aes(x = date, y = value))+
theme_classic()
```

![](man/figures/README-plot_time_series-1.png)<!-- -->

## Meta

- Bug reports, suggestions, and code are welcome. Please see
Expand Down
53 changes: 18 additions & 35 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,17 @@
"identifier": "hydroscoper",
"description": "R interface to the Greek National Data Bank for Hydrological and Meteorological Information. It covers Hydroscope's data sources and provides functions to transliterate, translate and download them into tidy dataframes.",
"name": "hydroscoper: Interface to the Greek National Data Bank for Hydrometeorological Information",
"relatedLink": ["https://docs.ropensci.org/hydroscoper/", "https://CRAN.R-project.org/package=hydroscoper"],
"relatedLink": "https://docs.ropensci.org/hydroscoper/",
"codeRepository": "https://github.com/ropensci/hydroscoper",
"issueTracker": "https://github.com/ropensci/hydroscoper/issues ",
"license": "https://spdx.org/licenses/MIT",
"version": "1.5.0",
"version": "1.7.0",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.2.1 (2022-06-23)",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"runtimePlatform": "R version 4.4.1 (2024-06-14 ucrt)",
"author": [
{
"@type": "Person",
Expand Down Expand Up @@ -51,7 +45,7 @@
"@type": "SoftwareApplication",
"identifier": "ggplot2",
"name": "ggplot2",
"version": ">= 3.3",
"version": ">= 3.5",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand All @@ -64,7 +58,7 @@
"@type": "SoftwareApplication",
"identifier": "knitr",
"name": "knitr",
"version": ">= 1.31",
"version": ">= 1.45",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand All @@ -77,7 +71,7 @@
"@type": "SoftwareApplication",
"identifier": "rmarkdown",
"name": "rmarkdown",
"version": ">= 2.7",
"version": ">= 2.25",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand All @@ -90,7 +84,7 @@
"@type": "SoftwareApplication",
"identifier": "testthat",
"name": "testthat",
"version": ">= 3.0",
"version": ">= 3.2",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand All @@ -111,7 +105,7 @@
"@type": "SoftwareApplication",
"identifier": "stringi",
"name": "stringi",
"version": ">= 1.5",
"version": ">= 1.8",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand All @@ -124,7 +118,7 @@
"@type": "SoftwareApplication",
"identifier": "stringr",
"name": "stringr",
"version": ">= 1.4",
"version": ">= 1.5",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand All @@ -137,7 +131,7 @@
"@type": "SoftwareApplication",
"identifier": "tibble",
"name": "tibble",
"version": ">= 3.1",
"version": ">= 3.2",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand All @@ -147,23 +141,10 @@
"sameAs": "https://CRAN.R-project.org/package=tibble"
},
"5": {
"@type": "SoftwareApplication",
"identifier": "pingr",
"name": "pingr",
"version": ">= 2.0",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=pingr"
},
"6": {
"@type": "SoftwareApplication",
"identifier": "readr",
"name": "readr",
"version": ">= 1.4",
"version": ">= 2.1",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand All @@ -172,11 +153,11 @@
},
"sameAs": "https://CRAN.R-project.org/package=readr"
},
"7": {
"6": {
"@type": "SoftwareApplication",
"identifier": "jsonlite",
"name": "jsonlite",
"version": ">= 1.7",
"version": ">= 1.8",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand All @@ -187,7 +168,7 @@
},
"SystemRequirements": null
},
"fileSize": "534.714KB",
"fileSize": "510.698KB",
"citation": [
{
"@type": "ScholarlyArticle",
Expand Down Expand Up @@ -216,10 +197,12 @@
}
],
"releaseNotes": "https://github.com/ropensci/hydroscoper/blob/master/NEWS.md",
"contIntegration": ["https://travis-ci.org/ropensci/hydroscoper", "https://ci.appveyor.com/project/ropensci/hydroscoper", "https://codecov.io/gh/ropensci/hydroscoper"],
"readme": "https://github.com/ropensci/hydroscoper/blob/master/README.md",
"contIntegration": ["https://github.com/ropensci/hydroscoper/actions", "https://app.codecov.io/gh/ropensci/hydroscoper"],
"review": {
"@type": "Review",
"url": "https://github.com/ropensci/software-review/issues/185",
"provider": "https://ropensci.org"
}
},
"keywords": ["climate", "hydroscope", "hydrometeorology", "hydrology", "tidy-data", "time-series", "greece", "water-resources", "meteorological-stations", "meteorological-data", "r", "rstats", "r-package", "peer-reviewed"]
}
18 changes: 9 additions & 9 deletions docs/404.html

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

Loading

0 comments on commit 5f92c0e

Please sign in to comment.