Description Usage Arguments Details Value Author(s) Examples
Part of the automation process. This function checks the opendata
server for available files and checks whether this specific forecast
has alreday been processed (checking for existing ASCII files on
the local disc; uses the naming rules of write_ascii
!).
1 | get_files_available(type = "L", stn = NULL, outdir = "DWDMOS")
|
type |
either |
stn |
|
outdir |
name of the output directory where the already-processed
forecasts are stored (see |
The DWD provides two sets of MOSMIX forecasts labeled as L
and S
. L
-forecasts are available four times a day and XML files
for individual stations are available on the opendata server. S
-forecasts
become available 24 times a day and only one XML file is avialable on the
opendata server containing the forecasts for all stations (few thousand stations).
TODO: requires more detailed description.
Returns a data.frame
with initialization times (IssueTime),
name of the XML file plus the full URL, local file name, and a check whether
or not a file has been processed already.
Reto Stauffer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # 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)
# And extract required datetime and meta information.
doc <- XML::xmlParse(kml)
datetime <- get_datetime(doc)
meta <- get_meta_info(doc)
stations <- get_station_information(doc)
# Extracting forecasts now
fcst <- get_forecasts("11120", doc, datetime, meta)
write_ascii(fcst, dir = ".")
write_ascii(fcst, file = "foo.dat", dir = ".")
# Remove kmz and kml file
file.remove(kmz, kml)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.