R/get_pvol_dk.R

Defines functions get_pvol_dk

get_pvol_dk <- function(radar, time, ..., call = rlang::caller_env()) {
  req <- httr2::request(
    getOption(
      "getRad.dk_url",
      "https://dmigw.govcloud.dk/v1/radardata/download"
    )
  ) |>
    req_user_agent_getrad() |>
    httr2::req_url_path_append(
      glue::glue(getOption(
        "getRad.dk_file_format",
        "{radar}_{strftime(time,'%Y%m%d%H%M', tz='UTC')}.vol.h5"
      ))
    ) |>
    httr2::req_url_query(`api-key` = get_secret("dk_api_key")) |>
    httr2::req_perform(path = tempfile(fileext = ".h5"), error_call = call)
  pvol <- bioRad::read_pvolfile(req$body, ...)
  file.remove(req$body)
  return(pvol)
}

Try the getRad package in your browser

Any scripts or data that you put into this service are public.

getRad documentation built on Aug. 8, 2025, 7:20 p.m.