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)
var | res | per | id | start | end | ismeta | path |
---|---|---|---|---|---|---|---|
soil | daily | historical | TRUE | soil/daily/historical/AMBAV.pdf | |||
soil | daily | historical | TRUE | soil/daily/historical/AMBETI.pdf | |||
soil | daily | historical | TRUE | soil/daily/historical/BESCHREIBUNG_derived_ermany_soil_daily_historical_de_v2.pdf | |||
soil | daily | historical | TRUE | soil/daily/historical/BESCHREIBUNG_derivgermany_soil_daily_historical_de.pdf | |||
soil | daily | historical | 1001 | FALSE | soil/daily/historical/derived_germany_soil_daily_historical_1001.txt.gz | ||
soil | daily | historical | 1048 | FALSE | soil/daily/historical/derived_germany_soil_daily_historical_1048.txt.gz |
## 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)