Skip to content

remove irradiance parameter from ModelChain.run_model and ModelChain.prepare_inputs #490

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

Merged
merged 3 commits into from
Jun 26, 2018
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
2 changes: 2 additions & 0 deletions docs/sphinx/source/whatsnew/v0.6.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ v0.6.0 (___, 2018)
API Changes
~~~~~~~~~~~
* pvsystem.calcparams_desoto now requires arguments for each module model parameter.
* removed irradiance parameter from ModelChain.run_model and ModelChain.prepare_inputs


Enhancements
Expand Down Expand Up @@ -43,4 +44,5 @@ Contributors
* Will Holmgren
* Yu Cao
* Cliff Hansen
* Alan Mathew

23 changes: 3 additions & 20 deletions pvlib/modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ def complete_irradiance(self, times=None, weather=None):

return self

def prepare_inputs(self, times=None, irradiance=None, weather=None):
def prepare_inputs(self, times=None, weather=None):
"""
Prepare the solar position, irradiance, and weather inputs to
the model.
Expand All @@ -723,8 +723,6 @@ def prepare_inputs(self, times=None, irradiance=None, weather=None):
times : None or DatetimeIndex, default None
Times at which to evaluate the model. Can be None if
attribute `times` is already set.
irradiance : None or DataFrame
This parameter is deprecated. Please use `weather` instead.
weather : None or DataFrame, default None
If None, the weather attribute is used. If the weather
attribute is also None assumes air temperature is 20 C, wind
Expand All @@ -747,19 +745,6 @@ def prepare_inputs(self, times=None, irradiance=None, weather=None):
if self.weather is None:
self.weather = pd.DataFrame()

# The following part could be removed together with the irradiance
# parameter at version v0.5 or v0.6.
# **** Begin ****
wrn_txt = ("The irradiance parameter will be removed soon.\n" +
"Please use the weather parameter to pass a DataFrame " +
"with irradiance (ghi, dni, dhi), wind speed and " +
"temp_air.\n")
if irradiance is not None:
warnings.warn(wrn_txt, FutureWarning)
for column in irradiance.columns:
self.weather[column] = irradiance[column]
# **** End ****

if times is not None:
self.times = times

Expand Down Expand Up @@ -824,7 +809,7 @@ def prepare_inputs(self, times=None, irradiance=None, weather=None):
self.weather['temp_air'] = 20
return self

def run_model(self, times=None, irradiance=None, weather=None):
def run_model(self, times=None, weather=None):
"""
Run the model.

Expand All @@ -833,8 +818,6 @@ def run_model(self, times=None, irradiance=None, weather=None):
times : None or DatetimeIndex, default None
Times at which to evaluate the model. Can be None if
attribute `times` is already set.
irradiance : None or DataFrame
This parameter is deprecated. Please use `weather` instead.
weather : None or DataFrame, default None
If None, assumes air temperature is 20 C, wind speed is 0
m/s and irradiation calculated from clear sky data. Column
Expand All @@ -852,7 +835,7 @@ def run_model(self, times=None, irradiance=None, weather=None):
aoi_modifier, spectral_modifier, dc, ac, losses.
"""

self.prepare_inputs(times, irradiance, weather)
self.prepare_inputs(times, weather)
self.aoi_model()
self.spectral_model()
self.effective_irradiance_model()
Expand Down
15 changes: 0 additions & 15 deletions pvlib/test/test_modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,21 +463,6 @@ def test_ModelChain___repr__(system, location, strategy, strategy_str):
assert mc.__repr__() == expected


@requires_scipy
def test_weather_irradiance_input(system, location):
"""Test will raise a warning and should be removed in future versions."""
mc = ModelChain(system, location)
times = pd.date_range('2012-06-01 12:00:00', periods=2, freq='H')
i = pd.DataFrame({'dni': [2, 3], 'dhi': [4, 6], 'ghi': [9, 5]}, index=times)
w = pd.DataFrame({'wind_speed': [11, 5], 'temp_air': [30, 32]}, index=times)
mc.run_model(times, irradiance=i, weather=w)

assert_series_equal(mc.weather['dni'],
pd.Series([2, 3], index=times, name='dni'))
assert_series_equal(mc.weather['wind_speed'],
pd.Series([11, 5], index=times, name='wind_speed'))


@requires_scipy
def test_complete_irradiance_clean_run(system, location):
"""The DataFrame should not change if all columns are passed"""
Expand Down