brry / rdwd

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

use https #40

Closed Nithador closed 1 year ago

Nithador commented 1 year ago

Hello, opendata.dwd.de seems to support also https, not just ftp. Would it be possible to add this possibility since https is much more supported and not restricted on more secure systems?

brry commented 1 year ago

That should generally be possible, as dataDWD simply uses download.file at the core, see: https://github.com/brry/rdwd/blob/master/R/dataDWD.R#L202

This example works fine on my machine:

library(rdwd)
link <- selectDWD("Potsdam","daily","kl","recent")
link <- sub("ftp://", "https://", link)
file <- dataDWD(link, force=TRUE)

I will look into automatic filenaming, which should only need an addition in line 168

Nithador commented 1 year ago

You are right!

I was mislead by the error message in line 222 However, this check actually happens after the download. Have not realise it at first as I was just quick glances at the code when trying to figure out whether FTP is enforced. I just happened to take it as yes..., but actually nothing is really restricting us to FTP.

Might be good to update that error message, to acknowledge that https is possible.

Anyway, thank for replying so soon! I will close the issue as the https actually works.

brry commented 1 year ago

Ah, I vaguely remembered that one - it only shows up if a download has failed, in this case for other reasons apperently. I have implemented the changes - thanks for pointing it out!