-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Refactor detect_clearsky #1074
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
Merged
Merged
Refactor detect_clearsky #1074
Changes from all commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
5c94c64
refactor detect_clearsky
cwhanse af9a314
formatting
cwhanse ea5021f
make array input work
cwhanse 2a5cdeb
lint, make clearsky a Series
cwhanse 6f39e6b
make work for py36min
cwhanse 153c7fd
update arguments in call
cwhanse 8e719ae
fit another diff
cwhanse d680f77
fix ddof, add test for _calc_stats with window=3
cwhanse c5a15b9
actually add test for _calc_stats with window=3
cwhanse c16eed5
add test__calc_c5, simplify _calc_c5
cwhanse a14eb2c
really add test__calc_c5 this time
cwhanse 84cb165
fix _calc_c5, use shift
cwhanse e4cf350
fix test__calc_stats
cwhanse f1ae2d4
remove align from public function kwargs
cwhanse 1e390c9
fiddly window and shifting
cwhanse 0eff949
Merge branch 'master' of https://github.com/pvlib/pvlib-python into d…
cwhanse d39218a
fix _calc_c5
cwhanse 86c4e79
can now label points at the end of the time series
cwhanse ace81cf
fix formatting
cwhanse ffc7fac
only labels end of data if window is short enough
cwhanse 25c9c8b
improve coverage
cwhanse 62a3775
Merge branch 'master' of https://github.com/pvlib/pvlib-python into d…
cwhanse ce4abbb
add to whatsnew
cwhanse a071471
edits from partial review
cwhanse 4e4eeb5
remove unused function
cwhanse 6ed9838
Merge branch 'master' of https://github.com/pvlib/pvlib-python into d…
cwhanse bf061dc
Merge branch 'master' of https://github.com/pvlib/pvlib-python into d…
cwhanse 6e6af32
put test for equal time steps back
cwhanse a592d25
make times optional
cwhanse f2c5e8e
make times optional
cwhanse 352212b
undo redundant raise, use total_seconds()
cwhanse 74e1e54
formatting
cwhanse 055a7c3
go back to seconds
cwhanse aa3b2ac
Merge branch 'master' of https://github.com/pvlib/pvlib-python into d…
cwhanse f7dadbb
remove array inputs
cwhanse 282f374
Revert "remove array inputs"
cwhanse 5e9e186
Merge branch 'master' of https://github.com/pvlib/pvlib-python into d…
cwhanse 56950de
changes from review: drop tail, edit whatsnew, add comments to detect…
cwhanse 5425ad3
revert change to detect_clearsky output
cwhanse 098edeb
update function name
cwhanse 47ccf0e
factor line length into helper for performance
cwhanse 5927d73
fix test__calc_line_length_windowed
cwhanse 55453d7
add benchmarks/detect_clearsky.py
wholmgren 1d16a31
fix mistakes
wholmgren 77d899d
Merge pull request #6 from wholmgren/1074asv
cwhanse f5ffda3
work around pd.rolling.apply, drop align options
cwhanse f0d9b39
Merge branch 'detect_clearsky' of https://github.com/cwhanse/pvlib-py…
cwhanse 8702a1c
remove mistaken .values
cwhanse 608c1d4
add test for new _windowed_stat function
cwhanse 9387067
patch up test__calc_stats
cwhanse c3c1f9e
add mode kwarg for np.pad
cwhanse e041171
replace windowed stats calculations
cwhanse 7c7b4b2
add tests for new windowed functions
cwhanse 20130d8
uncomplicate tests, remove align options
cwhanse 9d64abe
move common data to fixture
cwhanse 0eda545
index correctly
cwhanse 4eb70e1
correct cut/paste/delete errors
cwhanse 983bd6f
proofread it next time
cwhanse bdee2ce
replace roller with numpy
cwhanse 26e36a2
try this dimensioning
cwhanse 05d8bc1
try numpy arrays instead
cwhanse 5b4e441
remove unneeded conversion to Series
cwhanse e53572d
Revert "remove unneeded conversion to Series"
cwhanse ea82348
param ndays in benchmark
wholmgren 970227d
Line formatting
cwhanse 79a329c
More line formatting
cwhanse 7af5f55
Remove unneeded declaration
cwhanse be1829b
fix test error, .all -> .any
cwhanse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
""" | ||
ASV benchmarks for detect clear sky function. | ||
""" | ||
|
||
import pandas as pd | ||
from pvlib import clearsky, solarposition | ||
import numpy as np | ||
|
||
|
||
class DetectClear: | ||
params = [1, 10, 100] # number of days | ||
param_names = ['ndays'] | ||
|
||
def setup(self, ndays): | ||
self.times = pd.date_range(start='20180601', freq='1min', | ||
periods=1440*ndays) | ||
self.lat = 35.1 | ||
self.lon = -106.6 | ||
self.solar_position = solarposition.get_solarposition( | ||
self.times, self.lat, self.lon) | ||
clearsky_df = clearsky.simplified_solis( | ||
self.solar_position['apparent_elevation']) | ||
self.clearsky = clearsky_df['ghi'] | ||
measured_dni = clearsky_df['dni'].where( | ||
(self.times.hour % 2).astype(bool), 0) | ||
cos_zen = np.cos(np.deg2rad(self.solar_position['apparent_zenith'])) | ||
self.measured = measured_dni * cos_zen + clearsky_df['dhi'] | ||
self.measured *= 0.98 | ||
self.window_length = 10 | ||
|
||
def time_detect_clearsky(self, ndays): | ||
clearsky.detect_clearsky( | ||
self.measured, self.clearsky, self.times, self.window_length | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.