fix run_model_from_effective_irradiance with iterable weather and excluding cell temperature#1165
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 |
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.
| # 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.
| 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.
| # ModelChain.temperature_model(). |
|
Ok to merge |
docs/sphinx/source/api.rstfor API changes.docs/sphinx/source/whatsnewfor 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