Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/sphinx/source/whatsnew/v0.8.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Bug fixes
~~~~~~~~~
* Fix issue with :py:func:`pvlib.temperature.fuentes` with timezone-aware
inputs. (:issue:`1071`, :pull:`1072`)
* Raise ``ValueError`` from :py:meth:`pvlib.modelchain.ModelChain.prepare_inputs`
when input does not have a 'dhi' column. (:issue:`1092`, :pull:`1093`)

Testing
~~~~~~~
Expand All @@ -46,3 +48,4 @@ Contributors
* Siyan (Veronica) Guo (:ghuser:`veronicaguo`)
* Will Holmgren (:ghuser:`wholmgren`)
* Cliff Hansen (:ghuser:`cwhanse`)
* Will Vining (:ghuser:`wfvining`)
2 changes: 1 addition & 1 deletion pvlib/modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ def prepare_inputs(self, weather):
ModelChain.complete_irradiance
"""

self._verify_df(weather, required=['ghi', 'dni', 'ghi'])
self._verify_df(weather, required=['ghi', 'dni', 'dhi'])
self._assign_weather(weather)

self.times = self.weather.index
Expand Down
10 changes: 10 additions & 0 deletions pvlib/tests/test_modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,16 @@ def test_prepare_inputs_no_irradiance(sapm_dc_snl_ac_system, location):
mc.prepare_inputs(weather)


@pytest.mark.parametrize("missing", ['dhi', 'ghi', 'dni'])
def test_prepare_inputs_missing_irrad_component(
sapm_dc_snl_ac_system, location, missing):
mc = ModelChain(sapm_dc_snl_ac_system, location)
weather = pd.DataFrame({'dhi': [1, 2], 'dni': [1, 2], 'ghi': [1, 2]})
weather.drop(columns=missing, inplace=True)
with pytest.raises(ValueError):
mc.prepare_inputs(weather)


def test_run_model_perez(sapm_dc_snl_ac_system, location):
mc = ModelChain(sapm_dc_snl_ac_system, location,
transposition_model='perez')
Expand Down