Skip to content

remove 0.8 deprecations from pvsystem.py, modelchain.py, rework temperature model param deprecation #1033

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 19 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from 15 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: 1 addition & 1 deletion .stickler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ linters:
flake8:
python: 3
max-line-length: 79
ignore: E201,E241,E226
ignore: E201,E241,E226,W503,W504
files:
ignore:
- 'pvlib/_version.py'
17 changes: 17 additions & 0 deletions docs/sphinx/source/whatsnew/v0.8.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,23 @@ API Changes
:py:func:`pvlib.iotools.read_tmy3`, :py:meth:`pvlib.location.Location.from_tmy`, and
:py:class:`pvlib.pvsystem.LocalizedPVSystem` for alternatives. (:issue:`965`)
(:pull:`1008`)
* The following functions, methods, and arguments were deprecated in a previous
release and have now been removed:
* ``pvsystem.PVSystem.ashraeiam``. Use :py:meth:`~pvlib.pvsystem.PVSystem.get_iam`.
* ``pvsystem.PVSystem.physicaliam``. Use :py:meth:`~pvlib.pvsystem.PVSystem.get_iam`.
* ``pvsystem.PVSystem.sapm_aoi_loss``. Use :py:meth:`~pvlib.pvsystem.PVSystem.get_iam`.
* ``pvsystem.ashraeiam``. Use :py:func:`pvlib.iam.ashrae`.
* ``pvsystem.physicaliam``. Use :py:func:`pvlib.iam.physical`.
* ``pvsystem.sapm_aoi_loss``. Use :py:func:`pvlib.iam.sapm`.
* ``pvsystem.sapm_celltemp``. Use :py:func:`pvlib.temperature.sapm_cell`.
* ``pvsystem.pvsyst_celltemp``. Use :py:func:`pvlib.temperature.pvsyst`.
* ``times`` keyword argument of
:py:meth:`pvlib.modelchain.ModelChain.run_model`,
:py:meth:`pvlib.modelchain.ModelChain.complete_irradiance`, and
:py:meth:`pvlib.modelchain.ModelChain.prepare_inputs`.
The index of the input DataFrame is used instead.
* ``temp_model`` keyword argument of
:py:meth:`pvlib.modelchain.ModelChain`. Use ``temperature_model`` instead.

Enhancements
~~~~~~~~~~~~
Expand Down
56 changes: 7 additions & 49 deletions pvlib/modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,24 +346,6 @@ def __init__(self, system, location,
self.ac_model = ac_model
self.aoi_model = aoi_model
self.spectral_model = spectral_model

# TODO: deprecated kwarg temp_model. Remove use of temp_model in v0.8
temp_model = kwargs.pop('temp_model', None)
if temp_model is not None:
if temperature_model is None:
warnings.warn('The temp_model keyword argument is deprecated.'
' Use temperature_model instead',
pvlibDeprecationWarning)
temperature_model = temp_model
elif temp_model == temperature_model:
warnings.warn('Provide only one of temperature_model or '
'temp_model (deprecated).',
pvlibDeprecationWarning)
else:
raise ValueError(
'Conflicting temperature_model {} and temp_model {}. '
'temp_model is deprecated. Specify only temperature_model.'
.format(temperature_model, temp_model))
self.temperature_model = temperature_model

self.losses_model = losses_model
Expand Down Expand Up @@ -878,7 +860,10 @@ def temperature_model(self, model):

def infer_temperature_model(self):
params = set(self.system.temperature_model_parameters.keys())
if set(['a', 'b', 'deltaT']) <= params:
# remove or statement in v0.9
if set(['a', 'b', 'deltaT']) <= params or (
not params and self.system.racking_model is None
and self.system.module_type is None):
return self.sapm_temp
elif set(['u_c', 'u_v']) <= params:
return self.pvsyst_temp
Expand Down Expand Up @@ -945,7 +930,7 @@ def effective_irradiance_model(self):
fd*self.total_irrad['poa_diffuse'])
return self

def complete_irradiance(self, weather, times=None):
def complete_irradiance(self, weather):
"""
Determine the missing irradiation columns. Only two of the
following data columns (dni, ghi, dhi) are needed to calculate
Expand All @@ -962,10 +947,6 @@ def complete_irradiance(self, weather, times=None):
``'wind_speed'``, ``'temp_air'``. All irradiance components
are required. Air temperature of 20 C and wind speed
of 0 m/s will be added to the DataFrame if not provided.
times : None, deprecated
Deprecated argument included for API compatibility, but not
used internally. The index of the weather DataFrame is used
for times.

Returns
-------
Expand Down Expand Up @@ -994,11 +975,6 @@ def complete_irradiance(self, weather, times=None):
"""
self.weather = weather

if times is not None:
warnings.warn('times keyword argument is deprecated and will be '
'removed in 0.8. The index of the weather DataFrame '
'is used for times.', pvlibDeprecationWarning)

self.solar_position = self.location.get_solarposition(
self.weather.index, method=self.solar_position_method)

Expand Down Expand Up @@ -1029,7 +1005,7 @@ def complete_irradiance(self, weather, times=None):

return self

def prepare_inputs(self, weather, times=None):
def prepare_inputs(self, weather):
"""
Prepare the solar position, irradiance, and weather inputs to
the model.
Expand All @@ -1041,10 +1017,6 @@ def prepare_inputs(self, weather, times=None):
``'wind_speed'``, ``'temp_air'``. All irradiance components
are required. Air temperature of 20 C and wind speed
of 0 m/s will be added to the DataFrame if not provided.
times : None, deprecated
Deprecated argument included for API compatibility, but not
used internally. The index of the weather DataFrame is used
for times.

Notes
-----
Expand All @@ -1064,11 +1036,6 @@ def prepare_inputs(self, weather, times=None):

self.weather = weather

if times is not None:
warnings.warn('times keyword argument is deprecated and will be '
'removed in 0.8. The index of the weather DataFrame '
'is used for times.', pvlibDeprecationWarning)

self.times = self.weather.index
try:
kwargs = _build_kwargs(['pressure', 'temp_air'], weather)
Expand Down Expand Up @@ -1126,7 +1093,7 @@ def prepare_inputs(self, weather, times=None):
self.weather['temp_air'] = 20
return self

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

Expand All @@ -1137,10 +1104,6 @@ def run_model(self, weather, times=None):
``'wind_speed'``, ``'temp_air'``. All irradiance components
are required. Air temperature of 20 C and wind speed
of 0 m/s will be added to the DataFrame if not provided.
times : None, deprecated
Deprecated argument included for API compatibility, but not
used internally. The index of the weather DataFrame is used
for times.

Returns
-------
Expand All @@ -1152,11 +1115,6 @@ def run_model(self, weather, times=None):
``dc``, ``ac``, ``losses``,
``diode_params`` (if dc_model is a single diode model)
"""
if times is not None:
warnings.warn('times keyword argument is deprecated and will be '
'removed in 0.8. The index of the weather DataFrame '
'is used for times.', pvlibDeprecationWarning)

self.prepare_inputs(weather)
self.aoi_model()
self.spectral_model()
Expand Down
Loading