Skip to content

Commit

Permalink
fix: Fix in gs_metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
retostauffer committed Aug 23, 2024
1 parent c521330 commit a89697f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]",
comment = c(ORCID = "0000-0002-3798-5507"))
Maintainer: Reto Stauffer <[email protected]>
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 <https://data.hub.geosphere.at/> as well as in the API documentation available via <https://dataset.api.hub.geosphere.at/v1/docs/>.
License: GPL-2
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 3 additions & 3 deletions R/metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down Expand Up @@ -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)))
Expand Down

0 comments on commit a89697f

Please sign in to comment.