Skip to content

Commit cf917fc

Browse files
committed
pvsystem 0.8 deprecations
1 parent 87d1bf2 commit cf917fc

File tree

2 files changed

+9
-206
lines changed

2 files changed

+9
-206
lines changed

pvlib/pvsystem.py

Lines changed: 0 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -358,26 +358,6 @@ def get_iam(self, aoi, iam_model='physical'):
358358
else:
359359
raise ValueError(model + ' is not a valid IAM model')
360360

361-
def ashraeiam(self, aoi):
362-
"""
363-
Deprecated. Use ``PVSystem.get_iam`` instead.
364-
"""
365-
import warnings
366-
warnings.warn('PVSystem.ashraeiam is deprecated and will be removed in'
367-
'v0.8, use PVSystem.get_iam instead',
368-
pvlibDeprecationWarning)
369-
return PVSystem.get_iam(self, aoi, iam_model='ashrae')
370-
371-
def physicaliam(self, aoi):
372-
"""
373-
Deprecated. Use ``PVSystem.get_iam`` instead.
374-
"""
375-
import warnings
376-
warnings.warn('PVSystem.physicaliam is deprecated and will be removed'
377-
' in v0.8, use PVSystem.get_iam instead',
378-
pvlibDeprecationWarning)
379-
return PVSystem.get_iam(self, aoi, iam_model='physical')
380-
381361
def calcparams_desoto(self, effective_irradiance, temp_cell, **kwargs):
382362
"""
383363
Use the :py:func:`calcparams_desoto` function, the input
@@ -543,16 +523,6 @@ def sapm_spectral_loss(self, airmass_absolute):
543523
"""
544524
return sapm_spectral_loss(airmass_absolute, self.module_parameters)
545525

546-
def sapm_aoi_loss(self, aoi):
547-
"""
548-
Deprecated. Use ``PVSystem.get_iam`` instead.
549-
"""
550-
import warnings
551-
warnings.warn('PVSystem.sapm_aoi_loss is deprecated and will be'
552-
' removed in v0.8, use PVSystem.get_iam instead',
553-
pvlibDeprecationWarning)
554-
return PVSystem.get_iam(self, aoi, iam_model='sapm')
555-
556526
def sapm_effective_irradiance(self, poa_direct, poa_diffuse,
557527
airmass_absolute, aoi,
558528
reference_irradiance=1000):
@@ -1695,85 +1665,6 @@ def sapm(effective_irradiance, temp_cell, module):
16951665
return out
16961666

16971667

1698-
def _sapm_celltemp_translator(*args, **kwargs):
1699-
# TODO: remove this function after deprecation period for sapm_celltemp
1700-
new_kwargs = {}
1701-
# convert position arguments to kwargs
1702-
old_arg_list = ['poa_global', 'wind_speed', 'temp_air', 'model']
1703-
for pos in range(len(args)):
1704-
new_kwargs[old_arg_list[pos]] = args[pos]
1705-
# determine value for new kwarg 'model'
1706-
try:
1707-
param_set = new_kwargs['model']
1708-
new_kwargs.pop('model') # model is not a new kwarg
1709-
except KeyError:
1710-
# 'model' not in positional arguments, check kwargs
1711-
try:
1712-
param_set = kwargs['model']
1713-
kwargs.pop('model')
1714-
except KeyError:
1715-
# 'model' not in kwargs, use old default value
1716-
param_set = 'open_rack_glass_glass'
1717-
if type(param_set) is list:
1718-
new_kwargs.update({'a': param_set[0],
1719-
'b': param_set[1],
1720-
'deltaT': param_set[2]})
1721-
elif type(param_set) is dict:
1722-
new_kwargs.update(param_set)
1723-
else: # string
1724-
params = temperature._temperature_model_params('sapm', param_set)
1725-
new_kwargs.update(params)
1726-
new_kwargs.update(kwargs) # kwargs with unchanged names
1727-
new_kwargs['irrad_ref'] = 1000 # default for new kwarg
1728-
# convert old positional arguments to named kwargs
1729-
return temperature.sapm_cell(**new_kwargs)
1730-
1731-
1732-
sapm_celltemp = deprecated('0.7', alternative='temperature.sapm_cell',
1733-
name='sapm_celltemp', removal='0.8',
1734-
addendum='Note that the arguments and argument '
1735-
'order for temperature.sapm_cell are different '
1736-
'than for sapm_celltemp')(_sapm_celltemp_translator)
1737-
1738-
1739-
def _pvsyst_celltemp_translator(*args, **kwargs):
1740-
# TODO: remove this function after deprecation period for pvsyst_celltemp
1741-
new_kwargs = {}
1742-
# convert position arguments to kwargs
1743-
old_arg_list = ['poa_global', 'temp_air', 'wind_speed', 'eta_m',
1744-
'alpha_absorption', 'model_params']
1745-
for pos in range(len(args)):
1746-
new_kwargs[old_arg_list[pos]] = args[pos]
1747-
# determine value for new kwarg 'model'
1748-
try:
1749-
param_set = new_kwargs['model_params']
1750-
new_kwargs.pop('model_params') # model_params is not a new kwarg
1751-
except KeyError:
1752-
# 'model_params' not in positional arguments, check kwargs
1753-
try:
1754-
param_set = kwargs['model_params']
1755-
kwargs.pop('model_params')
1756-
except KeyError:
1757-
# 'model_params' not in kwargs, use old default value
1758-
param_set = 'freestanding'
1759-
if type(param_set) in (list, tuple):
1760-
new_kwargs.update({'u_c': param_set[0],
1761-
'u_v': param_set[1]})
1762-
else: # string
1763-
params = temperature._temperature_model_params('pvsyst', param_set)
1764-
new_kwargs.update(params)
1765-
new_kwargs.update(kwargs) # kwargs with unchanged names
1766-
# convert old positional arguments to named kwargs
1767-
return temperature.pvsyst_cell(**new_kwargs)
1768-
1769-
1770-
pvsyst_celltemp = deprecated(
1771-
'0.7', alternative='temperature.pvsyst_cell', name='pvsyst_celltemp',
1772-
removal='0.8', addendum='Note that the argument names for '
1773-
'temperature.pvsyst_cell are different than '
1774-
'for pvsyst_celltemp')(_pvsyst_celltemp_translator)
1775-
1776-
17771668
def sapm_spectral_loss(airmass_absolute, module):
17781669
"""
17791670
Calculates the SAPM spectral loss coefficient, F1.
@@ -2452,18 +2343,6 @@ def pvwatts_losses(soiling=2, shading=3, snow=0, mismatch=2, wiring=2,
24522343
return losses
24532344

24542345

2455-
ashraeiam = deprecated('0.7', alternative='iam.ashrae', name='ashraeiam',
2456-
removal='0.8')(iam.ashrae)
2457-
2458-
2459-
physicaliam = deprecated('0.7', alternative='iam.physical', name='physicaliam',
2460-
removal='0.8')(iam.physical)
2461-
2462-
2463-
sapm_aoi_loss = deprecated('0.7', alternative='iam.sapm', name='sapm_aoi_loss',
2464-
removal='0.8')(iam.sapm)
2465-
2466-
24672346
snlinverter = deprecated('0.8', alternative='inverter.sandia',
24682347
name='snlinverter', removal='0.9')(inverter.sandia)
24692348

pvlib/tests/test_pvsystem.py

Lines changed: 9 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,14 +1318,17 @@ def test_PVSystem_pvwatts_ac_kwargs(mocker):
13181318
assert out < pdc
13191319

13201320

1321-
@fail_on_pvlib_version('0.8')
1322-
def test_deprecated_08():
1323-
# deprecated function pvsystem.sapm_celltemp
1321+
@fail_on_pvlib_version('0.9')
1322+
def test_deprecated_09(cec_inverter_parameters, adr_inverter_parameters):
1323+
# deprecated function pvsystem.snlinverter
1324+
with pytest.warns(pvlibDeprecationWarning):
1325+
pvsystem.snlinverter(250, 40, cec_inverter_parameters)
1326+
# deprecated function pvsystem.adrinverter
13241327
with pytest.warns(pvlibDeprecationWarning):
1325-
pvsystem.sapm_celltemp(1000, 25, 1)
1326-
# deprecated function pvsystem.pvsyst_celltemp
1328+
pvsystem.adrinverter(1232, 154, adr_inverter_parameters)
1329+
# deprecated function pvsystem.spvwatts_ac
13271330
with pytest.warns(pvlibDeprecationWarning):
1328-
pvsystem.pvsyst_celltemp(1000, 25)
1331+
pvsystem.pvwatts_ac(90, 100, 0.95)
13291332
module_parameters = {'R_sh_ref': 1, 'a_ref': 1, 'I_o_ref': 1,
13301333
'alpha_sc': 1, 'I_L_ref': 1, 'R_s': 1,
13311334
'B5': 0.0, 'B4': 0.0, 'B3': 0.0, 'B2': 0.0,
@@ -1338,82 +1341,3 @@ def test_deprecated_08():
13381341
with pytest.warns(pvlibDeprecationWarning):
13391342
pvsystem.PVSystem(module_parameters=module_parameters,
13401343
racking_model='open', module_type='glass_glass')
1341-
pv = pvsystem.PVSystem(module_parameters=module_parameters,
1342-
temperature_model_parameters=temp_model_params,
1343-
racking_model='open', module_type='glass_glass')
1344-
# deprecated method PVSystem.ashraeiam
1345-
with pytest.warns(pvlibDeprecationWarning):
1346-
pv.ashraeiam(45)
1347-
# deprecated function ashraeiam
1348-
with pytest.warns(pvlibDeprecationWarning):
1349-
pvsystem.ashraeiam(45)
1350-
# deprecated method PVSystem.physicaliam
1351-
with pytest.warns(pvlibDeprecationWarning):
1352-
pv.physicaliam(45)
1353-
# deprecated function physicaliam
1354-
with pytest.warns(pvlibDeprecationWarning):
1355-
pvsystem.physicaliam(45)
1356-
# deprecated method PVSystem.sapm_aoi_loss
1357-
with pytest.warns(pvlibDeprecationWarning):
1358-
pv.sapm_aoi_loss(45)
1359-
# deprecated function sapm_aoi_loss
1360-
with pytest.warns(pvlibDeprecationWarning):
1361-
pvsystem.sapm_aoi_loss(45, {'B5': 0.0, 'B4': 0.0, 'B3': 0.0, 'B2': 0.0,
1362-
'B1': 0.0, 'B0': 1.0})
1363-
1364-
1365-
@fail_on_pvlib_version('0.8')
1366-
def test__pvsyst_celltemp_translator():
1367-
result = pvsystem._pvsyst_celltemp_translator(900, 20, 5)
1368-
assert_allclose(result, 45.137, 0.001)
1369-
result = pvsystem._pvsyst_celltemp_translator(900, 20, 5, 0.1, 0.9,
1370-
[29.0, 0.0])
1371-
assert_allclose(result, 45.137, 0.001)
1372-
result = pvsystem._pvsyst_celltemp_translator(poa_global=900, temp_air=20,
1373-
wind_speed=5)
1374-
assert_allclose(result, 45.137, 0.001)
1375-
result = pvsystem._pvsyst_celltemp_translator(900, 20, wind_speed=5)
1376-
assert_allclose(result, 45.137, 0.001)
1377-
result = pvsystem._pvsyst_celltemp_translator(900, 20, wind_speed=5.0,
1378-
u_c=23.5, u_v=6.25,
1379-
eta_m=0.1)
1380-
assert_allclose(result, 33.315, 0.001)
1381-
result = pvsystem._pvsyst_celltemp_translator(900, 20, wind_speed=5.0,
1382-
eta_m=0.1,
1383-
model_params=[23.5, 6.25])
1384-
assert_allclose(result, 33.315, 0.001)
1385-
result = pvsystem._pvsyst_celltemp_translator(900, 20, wind_speed=5.0,
1386-
eta_m=0.1,
1387-
model_params=(23.5, 6.25))
1388-
assert_allclose(result, 33.315, 0.001)
1389-
1390-
1391-
@fail_on_pvlib_version('0.8')
1392-
def test__sapm_celltemp_translator():
1393-
result = pvsystem._sapm_celltemp_translator(900, 5, 20,
1394-
'open_rack_glass_glass')
1395-
assert_allclose(result, 43.509, 3)
1396-
result = pvsystem._sapm_celltemp_translator(900, 5, temp_air=20,
1397-
model='open_rack_glass_glass')
1398-
assert_allclose(result, 43.509, 3)
1399-
params = temperature.TEMPERATURE_MODEL_PARAMETERS['sapm'][
1400-
'open_rack_glass_glass']
1401-
result = pvsystem._sapm_celltemp_translator(900, 5, 20, params)
1402-
assert_allclose(result, 43.509, 3)
1403-
result = pvsystem._sapm_celltemp_translator(900, 5, 20,
1404-
[params['a'], params['b'],
1405-
params['deltaT']])
1406-
assert_allclose(result, 43.509, 3)
1407-
1408-
1409-
@fail_on_pvlib_version('0.9')
1410-
def test_deprecated_09(cec_inverter_parameters, adr_inverter_parameters):
1411-
# deprecated function pvsystem.snlinverter
1412-
with pytest.warns(pvlibDeprecationWarning):
1413-
pvsystem.snlinverter(250, 40, cec_inverter_parameters)
1414-
# deprecated function pvsystem.adrinverter
1415-
with pytest.warns(pvlibDeprecationWarning):
1416-
pvsystem.adrinverter(1232, 154, adr_inverter_parameters)
1417-
# deprecated function pvsystem.spvwatts_ac
1418-
with pytest.warns(pvlibDeprecationWarning):
1419-
pvsystem.pvwatts_ac(90, 100, 0.95)

0 commit comments

Comments
 (0)