Closed jlprol closed 4 years ago
Actually it can be easily fixed by just getting the UTC version and defining the timezone in the call itself (or later), e.g.
as.xts(getEIA(key = key, ID = "EBA.CAL-ALL.D.H"), tz = "UTC")
for UTC
or
as.xts(getEIA(key = key, ID = "EBA.CAL-ALL.D.H"), tz = "America/Los_Angeles")
for the corresponding local time.
Thank you for posting the issue and the workaround. I can replicate them, and will start a new branch to work on a fix.
I think I have it (mostly) fixed. Now it should detect whether the hourly series is in UTC or local time and behave accordingly. If it is local time it tries to establish the time zone via the UTC offset. If it cant determine the time zone it converts to GMT and returns a message. I have tested everything except the case when it can't find a time zone.
If you get a chance, you can test the changes with:
library(githubinstall)
gh_install_packages("EIAdata", ref = "issue_11_tz_fix")
Thanks again!
I merged the issue_11_tz_fix
branch into master, and it is included in release v0.1.0.
Thanks for identifying the issue! Have a great day.
When running
getEIA(key = key, ID = "EBA.CAL-ALL.D.HL")
(California demand local time) I getAnd all the datetime indexes of the resulting xts object are the same:
A similar behaviour happens with the UTC version
getEIA(key = key, ID = "EBA.CAL-ALL.D.H")
In this case the datetime indexes of the xts are not the same for all observations, but are different from the actual dates. The datetime of the first observation ishould be 20150701T05Z ( see here: https://www.eia.gov/opendata/qb.php?category=3389936&sdid=EBA.CAL-ALL.D.H) but instead I get:
When I check the
timezone()
of the xts object I only get""
Thank you.