diff --git a/DESCRIPTION b/DESCRIPTION index 44bb067..4af2969 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,12 +2,12 @@ Package: gsdata Type: Package Title: Interface to the GeoSphere Austria DataHub API (Data Access) Version: 0.0-7 -Date: 2024-01-27 +Date: 2024-08-23 Authors@R: person(given = "Reto", family = "Stauffer", role = c("aut", "cre"), email = "reto.stauffer@uibk.ac.at", comment = c(ORCID = "0000-0002-3798-5507")) Maintainer: Reto Stauffer -Depends: httr, zoo, sf, parsedate +Depends: httr, zoo, sf, parsedate, dplyr Suggests: utils, ncdf4, stars, knitr, rmarkdown, tinytest Description: Package to download data from the GeoSphere data hub (Austrian National Weather Service) which is the data provider. Currently solely allows to download station data (no gridded data). More details about the data sets can be found on as well as in the API documentation available via . License: GPL-2 diff --git a/NAMESPACE b/NAMESPACE index bd1e155..4ed6b7b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -6,6 +6,7 @@ export(gs_datasets) export(gs_metadata) export(gs_stationdata) export(gs_temporal_interval) +importFrom(dplyr,bind_rows) importFrom(httr,GET) importFrom(httr,content) importFrom(httr,http_status) diff --git a/NEWS.md b/NEWS.md index 3f2878f..9063e3f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,9 +1,15 @@ +# gsdata 0.0-8 + +* Appending `dplyr` as dependency, used internally to bind lists + of elements to `data.frame`s which can contain different elements and `NULL`s. +* Updating `gs_metdata()` to address an issue when loading meta + information for `historical`, `klima-v2-1d`. + # gsdata 0.0-7 * Fixed a series of small issues * Refactored internals -* First CRAN release; currently limited to station data (will be extended to gridded data) # gsdata 0.0-6 diff --git a/R/metadata.R b/R/metadata.R index b68c62a..088e28e 100644 --- a/R/metadata.R +++ b/R/metadata.R @@ -55,6 +55,7 @@ #' @author Reto Stauffer #' @export #' @importFrom sf st_as_sf +#' @importFrom dplyr bind_rows #' @importFrom parsedate parse_iso_8601 gs_metadata <- function(mode, resource_id, type = NULL, version = 1L, config = list(), expert = FALSE, verbose = FALSE) { @@ -114,9 +115,8 @@ gs_metadata <- function(mode, resource_id, type = NULL, version = 1L, config = l config = config, query = NULL, verbose = verbose) # Evaluate result - res$parameters <- do.call(rbind, lapply(res$parameters, as.data.frame)) - res$stations <- do.call(rbind, lapply(res$stations, - function(x) as.data.frame(lapply(x, function(x) ifelse(is.null(x), NA, x))))) + for (n in c("parameters", "stations")) + res[[n]] <- as.data.frame(bind_rows(res[[n]])) # Double-check if my format specification below is OK stopifnot("unexpected time format" = all(grepl("\\+00:00$", res$stations$valid_from)))