-
Notifications
You must be signed in to change notification settings - Fork 1.1k
sunrise and sunset from pyephem #588
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
Conversation
pvlib/solarposition.py
Outdated
@@ -453,6 +471,63 @@ def _ephem_setup(latitude, longitude, altitude, pressure, temperature): | |||
return obs, sun | |||
|
|||
|
|||
def ephem_next_rise_set(time, latitude, longitude, altitude=0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would next_sun_rise_set_pyephem
be more consistent with your preferred naming scheme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'll change. I have in mind Location.get_next_sunrise
, Location.get_previous_sunrise
as wrapper methods.
pvlib/test/test_solarposition.py
Outdated
result_rounded = pd.DataFrame(index=result.index) | ||
# need to iterate because to_datetime does not accept 2D data | ||
# the rounding fails on pandas < 0.17 | ||
for col, data in result.iteritems(): | ||
result_rounded[col] = (pd.to_datetime( | ||
np.floor(data.values.astype(np.int64) / 1e9)*1e9, utc=True) | ||
np.floor(data.values.astype(np.int64) / 60e9)*60e9, utc=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E226 missing whitespace around arithmetic operator
pvlib/test/test_solarposition.py
Outdated
result_rounded = pd.DataFrame(index=result.index) | ||
for col, data in result.iteritems(): | ||
result_rounded[col] = (pd.to_datetime( | ||
np.floor(data.values.astype(np.int64) / 60e9)*60e9, utc=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E226 missing whitespace around arithmetic operator
pvlib/test/test_solarposition.py
Outdated
]).tz_localize('MST').tolist() | ||
transit = pd.DatetimeIndex([datetime.datetime(2015, 1, 2, 12, 5, 0), | ||
datetime.datetime(2015, 8, 2, 12, 7, 0) | ||
]).tz_localize('MST').tolist() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E124 closing bracket does not match visual indentation
pvlib/test/test_solarposition.py
Outdated
result_rounded = pd.DataFrame(index=result.index) | ||
for col, data in result.iteritems(): | ||
result_rounded[col] = data.dt.round('min').tz_convert('MST') | ||
del expected_rise_set('transit') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E999 SyntaxError: can't delete function call
Sigh. |
Fixed the timezone behavior. Ready for review/approve/merge. |
Looks good to me. You can resolve the merge conflict locally or in the web interface (click resolve conflicts and then delete the >>> --- <<< cruft). Usually github will automatically take the union of this file. Not sure why it's not working this time. |
I went ahead and resolved the conflict. Merging... |
pvlib python pull request guidelines
Thank you for your contribution to pvlib python! You may delete all of these instructions except for the list below.
You may submit a pull request with your code at any stage of completion.
The following items must be addressed before the code can be merged. Please don't hesitate to ask for help if you're unsure of how to accomplish any of the items below:
docs/sphinx/source/api.rst
for API changes.docs/sphinx/source/whatsnew
file for all changes.Brief description of the problem and proposed solution (if not already fully described in the issue linked to above):