Skip to content

Commit 07d5c9f

Browse files
authored
Remove deprecated basic_chain method (#1862)
* Remove deprecated basic_chain * Remvoe basic_chain from docs and tests * Update v0.10.2.rst * Fix whatsnew files * Implement reviewer comments
1 parent d53f97e commit 07d5c9f

File tree

6 files changed

+7
-226
lines changed

6 files changed

+7
-226
lines changed

docs/sphinx/source/reference/modelchain.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,5 +124,4 @@ Functions for power modeling.
124124
.. autosummary::
125125
:toctree: generated/
126126

127-
modelchain.basic_chain
128127
modelchain.get_orientation

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ v0.11.0 (Anticipated June, 2024)
77

88
Breaking changes
99
~~~~~~~~~~~~~~~~
10-
* Remove the function and all its reference `poa_horizontal_ratio`. (:issue:`1697`, :pull:`2021`)
10+
* The deprecated ``pvlib.modelchain.basic_chain`` has now been removed. (:pull:`1862`)
11+
* Remove the `poa_horizontal_ratio` function and all of its references. (:issue:`1697`, :pull:`2021`)
12+
1113

1214
Deprecations
1315
~~~~~~~~~~~~

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Breaking changes
4343
* The ``orientation_strategy`` parameter has been removed from the various
4444
:py:class:`pvlib.modelchain.ModelChain` constructors and ``surface_tilt``,
4545
``surface_azimuth`` are now required parameters for
46-
:py:func:`pvlib.modelchain.basic_chain` (:issue:`1028`, :pull:`1181`)
46+
``pvlib.modelchain.basic_chain`` (:issue:`1028`, :pull:`1181`)
4747

4848
* Removed the ``**kwargs`` parameters from :py:meth:`~pvlib.pvsystem.PVSystem.sapm` and
4949
:py:meth:`~pvlib.pvsystem.PVSystem.calcparams_desoto` and

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Deprecations
88
* Moved :py:func:`pvlib.bifacial.pvfactors_timeseries` to
99
:py:func:`pvlib.bifacial.pvfactors.pvfactors_timeseries`.
1010
:py:mod:`pvlib.bifacial` is now a sub-package. (:pull:`717`)
11-
* :py:func:`pvlib.modelchain.basic_chain` is deprecated.
11+
* ``pvlib.modelchain.basic_chain`` is deprecated.
1212
See :py:meth:`pvlib.modelchain.ModelChain.with_pvwatts` and
1313
:py:meth:`pvlib.modelchain.ModelChain.with_sapm` for alternative simplified
1414
:py:class:`~pvlib.modelchain.ModelChain` interfaces, although note that the

pvlib/modelchain.py

Lines changed: 2 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@
1313
from dataclasses import dataclass, field
1414
from typing import Union, Tuple, Optional, TypeVar
1515

16-
from pvlib import (atmosphere, clearsky, inverter, pvsystem, solarposition,
17-
temperature, iam)
16+
from pvlib import pvsystem, iam
1817
import pvlib.irradiance # avoid name conflict with full import
1918
from pvlib.pvsystem import _DC_MODEL_PARAMS
2019
from pvlib.tools import _build_kwargs
2120

22-
from pvlib._deprecation import deprecated
23-
2421
# keys that are used to detect input data and assign data to appropriate
2522
# ModelChain attribute
2623
# for ModelChain.weather
@@ -41,7 +38,7 @@
4138

4239
# these dictionaries contain the default configuration for following
4340
# established modeling sequences. They can be used in combination with
44-
# basic_chain and ModelChain. They are used by the ModelChain methods
41+
# ModelChain, particularly they are used by the methods
4542
# ModelChain.with_pvwatts, ModelChain.with_sapm, etc.
4643

4744
# pvwatts documentation states that it uses the following reference for
@@ -62,165 +59,6 @@
6259
)
6360

6461

65-
@deprecated(
66-
since='0.9.1',
67-
name='pvlib.modelchain.basic_chain',
68-
alternative=('pvlib.modelchain.ModelChain.with_pvwatts'
69-
' or pvlib.modelchain.ModelChain.with_sapm'),
70-
addendum='Note that the with_xyz methods take different model parameters.'
71-
)
72-
def basic_chain(times, latitude, longitude,
73-
surface_tilt, surface_azimuth,
74-
module_parameters, temperature_model_parameters,
75-
inverter_parameters,
76-
irradiance=None, weather=None,
77-
transposition_model='haydavies',
78-
solar_position_method='nrel_numpy',
79-
airmass_model='kastenyoung1989',
80-
altitude=None, pressure=None,
81-
**kwargs):
82-
"""
83-
An experimental function that computes all of the modeling steps
84-
necessary for calculating power or energy for a PV system at a given
85-
location.
86-
87-
Parameters
88-
----------
89-
times : DatetimeIndex
90-
Times at which to evaluate the model.
91-
92-
latitude : float.
93-
Positive is north of the equator.
94-
Use decimal degrees notation.
95-
96-
longitude : float.
97-
Positive is east of the prime meridian.
98-
Use decimal degrees notation.
99-
100-
surface_tilt : numeric
101-
Surface tilt angles in decimal degrees.
102-
The tilt angle is defined as degrees from horizontal
103-
(e.g. surface facing up = 0, surface facing horizon = 90)
104-
105-
surface_azimuth : numeric
106-
Surface azimuth angles in decimal degrees.
107-
The azimuth convention is defined
108-
as degrees east of north
109-
(North=0, South=180, East=90, West=270).
110-
111-
module_parameters : dict or Series
112-
Module parameters as defined by the SAPM. See pvsystem.sapm for
113-
details.
114-
115-
temperature_model_parameters : dict or Series
116-
Temperature model parameters as defined by the SAPM.
117-
See temperature.sapm_cell for details.
118-
119-
inverter_parameters : dict or Series
120-
Inverter parameters as defined by the CEC. See
121-
:py:func:`inverter.sandia` for details.
122-
123-
irradiance : DataFrame, optional
124-
If not specified, calculates clear sky data.
125-
Columns must be 'dni', 'ghi', 'dhi'.
126-
127-
weather : DataFrame, optional
128-
If not specified, assumes air temperature is 20 C and
129-
wind speed is 0 m/s.
130-
Columns must be 'wind_speed', 'temp_air'.
131-
132-
transposition_model : str, default 'haydavies'
133-
Passed to system.get_irradiance.
134-
135-
solar_position_method : str, default 'nrel_numpy'
136-
Passed to solarposition.get_solarposition.
137-
138-
airmass_model : str, default 'kastenyoung1989'
139-
Passed to atmosphere.relativeairmass.
140-
141-
altitude : float, optional
142-
If not specified, computed from ``pressure``. Assumed to be 0 m
143-
if ``pressure`` is also unspecified.
144-
145-
pressure : float, optional
146-
If not specified, computed from ``altitude``. Assumed to be 101325 Pa
147-
if ``altitude`` is also unspecified.
148-
149-
**kwargs
150-
Arbitrary keyword arguments.
151-
See code for details.
152-
153-
Returns
154-
-------
155-
output : (dc, ac)
156-
Tuple of DC power (with SAPM parameters) (DataFrame) and AC
157-
power (Series).
158-
"""
159-
160-
if altitude is None and pressure is None:
161-
altitude = 0.
162-
pressure = 101325.
163-
elif altitude is None:
164-
altitude = atmosphere.pres2alt(pressure)
165-
elif pressure is None:
166-
pressure = atmosphere.alt2pres(altitude)
167-
168-
solar_position = solarposition.get_solarposition(
169-
times, latitude, longitude, altitude=altitude, pressure=pressure,
170-
method=solar_position_method, **kwargs)
171-
172-
# possible error with using apparent zenith with some models
173-
airmass = atmosphere.get_relative_airmass(
174-
solar_position['apparent_zenith'], model=airmass_model)
175-
airmass = atmosphere.get_absolute_airmass(airmass, pressure)
176-
dni_extra = pvlib.irradiance.get_extra_radiation(solar_position.index)
177-
178-
aoi = pvlib.irradiance.aoi(surface_tilt, surface_azimuth,
179-
solar_position['apparent_zenith'],
180-
solar_position['azimuth'])
181-
182-
if irradiance is None:
183-
linke_turbidity = clearsky.lookup_linke_turbidity(
184-
solar_position.index, latitude, longitude)
185-
irradiance = clearsky.ineichen(
186-
solar_position['apparent_zenith'],
187-
airmass,
188-
linke_turbidity,
189-
altitude=altitude,
190-
dni_extra=dni_extra
191-
)
192-
193-
total_irrad = pvlib.irradiance.get_total_irradiance(
194-
surface_tilt,
195-
surface_azimuth,
196-
solar_position['apparent_zenith'],
197-
solar_position['azimuth'],
198-
irradiance['dni'],
199-
irradiance['ghi'],
200-
irradiance['dhi'],
201-
model=transposition_model,
202-
dni_extra=dni_extra)
203-
204-
if weather is None:
205-
weather = {'wind_speed': 0, 'temp_air': 20}
206-
207-
cell_temperature = temperature.sapm_cell(
208-
total_irrad['poa_global'], weather['temp_air'], weather['wind_speed'],
209-
temperature_model_parameters['a'], temperature_model_parameters['b'],
210-
temperature_model_parameters['deltaT'])
211-
212-
effective_irradiance = pvsystem.sapm_effective_irradiance(
213-
total_irrad['poa_direct'], total_irrad['poa_diffuse'], airmass, aoi,
214-
module_parameters)
215-
216-
dc = pvsystem.sapm(effective_irradiance, cell_temperature,
217-
module_parameters)
218-
219-
ac = inverter.sandia(dc['v_mp'], dc['p_mp'], inverter_parameters)
220-
221-
return dc, ac
222-
223-
22462
def get_orientation(strategy, **kwargs):
22563
"""
22664
Determine a PV system's surface tilt and surface azimuth
@@ -238,7 +76,6 @@ def get_orientation(strategy, **kwargs):
23876
-------
23977
surface_tilt, surface_azimuth
24078
"""
241-
24279
if strategy == 'south_at_latitude_tilt':
24380
surface_azimuth = 180
24481
surface_tilt = kwargs['latitude']

pvlib/tests/test_modelchain.py

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,63 +1787,6 @@ def test_ModelChain_no_extra_kwargs(sapm_dc_snl_ac_system, location):
17871787
ModelChain(sapm_dc_snl_ac_system, location, arbitrary_kwarg='value')
17881788

17891789

1790-
def test_basic_chain_alt_az(sam_data, cec_inverter_parameters,
1791-
sapm_temperature_cs5p_220m):
1792-
times = pd.date_range(start='20160101 1200-0700',
1793-
end='20160101 1800-0700', freq='6h')
1794-
latitude = 32.2
1795-
longitude = -111
1796-
surface_tilt = 0
1797-
surface_azimuth = 0
1798-
modules = sam_data['sandiamod']
1799-
module_parameters = modules['Canadian_Solar_CS5P_220M___2009_']
1800-
temp_model_params = sapm_temperature_cs5p_220m.copy()
1801-
with pytest.warns(pvlibDeprecationWarning, match='with_pvwatts'):
1802-
dc, ac = modelchain.basic_chain(times, latitude, longitude,
1803-
surface_tilt, surface_azimuth,
1804-
module_parameters, temp_model_params,
1805-
cec_inverter_parameters)
1806-
1807-
expected = pd.Series(np.array([111.621405, -2.00000000e-02]),
1808-
index=times)
1809-
assert_series_equal(ac, expected)
1810-
1811-
1812-
def test_basic_chain_altitude_pressure(sam_data, cec_inverter_parameters,
1813-
sapm_temperature_cs5p_220m):
1814-
times = pd.date_range(start='20160101 1200-0700',
1815-
end='20160101 1800-0700', freq='6h')
1816-
latitude = 32.2
1817-
longitude = -111
1818-
altitude = 700
1819-
surface_tilt = 0
1820-
surface_azimuth = 0
1821-
modules = sam_data['sandiamod']
1822-
module_parameters = modules['Canadian_Solar_CS5P_220M___2009_']
1823-
temp_model_params = sapm_temperature_cs5p_220m.copy()
1824-
with pytest.warns(pvlibDeprecationWarning, match='with_pvwatts'):
1825-
dc, ac = modelchain.basic_chain(times, latitude, longitude,
1826-
surface_tilt, surface_azimuth,
1827-
module_parameters, temp_model_params,
1828-
cec_inverter_parameters,
1829-
pressure=93194)
1830-
1831-
expected = pd.Series(np.array([113.190045, -2.00000000e-02]),
1832-
index=times)
1833-
assert_series_equal(ac, expected)
1834-
1835-
with pytest.warns(pvlibDeprecationWarning, match='with_pvwatts'):
1836-
dc, ac = modelchain.basic_chain(times, latitude, longitude,
1837-
surface_tilt, surface_azimuth,
1838-
module_parameters, temp_model_params,
1839-
cec_inverter_parameters,
1840-
altitude=altitude)
1841-
1842-
expected = pd.Series(np.array([113.189814, -2.00000000e-02]),
1843-
index=times)
1844-
assert_series_equal(ac, expected)
1845-
1846-
18471790
def test_complete_irradiance_clean_run(sapm_dc_snl_ac_system, location):
18481791
"""The DataFrame should not change if all columns are passed"""
18491792
mc = ModelChain(sapm_dc_snl_ac_system, location)

0 commit comments

Comments
 (0)