Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions docs/sphinx/source/whatsnew/v0.10.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Bug fixes
~~~~~~~~~
* Fix mapping of the dew point column to ``temp_dew`` when ``map_variables``
is True in :py:func:`pvlib.iotools.get_psm3`. (:pull:`1920`)
* Fix :py:class:`pvlib.modelchain.ModelChain` to use attribute `clearsky_model`
(:pull:`1924`)

Testing
~~~~~~~
Expand Down
3 changes: 2 additions & 1 deletion pvlib/modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,8 @@ def _complete_irradiance(self, weather):
"https://github.com/pvlib/pvlib-python \n")
if {'ghi', 'dhi'} <= icolumns and 'dni' not in icolumns:
clearsky = self.location.get_clearsky(
weather.index, solar_position=self.results.solar_position)
weather.index, model=self.clearsky_model,
solar_position=self.results.solar_position)
complete_irrad_df = pvlib.irradiance.complete_irradiance(
solar_zenith=self.results.solar_position.zenith,
ghi=weather.ghi,
Expand Down
9 changes: 6 additions & 3 deletions pvlib/tests/test_modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,7 @@ def test_complete_irradiance_clean_run(sapm_dc_snl_ac_system, location):
pd.Series([9, 5], index=times, name='ghi'))


def test_complete_irradiance(sapm_dc_snl_ac_system, location):
def test_complete_irradiance(sapm_dc_snl_ac_system, location, mocker):
"""Check calculations"""
mc = ModelChain(sapm_dc_snl_ac_system, location)
times = pd.date_range('2010-07-05 7:00:00-0700', periods=2, freq='H')
Expand All @@ -1867,12 +1867,15 @@ def test_complete_irradiance(sapm_dc_snl_ac_system, location):
pd.Series([372.103976116, 497.087579068],
index=times, name='ghi'))

# check that clearsky_model is used correctly
m_ineichen = mocker.spy(location, 'get_clearsky')
mc.complete_irradiance(i[['dhi', 'ghi']])
assert m_ineichen.call_count == 1
assert_series_equal(mc.results.weather['dni'],
pd.Series([49.756966, 62.153947],
index=times, name='dni'))


@pytest.mark.filterwarnings("ignore:This function is not safe at the moment")
@pytest.mark.parametrize("input_type", [tuple, list])
def test_complete_irradiance_arrays(
Expand Down