-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix crash in ModelChain.infer_spectral_model due to incorrect method call (2) #629
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
| return system | ||
|
|
||
|
|
||
| @pytest.fixture |
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.
F811 redefinition of unused 'sam_data' from line 22
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.
Same as lines 26, 40... I think this is a linter 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.
agree
| module = 'Canadian_Solar_CS5P_220M' | ||
| module_parameters = sam_data['cecmod'][module].copy() | ||
| inverters = sam_data['cecinverter'] | ||
| inverter = inverters['ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_'].copy() |
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.
E501 line too long (80 > 79 characters)
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.
Same as lines 32, 49... (which I copied). Should I change ?
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.
By the way you may be interested by black to definitively get rid of formatting problems.
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.
Fine with me to leave this because I'd like to refactor all of these fixtures.
Thanks for the tip.
|
Travis error seems strange to me (only for Python3.6) : Lack of "require_scipy" on a test ? Tests pass on my computer under Python3.6.7. |
wholmgren
left a comment
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.
Looks good, but please add your name and/or username to the Contributors list at the bottom of the whatsnew file.
The test failure is unrelated and can be ignored.
| return system | ||
|
|
||
|
|
||
| @pytest.fixture |
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.
agree
| module = 'Canadian_Solar_CS5P_220M' | ||
| module_parameters = sam_data['cecmod'][module].copy() | ||
| inverters = sam_data['cecinverter'] | ||
| inverter = inverters['ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_'].copy() |
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.
Fine with me to leave this because I'd like to refactor all of these fixtures.
Thanks for the tip.
| return system | ||
|
|
||
|
|
||
| @pytest.fixture |
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.
F811 redefinition of unused 'sam_data' from line 22
| module = 'Canadian_Solar_CS5P_220M' | ||
| module_parameters = sam_data['cecmod'][module].copy() | ||
| inverters = sam_data['cecinverter'] | ||
| inverter = inverters['ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_'].copy() |
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.
E501 line too long (80 > 79 characters)
pvlib/modelchain.py
Outdated
| 'system.module_parameters. Check that the ' | ||
| 'parameters contain valid ' | ||
| 'first_solar_spectral_coefficients or a valid ' | ||
| 'first_solar_spectral_coefficients and a valid ' |
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 still think this should be or. If Technology or Material is not in params, then attempt to identify the cell type. Or find 'first_solar_spectral_coefficients`.
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.
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 changed the comment because the code says 'and' line 624:
elif ((('Technology' in params or
'Material' in params) and
(pvsystem._infer_cell_type() is not None)) or
(self.system._infer_cell_type() is not None)) or
'first_solar_spectral_coefficients' in params):
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 change the code too ?
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.
No change to the code, only the comment.
(('Technology' in params or 'Material' in params) and (self.system._infer_cell_type() is not None))
is all one clause, that is OR-ed with the last clause. The and is inside. _infer_cell_type tries to set Technology and Material if those kwargs aren't given.
That compound logic statement could be presented more clearly using multiple lines.
| return system | ||
|
|
||
|
|
||
| @pytest.fixture |
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.
F811 redefinition of unused 'sam_data' from line 22
| module = 'Canadian_Solar_CS5P_220M' | ||
| module_parameters = sam_data['cecmod'][module].copy() | ||
| inverters = sam_data['cecinverter'] | ||
| inverter = inverters['ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_'].copy() |
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.
E501 line too long (80 > 79 characters)
|
thanks @jgaffiot ! |
test_model_chain.test_infer_spectral_modelto ensure correct behavior for all reasonable inputs.docs/sphinx/source/api.rstfor API changes.docs/sphinx/source/whatsnewfile for all changes.