get_seepolizei: Returns data of the Tecson meteo station placed at...

View source: R/read-seepolizei.R

get_seepolizeiR Documentation

Returns data of the Tecson meteo station placed at Tiefenbrunnen and Mythenquai water police station.

Description

get_seepolizei() uses the Tecdottir API from Stefan Oderholz. read_seepolizei_json() parses the response of the API.

Usage

get_seepolizei(
  start,
  end,
  site = c("tiefenbrunnen", "mythenquai"),
  tz = "Etc/GMT-1"
)

read_seepolizei_json(txt, tz = "Etc/GMT-1")

Arguments

start

The start date after which the measurements should be returned. As string in format yyyy-mm-dd or as POSIXct, POSIXlt or Date

end

The end date before which the measurements should be returned. As string in format yyyy-mm-dd or as POSIXct, POSIXlt or Date

site

The site of which the values should be returned. Valid values are "mythenquai" and "tiefenbrunnen"

tz

Output time zone. The response content is in CET. Default "Etc/GMT-1"

txt

a JSON string, URL or file

Value

tibble in rolf format

Examples

get_seepolizei(as.Date("2020-03-01"), lubridate::dmy("02.03.2020"))


data <- get_seepolizei("2020-03-20", "2020-03-22", "mythenquai")

# normalize data with meta informations
meta_data <- readRDS(rOstluft.data::f("meta_seepolizei.rds"))

# rename station
data <- meta_apply(
  data = data,
  meta = meta_data,
  data_src = "site",
  data_dest = "site",
  meta_key = "site_short",
  meta_val = "site",
  mode = "strict"
)

# rename parameters to Ostluft Conventions
data <- meta_apply(
  data = data,
  meta = meta_data,
  data_src = "parameter",
  data_dest = "parameter",
  meta_key = "parameter_original",
  meta_val = "parameter",
  mode = "strict"
)

# show normalized data
data

Ostluft/rOstluft documentation built on Feb. 6, 2024, 1:26 a.m.