-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix run_model_from_effective_irradiance with iterable weather and excluding cell temperature #1165
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
@wholmgren @wfvining one test is failing. I actually think the ModelChain should run with that that test setup, since |
That does seem reasonable to me. If we remove that test, we should make sure that there is still a test that covers the case where one array does not have enough information to calculate cell temperature. |
I agree. |
I had to call |
This suggests to me that the ValueError is only accessible from private calls and cannot be hit through |
I believe that to be the case, but could be wrong. |
Why keep it if we can't hit it through the run method calls? |
All three public |
Good question. I'm OK removing that check. @wfvining ? |
I agree. Maybe out of scope for this PR, but I think we could refactor |
#1163 is |
I'm okay removing it or just making it catch any generic exception as opposed to a specific
I would support refactoring this. My guess is that the bulk of the technical debt in |
I think this should do it: @pytest.mark.parametrize("input_type", [lambda x: x[0], tuple, list])
def test_run_model_from_effective_irradiance_no_poa_global(
sapm_dc_snl_ac_system, location, weather, total_irrad, input_type):
data = weather.copy()
data['effective_irradiance'] = total_irrad['poa_global']
mc = ModelChain(sapm_dc_snl_ac_system, location, aoi_model='no_loss',
spectral_model='no_loss')
ac = mc.run_model_from_effective_irradiance(input_type((data,))).results.ac
expected = pd.Series(np.array([149.280238, 96.678385]),
index=data.index)
# if isinstance(ac, (tuple, list)):
# ac = ac[0]
assert_series_equal(ac, expected) edit: I commented out the |
As would I. New issue though. I would also propose that we consider combining |
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.
minor suggestions below. I confirmed this resolves the example in #1163.
pvlib/tests/test_modelchain.py
Outdated
# check with data as an iterable of length 1 | ||
mc.run_model_from_effective_irradiance(input_type((data,))) |
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.
# check with data as an iterable of length 1 | |
mc.run_model_from_effective_irradiance(input_type((data,))) |
pvlib/tests/test_modelchain.py
Outdated
|
||
|
||
@pytest.mark.parametrize("input_type", [tuple, list]) | ||
def test_run_model_from_effective_irradiance_input_type( |
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.
def test_run_model_from_effective_irradiance_input_type( | |
def test_run_model_from_effective_irradiance_multi_array( |
pvlib/modelchain.py
Outdated
"only a subset of Arrays you must provide " | ||
"'poa_global' for all Arrays, including those " | ||
"that have a known 'cell_temperature'.") | ||
# ModelChain.temperature_model(). |
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.
# ModelChain.temperature_model(). |
Ok to merge |
docs/sphinx/source/api.rst
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`
).Moves check for complete POA for cell temperature calculations to
ModelChain._set_celltemp
.Adds testing for weather/data input type (tuple, list) to tests for
ModelChain.run_from_effective_irradiance