24 - use case: derived data

This needs rdwd >= 1.5.3 (2021-06-01)

https://opendata.dwd.de/climate_environment/CDC/derived_germany/soil/daily/historical/

dbase <- "ftp://opendata.dwd.de/climate_environment/CDC/derived_germany"
soilIndex <- indexFTP(folder="soil/daily", base=dbase)
soilIndex <- createIndex(soilIndex, base=dbase)

#  "res" and "var" are inverted in the derived_germany folder!
colnames(soilIndex)[1:2] <- c("var", "res")
# non-standard column order, but rdwd should always use names (not positions)

head(soilIndex)
varresperidstartendismetapath
soildailyhistoricalTRUEsoil/daily/historical/AMBAV.pdf
soildailyhistoricalTRUEsoil/daily/historical/AMBETI.pdf
soildailyhistoricalTRUEsoil/daily/historical/BESCHREIBUNG_derived_ermany_soil_daily_historical_de_v2.pdf
soildailyhistoricalTRUEsoil/daily/historical/BESCHREIBUNG_derivgermany_soil_daily_historical_de.pdf
soildailyhistorical1001FALSEsoil/daily/historical/derived_germany_soil_daily_historical_1001.txt.gz
soildailyhistorical1048FALSEsoil/daily/historical/derived_germany_soil_daily_historical_1048.txt.gz
summary(soilIndex$id)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##      44    1691    3379    3881    5349   19207      14
# select URL:
soil_link <- selectDWD("Potsdam", res="", var="", per="",
                       base=dbase, findex=soilIndex)
# Add monthly data:
soilIndexm <- indexFTP(folder="soil/monthly", base=dbase)
soilIndexm <- createIndex(soilIndexm, base=dbase)
soil_link <- c(soil_link, selectDWD("Potsdam", res="", var="", per="",
                                    base=dbase, findex=soilIndexm))

# download and read files:
soil_data <- dataDWD(soil_link, base=dbase)
# later reading runs are much faster because unzipping is already done :)

To get files for all stations, use the following:

dbase <- "ftp://opendata.dwd.de/climate_environment/CDC/derived_germany"
soil_index <- indexFTP(folder="soil/daily", base=dbase)
soil_index <- createIndex(soil_index, base=dbase)
soil_links <- selectDWD(res="soil", var="daily", per="r", base=dbase, findex=soil_index)
soil_data <- dataDWD(soil_links, base=dbase)