Learn R Programming

rdwd (version 1.8.0)

fileType: determine DWD file type

Description

determine which subfunction to call in readDWD() from the file extension (ext).

The first block is for observational data (overview), the second for gridded data (overview).
Click on the type for the subfunction documentation, e.g. data for readDWD.data().

typeextnotes
data.zipFor regular data at dwdbase.
meta.txtFor Beschreibung.txt files. For zip files containing station meta information, see readMeta().
multia[SO][SO]: file ends with "Standort.txt" or contains multi_annual. Overrides meta.
stand[SF][SF]: file contains "standard_format". For subdaily/standard_format files.
data.txt.gzFor data at /CDC/derived_germany/.
pdf.pdfonly opens file in default viewer.
-------
radar.gzFor when the file contains a single binary file.
binary.tar.gzThe common radolan format, as far as I can tell.
raster.asc.gzE.g. for seasonal data at gridbase.
nc.nc.gzFor netcdf files.
asc.tarFor a file containing asc files.
rklimYW*.tarFor a file containing bin files.
grib2.grib2.bz2For an nwp forecast file.

Usage

fileType(file)

Value

Character (vector)

Arguments

file

Filename(s) with extension.

Author

Berry Boessenkool, berry-b@gmx.de, Jul 2020

See Also

readDWD()

Examples

Run this code
ft <- read.table(header=TRUE, stringsAsFactors=FALSE, text="
type    filename
data    daily_kl_recent_tageswerte_KL_03987_akt.zip
meta    daily_kl_recent_KL_Tageswerte_Beschreibung_Stationen.txt
multia  multi_annual_mean_81-10_Temperatur_1981-2010_aktStandort.txt
multia  multi_annual_mean_81-10_Temperatur_1981-2010.txt
stand   subdaily_standard_format_kl_10381_00_akt.txt
deriv   derived_germany_soil_daily_historical_3987.txt.gz
pdf     DESCRIPTION_obsgermany_climate_monthly_kl_historical_en.pdf

radar   radolan_recent_bin_raa01-rw_10000-1802020250-dwd---bin.gz
binary  daily_radolan_historical_bin_2017_SF201712.tar.gz
raster  16_DJF_grids_germany_seasonal_air_temp_mean_188216.asc.gz
nc      daily_Project_TRY_humidity_RH_199509_daymean.nc.gz
asc     radolan_historical_asc_2018_RW-201809.tar
rklim   5_minutes_radolan_reproc_2017_002_bin_2020_YW2017.002_202006.tar
grib2   ftp_weather_nwp_cosmo-d2_005_T_2M.grib2.bz2
")
fileType(ft$filename)

stopifnot(fileType(ft$filename)==ft$type)
berryFunctions::is.error(fileType("random_stuff.odt"), force=TRUE)

stopifnot(validFileTypes %in% ft$type)
stopifnot(ft$type %in% validFileTypes)

Run the code above in your browser using DataLab