Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for RCurl/SSL error #33

Open
blairlo opened this issue Jul 28, 2021 · 0 comments
Open

Fix for RCurl/SSL error #33

blairlo opened this issue Jul 28, 2021 · 0 comments

Comments

@blairlo
Copy link

blairlo commented Jul 28, 2021

Hi, thanks for developing this package!

I was having the same problem as issue #31. It appears that the (now defunct?) RCurl call in your find_file_name function was throwing an ssl error in the dependent find_events function. Replacing with the curl/readlines seems to fix the problem. Below is the code I've substituted for the original. Feel free to use the appended function :

require(curl)

find_file_name2 <- function (year = NULL, file_type = "details")
{
url <- paste0("https://www1.ncdc.noaa.gov/pub/data/swdi/",
"stormevents/csvfiles/")
page<-readLines(curl(url)) #replace RCurl call with curl
all_file_names <- XML::getHTMLLinks(page)
file_year <- paste0("d", year, "")
file_name <- grep(file_type, grep(file_year, all_file_names,
value = TRUE), value = TRUE)
if (length(file_name) == 0) {
stop("No file found for that year and / or file type.")
}
return(file_name)
}

assignInNamespace("find_file_name", find_file_name2, ns="noaastormevents")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant