Skip to content

remove deprecated items for v0.9 #1136

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 12 commits into from
Jan 20, 2021
1 change: 1 addition & 0 deletions docs/sphinx/source/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ What's New

These are new features and improvements of note in each release.

.. include:: whatsnew/v0.9.0.rst
.. include:: whatsnew/v0.8.1.rst
.. include:: whatsnew/v0.8.0.rst
.. include:: whatsnew/v0.7.2.rst
Expand Down
33 changes: 32 additions & 1 deletion docs/sphinx/source/whatsnew/v0.9.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,44 @@ v0.9.0 (MONTH DAY YEAR)

Breaking changes
~~~~~~~~~~~~~~~~
* Moved functions related to inverters from ``pvsystem.py`` to ``inverter.py``.
Functions are renamed to follow a more consistent pattern, as follows (:pull:`886`, :pull:`1136`):

- ``pvlib.pvsystem.snlinverter`` is now :py:func:`pvlib.inverter.sandia`
- ``pvlib.pvsystem.pvwatts_ac`` is now :py:func:`pvlib.inverter.pvwatts`
- ``pvlib.pvsystem.adrinverter`` is now :py:func:`pvlib.inverter.adr`

* Argument ``ac_model`` for :py:class:`pvlib.modelchain.ModelChain` now accepts
``'sandia'``, ``'pvwatts'`` and ``'adr'`` for the inverter models. (:pull:`886`, :pull:`1136`)

* Calling :py:meth:`pvlib.pvsystem.PVSystem.sapm_celltemp` without setting
``PVSystem.temperature_model_parameters``,
or a valid combination of ``PVsystem.module_type`` and ``PVsystem.racking_model``, will
now raise an exception. (:issue:`1030`, :pull:`1033`, :pull:`1136`)

* Deprecated arbitrary keyword arguments for
:py:class:`pvlib.location.Location`, :py:class:`pvlib.pvsystem.PVSystem`,
:py:class:`pvlib.tracking.SingleAxisTracker`, and
:py:class:`pvlib.modelchain.ModelChain`. Supplying arbitrary keyword
to these objects result in TypeErrors in v0.9. (:issue:`1029`, :pull:`1053`, :pull:`1136`)

* ``pvlib.pvsystem.LocalizedPVSystem`` and ``pvlib.pvsystem.LocalizedSingleAxisTracker``
have been removed. Use
:py:class:`pvlib.location.Location`, :py:class:`pvlib.pvsystem.PVSystem`,
:py:class:`pvlib.tracking.SingleAxisTracker`, and
:py:class:`pvlib.modelchain.ModelChain` instead.
(:issue:`1029`, :pull:`1034`, :pull:`1053`, :pull:`1136`)

* ``irradiance.liujordan`` and ``ForecastModel.cloud_cover_to_irradiance_liujordan``
have been removed. (:pull:`1136`)


Deprecations
~~~~~~~~~~~~
* The following ``ModelChain`` attributes are deprecated. They have been moved
to the :py:class:`~pvlib.modelchain.ModelChainResult` class that is
accessible via ``ModelChain.results``
accessible via ``ModelChain.results``:

* ``ModelChain.ac``
* ``ModelChain.airmass``
* ``ModelChain.aoi``
Expand Down
46 changes: 0 additions & 46 deletions pvlib/forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from siphon.ncss import NCSS

import warnings
from pvlib._deprecation import deprecated


warnings.warn(
Expand Down Expand Up @@ -562,48 +561,6 @@ def cloud_cover_to_irradiance_campbell_norman(self, cloud_cover, **kwargs):

return irrads

@deprecated(
'0.8',
alternative='Forecast.cloud_cover_to_irradiance_campbell_norman',
name='Forecast.cloud_cover_to_irradiance_liujordan',
removal='0.9')
def cloud_cover_to_irradiance_liujordan(self, cloud_cover, **kwargs):
"""
Deprecated. Use cloud_cover_to_irradiance_campbell_norman instead.

Estimates irradiance from cloud cover in the following steps:

1. Determine transmittance using a function of cloud cover e.g.
:py:meth:`~ForecastModel.cloud_cover_to_transmittance_linear`
2. Calculate GHI, DNI, DHI using the
:py:func:`pvlib.irradiance.liujordan` model

Parameters
----------
cloud_cover : Series

Returns
-------
irradiance : DataFrame
Columns include ghi, dni, dhi
"""
# in principle, get_solarposition could use the forecast
# pressure, temp, etc., but the cloud cover forecast is not
# accurate enough to justify using these minor corrections
solar_position = self.location.get_solarposition(cloud_cover.index)
dni_extra = get_extra_radiation(cloud_cover.index)
airmass = self.location.get_airmass(cloud_cover.index)

transmittance = self.cloud_cover_to_transmittance_linear(cloud_cover,
**kwargs)

irrads = _liujordan(solar_position['apparent_zenith'],
transmittance, airmass['airmass_absolute'],
dni_extra=dni_extra)
irrads = irrads.fillna(0)

return irrads

def cloud_cover_to_irradiance(self, cloud_cover, how='clearsky_scaling',
**kwargs):
"""
Expand Down Expand Up @@ -632,9 +589,6 @@ def cloud_cover_to_irradiance(self, cloud_cover, how='clearsky_scaling',
elif how == 'campbell_norman':
irrads = self.cloud_cover_to_irradiance_campbell_norman(
cloud_cover, **kwargs)
elif how == 'liujordan':
irrads = self.cloud_cover_to_irradiance_liujordan(
cloud_cover, **kwargs)
else:
raise ValueError('invalid how argument')

Expand Down
6 changes: 0 additions & 6 deletions pvlib/irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

from pvlib import atmosphere, solarposition, tools

from pvlib._deprecation import deprecated


# see References section of grounddiffuse function
SURFACE_ALBEDOS = {'urban': 0.18,
Expand Down Expand Up @@ -2299,10 +2297,6 @@ def _liujordan(zenith, transmittance, airmass, dni_extra=1367.0):
return irrads


liujordan = deprecated('0.8', alternative='campbellnormam',
name='liujordan', removal='0.9')(_liujordan)


def _get_perez_coefficients(perezmodel):
'''
Find coefficients for the Perez model
Expand Down
11 changes: 1 addition & 10 deletions pvlib/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import pytz

from pvlib import solarposition, clearsky, atmosphere, irradiance
from pvlib._deprecation import pvlibDeprecationWarning


class Location:
"""
Expand Down Expand Up @@ -55,8 +53,7 @@ class Location:
pvlib.pvsystem.PVSystem
"""

def __init__(self, latitude, longitude, tz='UTC', altitude=0,
name=None, **kwargs):
def __init__(self, latitude, longitude, tz='UTC', altitude=0, name=None):

self.latitude = latitude
self.longitude = longitude
Expand All @@ -80,12 +77,6 @@ def __init__(self, latitude, longitude, tz='UTC', altitude=0,

self.name = name

if kwargs:
warnings.warn(
'Arbitrary Location kwargs are deprecated and will be '
'removed in v0.9', pvlibDeprecationWarning
)

def __repr__(self):
attrs = ['name', 'latitude', 'longitude', 'altitude', 'tz']
return ('Location: \n ' + '\n '.join(
Expand Down
23 changes: 3 additions & 20 deletions pvlib/modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def __init__(self, system, location,
airmass_model='kastenyoung1989',
dc_model=None, ac_model=None, aoi_model=None,
spectral_model=None, temperature_model=None,
losses_model='no_loss', name=None, **kwargs):
losses_model='no_loss', name=None):

self.name = name
self.system = system
Expand All @@ -403,12 +403,6 @@ def __init__(self, system, location,

self.results = ModelChainResult()

if kwargs:
warnings.warn(
'Arbitrary ModelChain kwargs are deprecated and will be '
'removed in v0.9', pvlibDeprecationWarning
)

def __getattr__(self, key):
if key in ModelChain._deprecated_attrs:
msg = f'ModelChain.{key} is deprecated and will' \
Expand Down Expand Up @@ -750,22 +744,11 @@ def ac_model(self, model):
self._ac_model = self.infer_ac_model()
elif isinstance(model, str):
model = model.lower()
# TODO in v0.9: remove 'snlinverter', 'adrinverter'
if model in ['sandia', 'snlinverter']:
if model == 'snlinverter':
warnings.warn("ac_model = 'snlinverter' is deprecated and"
" will be removed in v0.9; use"
" ac_model = 'sandia' instead.",
pvlibDeprecationWarning)
if model == 'sandia':
self._ac_model = self.snlinverter
elif model == 'sandia_multi':
self._ac_model = self.sandia_multi_inverter
elif model in ['adr', 'adrinverter']:
if model == 'adrinverter':
warnings.warn("ac_model = 'adrinverter' is deprecated and"
" will be removed in v0.9; use"
" ac_model = 'adr' instead.",
pvlibDeprecationWarning)
elif model in 'adr':
self._ac_model = self.adrinverter
elif model == 'pvwatts':
self._ac_model = self.pvwatts_inverter
Expand Down
118 changes: 1 addition & 117 deletions pvlib/pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from pvlib import (atmosphere, iam, inverter, irradiance,
singlediode as _singlediode, temperature)
from pvlib.tools import _build_kwargs
from pvlib.location import Location
from pvlib._deprecation import pvlibDeprecationWarning


Expand Down Expand Up @@ -46,28 +45,6 @@
}


def _combine_localized_attributes(pvsystem=None, location=None, **kwargs):
"""
Get and combine attributes from the pvsystem and/or location
with the rest of the kwargs.
"""
if pvsystem is not None:
pv_dict = pvsystem.__dict__
pv_dict = {**pv_dict, **pv_dict['arrays'][0].__dict__}
else:
pv_dict = {}

if location is not None:
loc_dict = location.__dict__
else:
loc_dict = {}

new_kwargs = dict(
list(pv_dict.items()) + list(loc_dict.items()) + list(kwargs.items())
)
return new_kwargs


def _unwrap_single_value(func):
"""Decorator for functions that return iterables.

Expand Down Expand Up @@ -211,8 +188,7 @@ def __init__(self,
temperature_model_parameters=None,
modules_per_string=1, strings_per_inverter=1,
inverter=None, inverter_parameters=None,
racking_model=None, losses_parameters=None, name=None,
**kwargs):
racking_model=None, losses_parameters=None, name=None):

if arrays is None:
self.arrays = (Array(
Expand Down Expand Up @@ -244,12 +220,6 @@ def __init__(self,

self.name = name

if kwargs:
warnings.warn(
'Arbitrary PVSystem kwargs are deprecated and will be '
'removed in v0.9', pvlibDeprecationWarning
)

def __repr__(self):
repr = f'PVSystem:\n name: {self.name}\n '
for array in self.arrays:
Expand Down Expand Up @@ -587,21 +557,6 @@ def sapm_celltemp(self, poa_global, temp_air, wind_speed):
poa_global = self._validate_per_array(poa_global)
temp_air = self._validate_per_array(temp_air, system_wide=True)
wind_speed = self._validate_per_array(wind_speed, system_wide=True)
for array in self.arrays:
# warn user about change in default behavior in 0.9.
if (array.temperature_model_parameters == {} and array.module_type
is None and array.racking_model is None):
warnings.warn(
'temperature_model_parameters, racking_model, and '
'module_type are not specified. Reverting to deprecated '
'default: SAPM cell temperature model parameters for a '
'glass/glass module in open racking. In v0.9, '
'temperature_model_parameters or a valid combination of '
'racking_model and module_type will be required.',
pvlibDeprecationWarning)
params = temperature._temperature_model_params(
'sapm', 'open_rack_glass_glass')
array.temperature_model_parameters = params

build_kwargs = functools.partial(_build_kwargs, ['a', 'b', 'deltaT'])
return tuple(
Expand Down Expand Up @@ -1015,32 +970,6 @@ def pvwatts_multi(self, p_dc):
return inverter.pvwatts_multi(p_dc, self.inverter_parameters['pdc0'],
**kwargs)

@deprecated('0.8', alternative='PVSystem, Location, and ModelChain',
name='PVSystem.localize', removal='0.9')
def localize(self, location=None, latitude=None, longitude=None,
**kwargs):
"""
Creates a LocalizedPVSystem object using this object
and location data. Must supply either location object or
latitude, longitude, and any location kwargs

Parameters
----------
location : None or Location, default None
latitude : None or float, default None
longitude : None or float, default None
**kwargs : see Location

Returns
-------
localized_system : LocalizedPVSystem
"""

if location is None:
location = Location(latitude, longitude, **kwargs)

return LocalizedPVSystem(pvsystem=self, location=location)

@property
@_unwrap_single_value
def module_parameters(self):
Expand Down Expand Up @@ -1118,39 +1047,6 @@ def num_arrays(self):
return len(self.arrays)


@deprecated('0.8', alternative='PVSystem, Location, and ModelChain',
name='LocalizedPVSystem', removal='0.9')
class LocalizedPVSystem(PVSystem, Location):
"""
The LocalizedPVSystem class defines a standard set of installed PV
system attributes and modeling functions. This class combines the
attributes and methods of the PVSystem and Location classes.

The LocalizedPVSystem may have bugs due to the difficulty of
robustly implementing multiple inheritance. See
:py:class:`~pvlib.modelchain.ModelChain` for an alternative paradigm
for modeling PV systems at specific locations.
"""
def __init__(self, pvsystem=None, location=None, **kwargs):

new_kwargs = _combine_localized_attributes(
pvsystem=pvsystem,
location=location,
**kwargs,
)

PVSystem.__init__(self, **new_kwargs)
Location.__init__(self, **new_kwargs)

def __repr__(self):
attrs = ['name', 'latitude', 'longitude', 'altitude', 'tz',
'surface_tilt', 'surface_azimuth', 'module', 'inverter',
'albedo', 'racking_model', 'module_type',
'temperature_model_parameters']
return ('LocalizedPVSystem:\n ' + '\n '.join(
f'{attr}: {getattr(self, attr)}' for attr in attrs))


class Array:
"""
An Array is a set of of modules at the same orientation.
Expand Down Expand Up @@ -2906,15 +2802,3 @@ def combine_loss_factors(index, *losses, fill_method='ffill'):
combined_factor *= (1 - loss)

return 1 - combined_factor


snlinverter = deprecated('0.8', alternative='inverter.sandia',
name='snlinverter', removal='0.9')(inverter.sandia)


adrinverter = deprecated('0.8', alternative='inverter.adr', name='adrinverter',
removal='0.9')(inverter.adr)


pvwatts_ac = deprecated('0.8', alternative='inverter.pvwatts',
name='pvwatts_ac', removal='0.9')(inverter.pvwatts)
Loading