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

Timestamps skip minutes after download #14

Closed
yannikbuhl opened this issue Feb 25, 2020 · 4 comments
Closed

Timestamps skip minutes after download #14

yannikbuhl opened this issue Feb 25, 2020 · 4 comments

Comments

@yannikbuhl
Copy link

yannikbuhl commented Feb 25, 2020

Hi there, I am using your great package for downloading wind data for a bunch of weather stations. Everything is working fine, however, the list output of dataDWD does only provide the time of the full hour. That means, the preciseness of the 10 minutes resolution is kind of lost for analysis. Am I doing something wrong? I checked the documentation of dataDWD and also the source code and could not find a clue as to wheter I have misspecified something. My output looks like this (the data type inside the list is double (S3: POSIXct, POSIXt).

res1[["10_minutes_wind_now_10minutenwerte_wind_00011_now_2"]][["MESS_DATUM"]]

"2020-02-25 00:00:00 GMT" 
"2020-02-25 00:00:00 GMT" 
"2020-02-25 00:00:00 GMT" 
"2020-02-25 00:00:00 GMT"
"2020-02-25 00:00:00 GMT" 
"2020-02-25 00:00:00 GMT" 
"2020-02-25 01:00:00 GMT" 
"2020-02-25 01:00:00 GMT"
"2020-02-25 01:00:00 GMT" 
"2020-02-25 01:00:00 GMT" 
"2020-02-25 01:00:00 GMT" 
"2020-02-25 01:00:00 GMT"
...

This is my code:

download <- selectDWD(id = 11, res = "10_minutes", outvec = TRUE, var = "wind", per = "now")
res1 <- dataDWD(file = download, dir = here::here("wetter"), force = TRUE, quiet = TRUE)

Of course, I could just add the minutes manually after downloading. But I first wanted to make sure there is no other way of doing so.

@brry
Copy link
Owner

brry commented Feb 25, 2020

Sounds like a bug on my side in readDWD, similar to #12.
I'll check it out and probably have a fix in the next few hours

@brry
Copy link
Owner

brry commented Feb 25, 2020

Hm, it works fine for me. I split up downloading and reading, but doing that in one step works fine as well.

url <- selectDWD(id=11, res="10_minutes", var="wind", per="now")
file <- dataDWD(url, dir=tempdir(), read=FALSE)
wind <- readDWD(file)
str(wind$MESS_DATUM)
# POSIXct[1:60], format: "2020-02-25 00:00:00" "2020-02-25 00:10:00" "2020-02-25 00:20:00" "2020-02-25 00:30:00" "2020-02-25 00:40:00" "2020-02-25 00:50:00" ...
head(wind$MESS_DATUM)
# "2020-02-25 00:00:00 GMT" "2020-02-25 00:10:00 GMT" "2020-02-25 00:20:00 GMT" "2020-02-25 00:30:00 GMT" "2020-02-25 00:40:00 GMT" "2020-02-25 00:50:00 GMT"

Does packageVersion("rdwd") return 1.3.1?

@brry
Copy link
Owner

brry commented Feb 25, 2020

The last rdwd version 1.2.0 (2019-10-28) up to one week ago on CRAN had exactly the error you have, so I assume it will be enough to run install.packages("rdwd") and re-run your code.

@yannikbuhl
Copy link
Author

Thank you so much! Yes, the package update did the trick. I had found the bug meanwhile in readDWD.data and now I can see the fix, (nch == 12) was missing.

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

No branches or pull requests

2 participants