Skip to content

Commit 56971c6

Browse files
authored
remove deprecated items for v0.9 (#1136)
* remove liujordan * remove kwargs from Location * remove LocalizedPVSystem, LocalizedSingleAxisTracker * remove inverter wrappers from pvsystem * remove sapm_celltemp defaults * remove extra kwargs from PVSystem * remove extra kwargs from ModelChain * remove snlinverter and adrinverter from ModelChain(ac_model) options * whatsnew * add whatsnew v09 to whatsnew index * fix deprecations list
1 parent ba4a199 commit 56971c6

13 files changed

+52
-521
lines changed

docs/sphinx/source/whatsnew.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ What's New
66

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

9+
.. include:: whatsnew/v0.9.0.rst
910
.. include:: whatsnew/v0.8.1.rst
1011
.. include:: whatsnew/v0.8.0.rst
1112
.. include:: whatsnew/v0.7.2.rst

docs/sphinx/source/whatsnew/v0.9.0.rst

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,44 @@ v0.9.0 (MONTH DAY YEAR)
55

66
Breaking changes
77
~~~~~~~~~~~~~~~~
8+
* Moved functions related to inverters from ``pvsystem.py`` to ``inverter.py``.
9+
Functions are renamed to follow a more consistent pattern, as follows (:pull:`886`, :pull:`1136`):
10+
11+
- ``pvlib.pvsystem.snlinverter`` is now :py:func:`pvlib.inverter.sandia`
12+
- ``pvlib.pvsystem.pvwatts_ac`` is now :py:func:`pvlib.inverter.pvwatts`
13+
- ``pvlib.pvsystem.adrinverter`` is now :py:func:`pvlib.inverter.adr`
14+
15+
* Argument ``ac_model`` for :py:class:`pvlib.modelchain.ModelChain` now accepts
16+
``'sandia'``, ``'pvwatts'`` and ``'adr'`` for the inverter models. (:pull:`886`, :pull:`1136`)
17+
18+
* Calling :py:meth:`pvlib.pvsystem.PVSystem.sapm_celltemp` without setting
19+
``PVSystem.temperature_model_parameters``,
20+
or a valid combination of ``PVsystem.module_type`` and ``PVsystem.racking_model``, will
21+
now raise an exception. (:issue:`1030`, :pull:`1033`, :pull:`1136`)
22+
23+
* Deprecated arbitrary keyword arguments for
24+
:py:class:`pvlib.location.Location`, :py:class:`pvlib.pvsystem.PVSystem`,
25+
:py:class:`pvlib.tracking.SingleAxisTracker`, and
26+
:py:class:`pvlib.modelchain.ModelChain`. Supplying arbitrary keyword
27+
to these objects result in TypeErrors in v0.9. (:issue:`1029`, :pull:`1053`, :pull:`1136`)
28+
29+
* ``pvlib.pvsystem.LocalizedPVSystem`` and ``pvlib.pvsystem.LocalizedSingleAxisTracker``
30+
have been removed. Use
31+
:py:class:`pvlib.location.Location`, :py:class:`pvlib.pvsystem.PVSystem`,
32+
:py:class:`pvlib.tracking.SingleAxisTracker`, and
33+
:py:class:`pvlib.modelchain.ModelChain` instead.
34+
(:issue:`1029`, :pull:`1034`, :pull:`1053`, :pull:`1136`)
35+
36+
* ``irradiance.liujordan`` and ``ForecastModel.cloud_cover_to_irradiance_liujordan``
37+
have been removed. (:pull:`1136`)
838

939

1040
Deprecations
1141
~~~~~~~~~~~~
1242
* The following ``ModelChain`` attributes are deprecated. They have been moved
1343
to the :py:class:`~pvlib.modelchain.ModelChainResult` class that is
14-
accessible via ``ModelChain.results``
44+
accessible via ``ModelChain.results``:
45+
1546
* ``ModelChain.ac``
1647
* ``ModelChain.airmass``
1748
* ``ModelChain.aoi``

pvlib/forecast.py

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from siphon.ncss import NCSS
1616

1717
import warnings
18-
from pvlib._deprecation import deprecated
1918

2019

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

563562
return irrads
564563

565-
@deprecated(
566-
'0.8',
567-
alternative='Forecast.cloud_cover_to_irradiance_campbell_norman',
568-
name='Forecast.cloud_cover_to_irradiance_liujordan',
569-
removal='0.9')
570-
def cloud_cover_to_irradiance_liujordan(self, cloud_cover, **kwargs):
571-
"""
572-
Deprecated. Use cloud_cover_to_irradiance_campbell_norman instead.
573-
574-
Estimates irradiance from cloud cover in the following steps:
575-
576-
1. Determine transmittance using a function of cloud cover e.g.
577-
:py:meth:`~ForecastModel.cloud_cover_to_transmittance_linear`
578-
2. Calculate GHI, DNI, DHI using the
579-
:py:func:`pvlib.irradiance.liujordan` model
580-
581-
Parameters
582-
----------
583-
cloud_cover : Series
584-
585-
Returns
586-
-------
587-
irradiance : DataFrame
588-
Columns include ghi, dni, dhi
589-
"""
590-
# in principle, get_solarposition could use the forecast
591-
# pressure, temp, etc., but the cloud cover forecast is not
592-
# accurate enough to justify using these minor corrections
593-
solar_position = self.location.get_solarposition(cloud_cover.index)
594-
dni_extra = get_extra_radiation(cloud_cover.index)
595-
airmass = self.location.get_airmass(cloud_cover.index)
596-
597-
transmittance = self.cloud_cover_to_transmittance_linear(cloud_cover,
598-
**kwargs)
599-
600-
irrads = _liujordan(solar_position['apparent_zenith'],
601-
transmittance, airmass['airmass_absolute'],
602-
dni_extra=dni_extra)
603-
irrads = irrads.fillna(0)
604-
605-
return irrads
606-
607564
def cloud_cover_to_irradiance(self, cloud_cover, how='clearsky_scaling',
608565
**kwargs):
609566
"""
@@ -632,9 +589,6 @@ def cloud_cover_to_irradiance(self, cloud_cover, how='clearsky_scaling',
632589
elif how == 'campbell_norman':
633590
irrads = self.cloud_cover_to_irradiance_campbell_norman(
634591
cloud_cover, **kwargs)
635-
elif how == 'liujordan':
636-
irrads = self.cloud_cover_to_irradiance_liujordan(
637-
cloud_cover, **kwargs)
638592
else:
639593
raise ValueError('invalid how argument')
640594

pvlib/irradiance.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
from pvlib import atmosphere, solarposition, tools
1515

16-
from pvlib._deprecation import deprecated
17-
1816

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

23012299

2302-
liujordan = deprecated('0.8', alternative='campbellnormam',
2303-
name='liujordan', removal='0.9')(_liujordan)
2304-
2305-
23062300
def _get_perez_coefficients(perezmodel):
23072301
'''
23082302
Find coefficients for the Perez model

pvlib/location.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
import pytz
1212

1313
from pvlib import solarposition, clearsky, atmosphere, irradiance
14-
from pvlib._deprecation import pvlibDeprecationWarning
15-
1614

1715
class Location:
1816
"""
@@ -55,8 +53,7 @@ class Location:
5553
pvlib.pvsystem.PVSystem
5654
"""
5755

58-
def __init__(self, latitude, longitude, tz='UTC', altitude=0,
59-
name=None, **kwargs):
56+
def __init__(self, latitude, longitude, tz='UTC', altitude=0, name=None):
6057

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

8178
self.name = name
8279

83-
if kwargs:
84-
warnings.warn(
85-
'Arbitrary Location kwargs are deprecated and will be '
86-
'removed in v0.9', pvlibDeprecationWarning
87-
)
88-
8980
def __repr__(self):
9081
attrs = ['name', 'latitude', 'longitude', 'altitude', 'tz']
9182
return ('Location: \n ' + '\n '.join(

pvlib/modelchain.py

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ def __init__(self, system, location,
377377
airmass_model='kastenyoung1989',
378378
dc_model=None, ac_model=None, aoi_model=None,
379379
spectral_model=None, temperature_model=None,
380-
losses_model='no_loss', name=None, **kwargs):
380+
losses_model='no_loss', name=None):
381381

382382
self.name = name
383383
self.system = system
@@ -403,12 +403,6 @@ def __init__(self, system, location,
403403

404404
self.results = ModelChainResult()
405405

406-
if kwargs:
407-
warnings.warn(
408-
'Arbitrary ModelChain kwargs are deprecated and will be '
409-
'removed in v0.9', pvlibDeprecationWarning
410-
)
411-
412406
def __getattr__(self, key):
413407
if key in ModelChain._deprecated_attrs:
414408
msg = f'ModelChain.{key} is deprecated and will' \
@@ -750,22 +744,11 @@ def ac_model(self, model):
750744
self._ac_model = self.infer_ac_model()
751745
elif isinstance(model, str):
752746
model = model.lower()
753-
# TODO in v0.9: remove 'snlinverter', 'adrinverter'
754-
if model in ['sandia', 'snlinverter']:
755-
if model == 'snlinverter':
756-
warnings.warn("ac_model = 'snlinverter' is deprecated and"
757-
" will be removed in v0.9; use"
758-
" ac_model = 'sandia' instead.",
759-
pvlibDeprecationWarning)
747+
if model == 'sandia':
760748
self._ac_model = self.snlinverter
761749
elif model == 'sandia_multi':
762750
self._ac_model = self.sandia_multi_inverter
763-
elif model in ['adr', 'adrinverter']:
764-
if model == 'adrinverter':
765-
warnings.warn("ac_model = 'adrinverter' is deprecated and"
766-
" will be removed in v0.9; use"
767-
" ac_model = 'adr' instead.",
768-
pvlibDeprecationWarning)
751+
elif model in 'adr':
769752
self._ac_model = self.adrinverter
770753
elif model == 'pvwatts':
771754
self._ac_model = self.pvwatts_inverter

pvlib/pvsystem.py

Lines changed: 1 addition & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from pvlib import (atmosphere, iam, inverter, irradiance,
1818
singlediode as _singlediode, temperature)
1919
from pvlib.tools import _build_kwargs
20-
from pvlib.location import Location
2120
from pvlib._deprecation import pvlibDeprecationWarning
2221

2322

@@ -46,28 +45,6 @@
4645
}
4746

4847

49-
def _combine_localized_attributes(pvsystem=None, location=None, **kwargs):
50-
"""
51-
Get and combine attributes from the pvsystem and/or location
52-
with the rest of the kwargs.
53-
"""
54-
if pvsystem is not None:
55-
pv_dict = pvsystem.__dict__
56-
pv_dict = {**pv_dict, **pv_dict['arrays'][0].__dict__}
57-
else:
58-
pv_dict = {}
59-
60-
if location is not None:
61-
loc_dict = location.__dict__
62-
else:
63-
loc_dict = {}
64-
65-
new_kwargs = dict(
66-
list(pv_dict.items()) + list(loc_dict.items()) + list(kwargs.items())
67-
)
68-
return new_kwargs
69-
70-
7148
def _unwrap_single_value(func):
7249
"""Decorator for functions that return iterables.
7350
@@ -211,8 +188,7 @@ def __init__(self,
211188
temperature_model_parameters=None,
212189
modules_per_string=1, strings_per_inverter=1,
213190
inverter=None, inverter_parameters=None,
214-
racking_model=None, losses_parameters=None, name=None,
215-
**kwargs):
191+
racking_model=None, losses_parameters=None, name=None):
216192

217193
if arrays is None:
218194
self.arrays = (Array(
@@ -244,12 +220,6 @@ def __init__(self,
244220

245221
self.name = name
246222

247-
if kwargs:
248-
warnings.warn(
249-
'Arbitrary PVSystem kwargs are deprecated and will be '
250-
'removed in v0.9', pvlibDeprecationWarning
251-
)
252-
253223
def __repr__(self):
254224
repr = f'PVSystem:\n name: {self.name}\n '
255225
for array in self.arrays:
@@ -587,21 +557,6 @@ def sapm_celltemp(self, poa_global, temp_air, wind_speed):
587557
poa_global = self._validate_per_array(poa_global)
588558
temp_air = self._validate_per_array(temp_air, system_wide=True)
589559
wind_speed = self._validate_per_array(wind_speed, system_wide=True)
590-
for array in self.arrays:
591-
# warn user about change in default behavior in 0.9.
592-
if (array.temperature_model_parameters == {} and array.module_type
593-
is None and array.racking_model is None):
594-
warnings.warn(
595-
'temperature_model_parameters, racking_model, and '
596-
'module_type are not specified. Reverting to deprecated '
597-
'default: SAPM cell temperature model parameters for a '
598-
'glass/glass module in open racking. In v0.9, '
599-
'temperature_model_parameters or a valid combination of '
600-
'racking_model and module_type will be required.',
601-
pvlibDeprecationWarning)
602-
params = temperature._temperature_model_params(
603-
'sapm', 'open_rack_glass_glass')
604-
array.temperature_model_parameters = params
605560

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

1018-
@deprecated('0.8', alternative='PVSystem, Location, and ModelChain',
1019-
name='PVSystem.localize', removal='0.9')
1020-
def localize(self, location=None, latitude=None, longitude=None,
1021-
**kwargs):
1022-
"""
1023-
Creates a LocalizedPVSystem object using this object
1024-
and location data. Must supply either location object or
1025-
latitude, longitude, and any location kwargs
1026-
1027-
Parameters
1028-
----------
1029-
location : None or Location, default None
1030-
latitude : None or float, default None
1031-
longitude : None or float, default None
1032-
**kwargs : see Location
1033-
1034-
Returns
1035-
-------
1036-
localized_system : LocalizedPVSystem
1037-
"""
1038-
1039-
if location is None:
1040-
location = Location(latitude, longitude, **kwargs)
1041-
1042-
return LocalizedPVSystem(pvsystem=self, location=location)
1043-
1044973
@property
1045974
@_unwrap_single_value
1046975
def module_parameters(self):
@@ -1118,39 +1047,6 @@ def num_arrays(self):
11181047
return len(self.arrays)
11191048

11201049

1121-
@deprecated('0.8', alternative='PVSystem, Location, and ModelChain',
1122-
name='LocalizedPVSystem', removal='0.9')
1123-
class LocalizedPVSystem(PVSystem, Location):
1124-
"""
1125-
The LocalizedPVSystem class defines a standard set of installed PV
1126-
system attributes and modeling functions. This class combines the
1127-
attributes and methods of the PVSystem and Location classes.
1128-
1129-
The LocalizedPVSystem may have bugs due to the difficulty of
1130-
robustly implementing multiple inheritance. See
1131-
:py:class:`~pvlib.modelchain.ModelChain` for an alternative paradigm
1132-
for modeling PV systems at specific locations.
1133-
"""
1134-
def __init__(self, pvsystem=None, location=None, **kwargs):
1135-
1136-
new_kwargs = _combine_localized_attributes(
1137-
pvsystem=pvsystem,
1138-
location=location,
1139-
**kwargs,
1140-
)
1141-
1142-
PVSystem.__init__(self, **new_kwargs)
1143-
Location.__init__(self, **new_kwargs)
1144-
1145-
def __repr__(self):
1146-
attrs = ['name', 'latitude', 'longitude', 'altitude', 'tz',
1147-
'surface_tilt', 'surface_azimuth', 'module', 'inverter',
1148-
'albedo', 'racking_model', 'module_type',
1149-
'temperature_model_parameters']
1150-
return ('LocalizedPVSystem:\n ' + '\n '.join(
1151-
f'{attr}: {getattr(self, attr)}' for attr in attrs))
1152-
1153-
11541050
class Array:
11551051
"""
11561052
An Array is a set of of modules at the same orientation.
@@ -2906,15 +2802,3 @@ def combine_loss_factors(index, *losses, fill_method='ffill'):
29062802
combined_factor *= (1 - loss)
29072803

29082804
return 1 - combined_factor
2909-
2910-
2911-
snlinverter = deprecated('0.8', alternative='inverter.sandia',
2912-
name='snlinverter', removal='0.9')(inverter.sandia)
2913-
2914-
2915-
adrinverter = deprecated('0.8', alternative='inverter.adr', name='adrinverter',
2916-
removal='0.9')(inverter.adr)
2917-
2918-
2919-
pvwatts_ac = deprecated('0.8', alternative='inverter.pvwatts',
2920-
name='pvwatts_ac', removal='0.9')(inverter.pvwatts)

0 commit comments

Comments
 (0)