Closed KevCaz closed 3 years ago
BTW, on my fork all jobs are currently failing https://github.com/KevCaz/weathercan/actions/runs/796508465.
Looks like this is simply due to the fact that the database is currently unavailable! :smile: https://climate.weather.gc.ca/error/dbdown_e.html Sorry, I should have checked that first! I'll wait till it gets back and then I'll close this!
This makes me think that it could useful to add a simple function to check if data are available, something like:
check_status <- function() {
tmp <- httr::GET("https://climate.weather.gc.ca")
chk <- tmp$url == "https://climate.weather.gc.ca/error/dbdown_e.html"
if(chk) {
message("service is down!")
} else {
message("data are available.")
}
invisible(!chk)
}
just a thought.
That's a beautiful idea! I wasn't aware of the dbdown site, which makes it nice and easy to check! Would you be interested in submitting a pull request (matching the normals branch, since that's the one I'm just about to merge in for an upcoming update).
I'd be very grateful!
Sure :smiley: . I'll think a bit about where this feature would be the most useful in the package, and then I'll open a PR, soon (tomorrow or this week-end!).
Awesome! The packages is a bit messy, but in the normals branch (important to work on that one!), weather_html()
(weather.R), normals_html()
(normals.R), stations_dl_internal()
, and normals_stn_list()
(stations.R) are the four main access points for the ECCC. They all use the urls stored as options loaded by the .onLoad()
in weathercan-pkg.R
Even if you just want to get it started, I'm happy to finish it up if you're busy. I appreciate anything you have time for :)
Hi @steffilazerte,
Expected Behavior
Should return a data frame with desired data.
Current Behavior
Steps to Reproduce (for bugs)
weather.R
Possible Solution
A quick investigation of mine showed that
https://github.com/ropensci/weathercan/blob/fe13093ebcb51c916c8f1bf011874d12d67081ac/R/weather.R#L659
now returns a
NA
which I think explains the error return byread_tsv()
. When I changed this, thenhttps://github.com/ropensci/weathercan/blob/fe13093ebcb51c916c8f1bf011874d12d67081ac/R/weather.R#L661-L663
becomes a one colum data frame (instead of a 2 column one), so there might be more to this. Not sure why, I may investigate this further. Anyway, thanks for your job on this very useful package.
Context
Running some code that was previously working.
Your Environment
See below for my config, note that I was also able to reproduce this on another machine (MacOS 11.2.3 R 4.0.4).