get_datetime: Extract DWD MOSMIX Datetime Information

Description Usage Arguments Value Author(s) See Also Examples

Description

Extracts the date and time information for which the forecasts will be valid.

Usage

1

Arguments

doc

an XMLInternalDocument object as returned by xmlParse (XML package).

Value

Returns a vector of POSIXt time stamps.

Author(s)

Reto Stauffer

See Also

get_station_information, get_meta_info, get_datetime.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Latest L-type DWD MOSMIX forecast file for Innsbruck Airport
url <- "https://opendata.dwd.de/weather/local_forecasts/mos/MOSMIX_L/single_stations/11120/kml/MOSMIX_L_LATEST_11120.kmz"

# Download and extract file
kmz   <- tempfile("mosmix_demo_", fileext = ".kmz")
check <- download.file(url, kmz)
if ( inherits(check, "try-error") ) stop("Problems downloading the file!")
kml   <- unzip(kmz)

# Parsing the unzipped kml file (XML format)
doc <- XML::xmlParse(kml)

# Extracting date and time information.
datetime <- get_datetime(doc)
print(datetime)

# Remove kmz and kml file
file.remove(kmz, kml)

retostauffer/Rmosmix documentation built on May 22, 2019, 2:45 p.m.