-
Notifications
You must be signed in to change notification settings - Fork 998
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
NonExistentTimeError
when calling hour_angle
#2132
Comments
Confirmed the issue with pvlib v0.11.0. The discussion around the pandas issue suggests this occurs when DST adjustment occurs in a way that midnight local never "happens". Short of a worldwide deprecation of daylight savings times, or handling of this case by |
@scttnlsn re-reading my comment, I don't think I was very clear: PR welcome along the lines you propose. |
@cwhanse Sounds good - I'll put something together |
@scttnlsn don't hesitate to reach out if you need help getting started with GitHub or the likes 😄 |
@AdamRJensen There's a PR open here: #2133 Let me know if anything needs more attention before merging. |
Describe the bug
Cannot compute
hour_angle
in timezones and on a day where a daylight savings transition happens at midnight.To Reproduce
The call to
times.normalize()
insidehour_angle
raises an exception:Expected behavior
I'm not entirely sure. Pandas'
tz_localize
includes arguments for handling these sort of situations (https://pandas.pydata.org/docs/reference/api/pandas.Series.dt.tz_localize.html) and I suspect we could normalize the times like this:This would normalize the times to 1:00am instead of 12:00am (which didn't exist on that date). Here's some related discussion from a Pandas issue: pandas-dev/pandas#40517
I suspect we'd need to similarly handle ambiguous times when daylight savings ends.
Does this seem like a reasonable approach? I can put a small PR together if so.
Versions:
pvlib.__version__
: 0.10.5pandas.__version__
: 2.2.2The text was updated successfully, but these errors were encountered: