Skip to content

Correct condition 5 in detect_clearksy #596

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 11 commits into from
Oct 9, 2018
Merged

Conversation

cwhanse
Copy link
Member

@cwhanse cwhanse commented Oct 3, 2018

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:

  • Closes Correct condition 5 in clearsky.detect_clearsky #506
  • I am familiar with the contributing guidelines.
  • Fully tested. Added and/or modified tests to ensure correct behavior for all reasonable inputs. Tests (usually) must pass on the TravisCI and Appveyor testing services.
  • Updates entries to docs/sphinx/source/api.rst for API changes.
  • Adds description and name entries in the appropriate docs/sphinx/source/whatsnew file for all changes.
  • Code quality and style is sufficient. Passes LGTM and SticklerCI checks.
  • New code is fully documented. Includes sphinx/numpydoc compliant docstrings and comments in the code where necessary.
  • Pull request is nearly complete and ready for detailed review.

Brief description of the problem and proposed solution (if not already fully described in the issue linked to above):

Imports changes from @bhellis #510.

@cwhanse cwhanse changed the title Clearksy Correct condition 5 in detect_clearksy Oct 3, 2018
@cwhanse
Copy link
Member Author

cwhanse commented Oct 3, 2018

Ready for merge. I did not change the tests. The condition with the error (condition 5) is not the unique determining factor for clear or not clear for the test we have.

Perhaps we should create a set of tests that fail at different times for each condition, one at a time.

@wholmgren
Copy link
Member

Perhaps we should create a set of tests that fail at different times for each condition, one at a time.

That would be ideal. I prefer making that change as part of this PR to ensure that it's properly tested.

@pvlib pvlib deleted a comment from stickler-ci bot Oct 4, 2018
components['max_diff_array'] = np.abs(meas_max - alpha * clear_max)
components['line_length_array'] = meas_line_length - clear_line_length
components['slope_nstd_array'] = meas_slope_nstd
components['slope_max_array'] = (np.max(
Copy link
Member

Choose a reason for hiding this comment

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

maybe "values" instead of "array"?

Copy link
Member Author

Choose a reason for hiding this comment

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

_flag on the previous set of keys, removed _array here

Copy link
Member

Choose a reason for hiding this comment

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

I like the change, but it would break user code if people are calling return_components. Probably not likely to be a serious issue but we should think twice about doing this. In any case it should be listed as an API change.

Copy link
Member Author

Choose a reason for hiding this comment

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

what was meant by "values" instead of "array"? I'm ok reverting this change, but I thought you were requesting renaming the keys.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry for not being clear. I originally meant to suggest only slightly different names for the new keys that you've added. I was not suggesting renaming the existing keys. I thought "array" was an undesirable identifier because everything is an array here.

I do like the latest proposal, but we'd need to document it as an API change.

clear_slope_max = np.max(np.abs(clear_slope), axis=0)
clear_ghi_diff = np.diff(clearsky[H], n=1, axis=0)
clear_slope = np.diff(clearsky[H], n=1, axis=0) / sample_interval
# clear_slope_max = np.max(np.abs(clear_slope), axis=0)
Copy link
Member

Choose a reason for hiding this comment

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

delete this line

Copy link
Member Author

Choose a reason for hiding this comment

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

gone

# matlab std function normalizes by N-1, so set ddof=1 here
meas_slope_nstd = np.std(meas_slope, axis=0, ddof=1) / meas_mean
meas_slope_max = np.max(np.abs(meas_slope), axis=0)
# meas_slope_max = np.max(np.abs(meas_slope), axis=0)
Copy link
Member

Choose a reason for hiding this comment

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

delete this line

Copy link
Member Author

Choose a reason for hiding this comment

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

gone


# calculate measurement statistics
meas_mean = np.mean(measured[H], axis=0)
meas_max = np.max(measured[H], axis=0)
meas_slope = np.diff(measured[H], n=1, axis=0)
meas_ghi_diff = np.diff(measured[H], n=1, axis=0)
Copy link
Member

Choose a reason for hiding this comment

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

I prefer meas_diff to meas_ghi_diff. None of the other code in this function specifically refers to ghi.

Copy link
Member Author

Choose a reason for hiding this comment

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

done


# calculate clear sky statistics
clear_mean = np.mean(clearsky[H], axis=0)
clear_max = np.max(clearsky[H], axis=0)
clear_slope = np.diff(clearsky[H], n=1, axis=0)
clear_slope_max = np.max(np.abs(clear_slope), axis=0)
clear_ghi_diff = np.diff(clearsky[H], n=1, axis=0)
Copy link
Member

Choose a reason for hiding this comment

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

same comment as above re "ghi"

Copy link
Member Author

Choose a reason for hiding this comment

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

same action

@wholmgren wholmgren added the bug label Oct 4, 2018
@wholmgren wholmgren added this to the 0.6.1 milestone Oct 4, 2018
@mdeceglie
Copy link
Contributor

Thanks for advancing this @cwhanse and @wholmgren! I believe this will also close #507, depending on whether #507 is interpreted to include the handling of non-uniform time intervals or not.

@wholmgren
Copy link
Member

We can ignore the failing 2.7-min configuration as it's transitioned to pandas 0.15 in a few PRs.

@cwhanse
Copy link
Member Author

cwhanse commented Oct 9, 2018

Perhaps we should create a set of tests that fail at different times for each condition, one at a time.
That would be ideal. I prefer making that change as part of this PR to ensure that it's properly tested.

It is turning out to be rather challenging too cook up data that cause only one condition to fail but not others. How much do we care here about being less than ideal?

@wholmgren
Copy link
Member

It is turning out to be rather challenging too cook up data that cause only one condition to fail but not others. How much do we care here about being less than ideal?

I don't care enough to hold up this PR. Thanks for trying.

@cwhanse
Copy link
Member Author

cwhanse commented Oct 9, 2018

ready I think. cause of py27 failures appear to be addressed in #583

@wholmgren wholmgren merged commit ed3b018 into pvlib:master Oct 9, 2018
@wholmgren wholmgren mentioned this pull request Oct 10, 2018
8 tasks
@cwhanse cwhanse deleted the clearksy branch February 4, 2019 16:50
@cwhanse cwhanse mentioned this pull request Feb 24, 2020
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.

4 participants