Skip to content

Commit

Permalink
data(obs_*)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimfalk committed Jun 22, 2024
1 parent 9bffaf8 commit aba4c89
Show file tree
Hide file tree
Showing 11 changed files with 295 additions and 4 deletions.
9 changes: 6 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
Package: HPBdata
Title: XXX
Title: Meteorological observations at 'Hohenpeißenberg' site (Bavaria, Germany)
Version: 0.1.0
Date: 2024-06-20
Date: 2024-06-22
Authors@R:
person("Dimitri", "Falk", , "[email protected]", role = c("aut", "cre"))
Description: YYY
Description: Historical quality-assured meteorological observation data at
various temporal resolutions, acquired from the Climate Data Center of the
German Weather Service. Data has been coverted to xts objects for further
applications in need of real meteorological measurements.
License: CC BY 4.0
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Expand Down
68 changes: 67 additions & 1 deletion R/data.R
Original file line number Diff line number Diff line change
@@ -1 +1,67 @@
""
#' Data: 1-minutely meteorological observations for 'Hohenpeißenberg' site (Bavaria, Germany)
#'
#' Historical observations of precipitation encompassing the period 1996-01-01 00:00 UTC to 2023-12-31 22:59 UTC \cr
#' Y = 47.8009° N; X = 11.0108° E; Z = 977 m a.s.l.
#'
#' @format A list of length 1 containing an xts object representing the following parameter:
#' \describe{
#' \item{RWH_RS_01}{xts object. Precipitation depth \code{[mm]}.}
#' }
#' @source <https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate/1_minute/>
#' @note Last access: 2024-06-22
#' @description <https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate/1_minute/precipitation/meta_data/>
#' @note License: CC BY 4.0
#' @note Copyright: Deutscher Wetterdienst 2024
"obs_1min"

#' Data: 10-minutely meteorological observations for 'Hohenpeißenberg' site (Bavaria, Germany)
#'
#' Historical observations of various parameters encompassing the period 1993-12-09 14:50 UTC to 2023-12-31 23:40 UTC \cr
#' Y = 47.8009° N; X = 11.0108° E; Z = 977 m a.s.l.
#'
#' @format A list of length 9 containing xts objects representing the following parameters:
#' \describe{
#' \item{PP_10}{xts object. Mean atmospheric pressure at station altitude \code{[hPa]}.}
#' \item{TT_10}{xts object. Mean air temperature at 2 m above ground \code{[°C]}.}
#' \item{TM5_10}{xts object. Mean air temperature at 5 cm above ground \code{[°C]}.}
#' \item{RF_10}{xts object. Mean relative humidity \code{[\%]}.}
#' \item{FF_10}{xts object. Mean wind velocity \code{[°C]}.}
#' \item{DD_10}{xts object. Mean wind direction \code{[°C]}.}
#' \item{GS_10}{xts object. Sum of global radiation \code{[J cm-2]}.}
#' \item{SD_10}{xts object. Sum of sunshine duration \code{[h]}.}
#' \item{RWS_10}{xts object. Precipitation depth \code{[mm]}.}
#' }
#' @source <https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate/10_minutes/>
#' @note Last access: 2024-06-21
#' @description c.f. 'DESCRIPTION_obsgermany_climate_10min_***_en.pdf' files at source.
#' @note License: CC BY 4.0
#' @note Copyright: Deutscher Wetterdienst 2024
"obs_10min"

#' Data: Daily meteorological observations for 'Hohenpeißenberg' site (Bavaria, Germany)
#'
#' Historical observations of various parameters encompassing the period 1781-01-01 to 2023-12-31 \cr
#' Y = 47.8009° N; X = 11.0108° E; Z = 977 m a.s.l.
#'
#' @format A list of length 13 containing xts objects representing the following parameters:
#' \describe{
#' \item{FX}{xts object. Maximum windgust \code{[m s-1]}.}
#' \item{FM}{xts object. Mean wind velocity \code{[m s-1]}.}
#' \item{RSK}{xts object. Precipitation depth \code{[mm]}.}
#' \item{SDK}{xts object. Sunshine duration \code{[h]}.}
#' \item{SHK_TAG}{xts object. Snow depth \code{[cm]}.}
#' \item{NM}{xts object. Mean cloud cover \code{[1/8]}.}
#' \item{VPM}{xts object. Mean vapor pressure \code{[hPa]}.}
#' \item{PM}{xts object. Mean atmospheric pressure at station altitude \code{[hPa]}.}
#' \item{TMK}{xts object. Mean air temperature at 2 m above ground \code{[°C]}.}
#' \item{UPM}{xts object. Mean relative humidity \code{[\%]}.}
#' \item{TXK}{xts object. Maximum air temperature at 2 m above ground \code{[°C]}.}
#' \item{TNK}{xts object. Minimum air temperature at 2 m above ground \code{[mm]}.}
#' \item{TGK}{xts object. Minimum air temperature at 5 cm above ground \code{[°C]}.}
#' }
#' @source <https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate/daily/kl/historical/>
#' @note Last access: 2024-06-21
#' @description <https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate/daily/kl/historical/DESCRIPTION_obsgermany_climate_daily_kl_historical_en.pdf>
#' @note License: CC BY 4.0
#' @note Copyright: Deutscher Wetterdienst 2024
"obs_1d"
48 changes: 48 additions & 0 deletions data-raw/obs_10min.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
## code to prepare `obs_10min` dataset goes here

library(timeseriesIO)
#> 0.7.80

obs_10min <- list()

dirs <- c("air_temperature",
"extreme_temperature",
"extreme_wind",
"precipitation",
"solar",
"wind")

# get all available data for defined station
for (dir_i in dirs) {

station <- get_cdc_stations(res = "10_minutes",
par = dir_i,
q = "historical") |> dplyr::filter(stations_id == "02290")

paste0("-------------------- ", dir_i, " --------------------") |> print()

timeseriesIO::dwn_cdc_data(station, sub = "1993/2024")

fnames <- list.files(pattern = "produkt_zehn_min_")

xtslist <- purrr::map(fnames, timeseriesIO::read_cdc_txt, station)

xtslist_merge <- timeseriesIO::xtslist_rbind_all(xtslist)

obs_10min <- append(obs_10min, xtslist_merge)

unlink(fnames)
}

# subset to pars
pars <- c("PP_10", "TT_10", "TM5_10", "RF_10", "FF_10", "DD_10", "GS_10", "SD_10", "RWS_10")

obs_10min <- obs_10min[pars]

# shift reference timestamps to the left side of the interval
obs_10min <- purrr::map(obs_10min, timeseriesIO::idx_shift, side = "left")

# subset to period
obs_10min <- timeseriesIO::xtslist_subset(obs_10min, "2020")

usethis::use_data(obs_10min, overwrite = TRUE)
25 changes: 25 additions & 0 deletions data-raw/obs_1d.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## code to prepare `obs_1d` dataset goes here

library(timeseriesIO)
#> 0.7.80

station <- get_cdc_stations(res = "daily",
par = "kl",
q = "historical") |> dplyr::filter(stations_id == "02290")

timeseriesIO::dwn_cdc_data(station, sub = "1781/2024")

list.files(pattern = "Metadaten_") |> unlink()

fname <- list.files(pattern = "produkt_klima_tag_")

obs_1d <- timeseriesIO::read_cdc_txt(fname, station)

unlink(fname)

# subset to pars
pars <- c("FX", "FM", "RSK", "SDK", "SHK_TAG", "NM", "VPM", "PM", "TMK", "UPM", "TXK", "TNK", "TGK")

obs_1d <- obs_1d[pars]

usethis::use_data(obs_1d, overwrite = TRUE)
30 changes: 30 additions & 0 deletions data-raw/obs_1min.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## code to prepare `obs_1min` dataset goes here

library(timeseriesIO)
#> 0.7.80

station <- get_cdc_stations(res = "1_minute",
par = "precipitation",
q = "historical") |> dplyr::filter(stations_id == "02290")

timeseriesIO::dwn_cdc_data(station, sub = "1996/2023")

fnames <- list.files(pattern = "produkt_ein_min_")

xtslist <- purrr::map(fnames, timeseriesIO::read_cdc_txt, station)

unlink(fnames)

obs_list <- timeseriesIO::xtslist_rbind_all(xtslist)

obs_1min <- rbind(obs_list[["RWH_01"]]["1994-07-01/2008-10-14"] |> xts_trim_na(),
obs_list[["RS_01"]]["2008-10-14/2024-06-21"] |> xts_trim_na()) |>
xts_inflate(unit = "1 min", fill = 0) |> list("RWH_RS_01" = _)

# shift reference timestamps to the left side of the interval
obs_1min[["RWH_RS_01"]] <- obs_1min[["RWH_RS_01"]] |> timeseriesIO::idx_shift("left")

# subset to period
obs_1min <- timeseriesIO::xtslist_subset(obs_1min, "1996/2023")

usethis::use_data(obs_1min, overwrite = TRUE)
Binary file added data/obs_10min.rda
Binary file not shown.
Binary file added data/obs_1d.rda
Binary file not shown.
Binary file added data/obs_1min.rda
Binary file not shown.
41 changes: 41 additions & 0 deletions man/obs_10min.Rd

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

45 changes: 45 additions & 0 deletions man/obs_1d.Rd

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

33 changes: 33 additions & 0 deletions man/obs_1min.Rd

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

0 comments on commit aba4c89

Please sign in to comment.