-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Update detect_clearsky( ) #1708
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
base: main
Are you sure you want to change the base?
Conversation
from @cwhanse Co-authored-by: Cliff Hansen <[email protected]>
Would it be possible to run the |
Yes - just did this on my local machine. The old function takes 0.4933785000030184 seconds to run 10 times and the version in the PR takes 0.9015975999936927 seconds to do the same. |
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.
IMO the performance hit is worth the enhancement of handling missing timesteps.
2023-03-24 - This algorithm does accept data with skipped or missing | ||
timestamps. The DatetimeIndex (either times or index of measured) | ||
provided still must be regular, i.e. the length of intervals between | ||
points are equal except in the case that data is missing. | ||
""" | ||
|
||
if times is None: |
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.
I feel like this if
and try
should move down and use ispandas
, optional cleanup.
pvlib/clearsky.py
Outdated
# arrays of different lengths when evaluating comparison criteria and | ||
# when indexing the Hankel matrix to construct clear_samples | ||
elif len(clear_sky.index) != len(times): | ||
clear = pd.Series(clear_sky, index=times) |
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.
Untested, and I suspect this will fail - clear_sky
is a Series
of different length than times
so it can't get indexed by times
.
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.
Just added a test for this in test_clearsky.py
Changed clear_sky back to clearsky
pvlib/tools.py
Outdated
@@ -7,6 +7,7 @@ | |||
import pandas as pd | |||
import pytz | |||
import warnings | |||
from .conftest import DATA_DIR |
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.
This line should be test_tools
, that will fix the doc build error.
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.
Thanks @cwhanse !
Move import statement to test_tools.py pt1
Move import statement to test_tools.py pt2
docs/sphinx/source/reference
for API changes.docs/sphinx/source/whatsnew
for all changes. Includes link to the GitHub Issue with:issue:`num`
or this Pull Request with:pull:`num`
. Includes contributor name and/or GitHub username (link with:ghuser:`user`
).remote-data
) and Milestone are assigned to the Pull Request and linked Issue.Modified algorithm in detect_clearsky( ) to support missing timestamps (in a DatetimeIndex of evenly spaced intervals). Supporting functions were also modified to accommodate this change.