brry / rdwd

download climate data from DWD (German Weather Service)
https://bookdown.org/brry/rdwd
70 stars 12 forks source link

properly vectorize selectDWD in expansive mode #36

Closed NandhiniS08 closed 2 years ago

brry commented 2 years ago

Does this help?

You should get far with rdwd::updateRdwd

NandhiniS08 commented 2 years ago

Is there a straightfwd way to download air_temperature 10 minute value for the past 5 years directly for all stations?

brry commented 2 years ago

Yes, adapt the example from the Readme. To use the package efficiently, please read the website with some use cases and the individual function documentations

brry commented 2 years ago

Note that selectDWD ist vectorized and you will have to download the full data sets. Definitely have good folder management to avoid duplicate downloads.

NandhiniS08 commented 2 years ago

Thanks a lot! that was helpful Is it also possible to extract all the data from hourly and daily for a given station id?

brry commented 2 years ago

Yes, case 2 in the documentation of selectDWD:
2 | | "xx" | | "" | | All file names (across paths) for station id
For case 2, you can explicitly set res="",var="",per="" to avoid the default interactive selection.

NandhiniS08 commented 2 years ago

I tried this selectDWD(id = 5906, res=c("hourly","daily"), per="h",var = ""). But it gives the subdaily and other resolutions as well

brry commented 2 years ago

That seems like a bug in selectDWD. Will investigate.

brry commented 2 years ago

This one will be somewhat hard to resolve. Properly vectorizing selectDWD is on my list, see https://github.com/brry/rdwd/issues/33.
For now, use this workaround:

library(rdwd)
data("fileIndex")
fileIndex <- fileIndex[fileIndex$id==5906 &
                       fileIndex$res %in% c("hourly","daily") &
                       fileIndex$per=="historical",]
fileIndex <- na.omit(fileIndex)
fileIndex$path # pass this to dataDWD
brry commented 2 years ago

The selectDWDbehaviour is now as you expected. Please run rdwd::updateRdwd() to get the new version. Please report any problems you might run into :)