Closed essicolo closed 5 years ago
👋 @essicolo
It is going to be difficult to diagnose this without a reprex. As a first step what if you added traceback()
after the weathercan code?
I know, sorry about that. I tried several things but never could reproduce it out in isolation. Here is the output.
> mont_bellevue <- weather_dl(station_ids = c(5397, 48371),
+ start = "2019-02-01",
+ end = "2019-02-07",
+ interval = "hour",
+ verbose = TRUE)
Getting station: 5397
Formatting station data: 5397
Error in strptime(xx, f, tz = tz) : invalid 'tz' value
> traceback()
8: strptime(xx, f, tz = tz)
7: as.POSIXlt.character(x, tz, ...)
6: as.POSIXlt(x, tz, ...)
5: as.POSIXct(as.POSIXlt(x, tz, ...), tz, ...)
4: as.POSIXct.default(w$time, tz = tz)
3: as.POSIXct(w$time, tz = tz)
2: weather_format(w = w, preamble = preamble, stations = stations,
interval = interval, tz_disp = tz_disp, string_as = string_as,
quiet = quiet)
1: weather_dl(station_ids = c(5397, 48371), start = "2019-02-01",
end = "2019-02-07", interval = "hour", verbose = TRUE)
Very strange. I am not able to reproduce the bug using the same version of R. @steffilazerte might have some ideas. The offending line starts here:
However, on my machine the tz
is specified correctly. Ideally you'd be able to re-run with a debug so that you can step into the function. On my machine tz
here is "Etc/GMT+5".
reprex succeeded!
Errors happen when an object named stations
is created. The error message changes whether it's a data.frame or a scalar/vector/matrix.
> stations <- data.frame(A = 1)
>
> library("weathercan")
> mont_bellevue <- weather_dl(station_ids = c(5397, 48371),
+ start = "2019-02-01",
+ end = "2019-02-07",
+ interval = "hour",
+ verbose = TRUE)
Getting station: 5397
Formatting station data: 5397
Error in strptime(xx, f, tz = tz) : valeur 'tz' incorrecte
@essicolo Do you want to test using this branch?
devtools::install_github("ropensci/weathercan", ref = "ref_internal_data")
Ok, but here is another bug.
> library("weathercan")
> mont_bellevue <- weather_dl(station_ids = 48371,
+ start = "2019-02-01",
+ end = "2019-02-07",
+ interval = "hour",
+ verbose = TRUE)
Getting station: 48371
Formatting station data: 48371
Error in weather_format(w = w, preamble = preamble, stn = stn, interval = interval, :
argument inutilisé (stn = stn)
Okay, I pushed one more fix, I think this should do it :)
It did do it. 👍
Expected Behavior
Fetching weather using
weather_dl()
.Current Behavior
Steps to Reproduce (for bugs)
I'm doing a lot computations before getting the error. I tried several things and could not create a reproducible example.
Possible Solution
Imcompatibility with another package?
Context
I'm trying to build a gitbook with several chapters. A chapter including weathercan can be run alone, but the whole book (i.e. compiling previous chapters beforehand) throws the error.
Your Environment