
Returns data of the Tecson meteo station placed at Tiefenbrunnen and Mythenquai water police station.
Source:R/read-seepolizei.R
get_seepolizei.Rd
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
Examples
get_seepolizei(as.Date("2020-03-01"), lubridate::dmy("02.03.2020"))
#> Warning: There was 1 warning in `dplyr::mutate()`.
#> ℹ In argument: `starttime = lubridate::dmy_hms(.data$starttime, tz = "CET")`.
#> Caused by warning:
#> ! All formats failed to parse. No formats found.
#> # A tibble: 1,872 × 6
#> starttime site parameter interval unit value
#> <dttm> <fct> <fct> <fct> <fct> <dbl>
#> 1 NA tiefenbrunnen air_temperature min10 °C 6.5
#> 2 NA tiefenbrunnen air_temperature min10 °C 6.5
#> 3 NA tiefenbrunnen air_temperature min10 °C 6.4
#> 4 NA tiefenbrunnen air_temperature min10 °C 6.1
#> 5 NA tiefenbrunnen air_temperature min10 °C 6
#> 6 NA tiefenbrunnen air_temperature min10 °C 6
#> 7 NA tiefenbrunnen air_temperature min10 °C 6
#> 8 NA tiefenbrunnen air_temperature min10 °C 5.9
#> 9 NA tiefenbrunnen air_temperature min10 °C 6
#> 10 NA tiefenbrunnen air_temperature min10 °C 6.1
#> # ℹ 1,862 more rows
data <- get_seepolizei("2020-03-20", "2020-03-22", "mythenquai")
#> Warning: There was 1 warning in `dplyr::mutate()`.
#> ℹ In argument: `starttime = lubridate::dmy_hms(.data$starttime, tz = "CET")`.
#> Caused by warning:
#> ! All formats failed to parse. No formats found.
# 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
#> # A tibble: 3,744 × 6
#> starttime site parameter interval unit value
#> <dttm> <fct> <fct> <fct> <fct> <dbl>
#> 1 NA ZH_Mythenquai T min10 °C 10
#> 2 NA ZH_Mythenquai T min10 °C 9.9
#> 3 NA ZH_Mythenquai T min10 °C 10
#> 4 NA ZH_Mythenquai T min10 °C 9.9
#> 5 NA ZH_Mythenquai T min10 °C 9.8
#> 6 NA ZH_Mythenquai T min10 °C 9.8
#> 7 NA ZH_Mythenquai T min10 °C 9.7
#> 8 NA ZH_Mythenquai T min10 °C 9.6
#> 9 NA ZH_Mythenquai T min10 °C 9.5
#> 10 NA ZH_Mythenquai T min10 °C 9.3
#> # ℹ 3,734 more rows