Skip to content

Correct slope calculation in clearsky.detect_clearsky#1242

Merged
wholmgren merged 4 commits into
pvlib:masterfrom
cwhanse:detect_clearsky_slope_calc
Jun 25, 2021
Merged

Correct slope calculation in clearsky.detect_clearsky#1242
wholmgren merged 4 commits into
pvlib:masterfrom
cwhanse:detect_clearsky_slope_calc

Conversation

@cwhanse

@cwhanse cwhanse commented Jun 4, 2021

Copy link
Copy Markdown
Member

Adds a test with time interval of 2 minutes.

@cwhanse cwhanse added the bug label Jun 4, 2021
@cwhanse cwhanse added this to the 0.9.0 milestone Jun 4, 2021

@kandersolar kandersolar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this bug affected 0.8.1 so this needs a whatsnew entry, right?

Comment thread pvlib/clearsky.py Outdated
def _slope_nstd_windowed(data, H, samples_per_window, sample_interval):
with np.errstate(divide='ignore', invalid='ignore'):
raw = np.diff(data)
raw = np.diff(data) / sample_interval

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow I failed to include this comment earlier: is raw here equivalent to data_slope.values[:-1]? If so there might be some modest speedup to be had by passing that in to avoid calculating slope twice.

@wholmgren

Copy link
Copy Markdown
Member

Thanks @cwhanse

@wholmgren wholmgren merged commit 8fe6a43 into pvlib:master Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Std. deviation of slope is calculated incorrectly for clearsky.detect_clearsky

3 participants