Skip to content

Commit 85cd89c

Browse files
authored
Remove orientation_strategy from Modelchain (#1181)
* remove orientation_strategy parameter from modelchain.py * update tests * scrub docs * whatsnew
1 parent 8b98768 commit 85cd89c

File tree

6 files changed

+41
-190
lines changed

6 files changed

+41
-190
lines changed

docs/sphinx/source/api.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,6 @@ ModelChain properties that are aliases for your specific modeling functions.
609609
.. autosummary::
610610
:toctree: generated/
611611

612-
modelchain.ModelChain.orientation_strategy
613612
modelchain.ModelChain.dc_model
614613
modelchain.ModelChain.ac_model
615614
modelchain.ModelChain.aoi_model

docs/sphinx/source/introtutorial.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,6 @@ by examining the parameters defined for the module.
190190
from pvlib.location import Location
191191
from pvlib.modelchain import ModelChain
192192
193-
system = PVSystem(
194-
module_parameters=module,
195-
inverter_parameters=inverter,
196-
temperature_model_parameters=temperature_model_parameters,
197-
)
198-
199193
energies = {}
200194
for location, weather in zip(coordinates, tmys):
201195
latitude, longitude, name, altitude, timezone = location
@@ -206,11 +200,15 @@ by examining the parameters defined for the module.
206200
altitude=altitude,
207201
tz=timezone,
208202
)
209-
mc = ModelChain(
210-
system,
211-
location,
212-
orientation_strategy='south_at_latitude_tilt',
203+
system = PVSystem(
204+
surface_tilt=latitude,
205+
surface_azimuth=180,
206+
module_parameters=module,
207+
inverter_parameters=inverter,
208+
temperature_model_parameters=temperature_model_parameters,
213209
)
210+
211+
mc = ModelChain(system, location)
214212
results = mc.run_model(weather)
215213
annual_energy = results.ac.sum()
216214
energies[name] = annual_energy

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ Breaking changes
4040
``ModelChain.adrinverter`` changed to ``ModelChain.adr_inverter``.
4141
(:pull:`1150`)
4242

43+
* The ``orientation_strategy`` parameter has been removed from the various
44+
:py:class:`pvlib.modelchain.ModelChain` constructors and ``surface_tilt``,
45+
``surface_azimuth`` are now required parameters for
46+
:py:func:`pvlib.modelchain.basic_chain` (:issue:`1028`, :pull:`1181`)
47+
4348

4449
Deprecations
4550
~~~~~~~~~~~~

docs/tutorials/forecast.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6664,7 +6664,6 @@
66646664
"text/plain": [
66656665
"ModelChain: \n",
66666666
" name: None\n",
6667-
" orientation_strategy: south_at_latitude_tilt\n",
66686667
" clearsky_model: ineichen\n",
66696668
" transposition_model: haydavies\n",
66706669
" solar_position_method: nrel_numpy\n",
@@ -6692,15 +6691,16 @@
66926691
"inverter = sapm_inverters['ABB__MICRO_0_25_I_OUTD_US_208__208V_']\n",
66936692
"\n",
66946693
"system = PVSystem(module_parameters=module,\n",
6695-
" inverter_parameters=inverter)\n",
6694+
" inverter_parameters=inverter,\n",
6695+
" surface_tilt=latitude,\n",
6696+
" surface_azimuth=180)\n",
66966697
"\n",
66976698
"# fx is a common abbreviation for forecast\n",
66986699
"fx_model = GFS()\n",
66996700
"fx_data = fx_model.get_processed_data(latitude, longitude, start, end)\n",
67006701
"\n",
67016702
"# use a ModelChain object to calculate modeling intermediates\n",
6702-
"mc = ModelChain(system, fx_model.location,\n",
6703-
" orientation_strategy='south_at_latitude_tilt')\n",
6703+
"mc = ModelChain(system, fx_model.location)\n",
67046704
"\n",
67056705
"# extract relevant data for model chain\n",
67066706
"mc.run_model(weather=fx_data)"

pvlib/modelchain.py

Lines changed: 13 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,10 @@
6363

6464

6565
def basic_chain(times, latitude, longitude,
66+
surface_tilt, surface_azimuth,
6667
module_parameters, temperature_model_parameters,
6768
inverter_parameters,
6869
irradiance=None, weather=None,
69-
surface_tilt=None, surface_azimuth=None,
70-
orientation_strategy=None,
7170
transposition_model='haydavies',
7271
solar_position_method='nrel_numpy',
7372
airmass_model='kastenyoung1989',
@@ -91,6 +90,17 @@ def basic_chain(times, latitude, longitude,
9190
Positive is east of the prime meridian.
9291
Use decimal degrees notation.
9392
93+
surface_tilt : numeric
94+
Surface tilt angles in decimal degrees.
95+
The tilt angle is defined as degrees from horizontal
96+
(e.g. surface facing up = 0, surface facing horizon = 90)
97+
98+
surface_azimuth : numeric
99+
Surface azimuth angles in decimal degrees.
100+
The azimuth convention is defined
101+
as degrees east of north
102+
(North=0, South=180, East=90, West=270).
103+
94104
module_parameters : None, dict or Series
95105
Module parameters as defined by the SAPM. See pvsystem.sapm for
96106
details.
@@ -112,23 +122,6 @@ def basic_chain(times, latitude, longitude,
112122
wind speed is 0 m/s.
113123
Columns must be 'wind_speed', 'temp_air'.
114124
115-
surface_tilt : None, float or Series, default None
116-
Surface tilt angles in decimal degrees.
117-
The tilt angle is defined as degrees from horizontal
118-
(e.g. surface facing up = 0, surface facing horizon = 90)
119-
120-
surface_azimuth : None, float or Series, default None
121-
Surface azimuth angles in decimal degrees.
122-
The azimuth convention is defined
123-
as degrees east of north
124-
(North=0, South=180, East=90, West=270).
125-
126-
orientation_strategy : None or str, default None
127-
The strategy for aligning the modules.
128-
If not None, sets the ``surface_azimuth`` and ``surface_tilt``
129-
properties of the ``system``. Allowed strategies include 'flat',
130-
'south_at_latitude_tilt'. Ignored for SingleAxisTracker systems.
131-
132125
transposition_model : str, default 'haydavies'
133126
Passed to system.get_irradiance.
134127
@@ -157,17 +150,6 @@ def basic_chain(times, latitude, longitude,
157150
power (Series).
158151
"""
159152

160-
# use surface_tilt and surface_azimuth if provided,
161-
# otherwise set them using the orientation_strategy
162-
if surface_tilt is not None and surface_azimuth is not None:
163-
pass
164-
elif orientation_strategy is not None:
165-
surface_tilt, surface_azimuth = \
166-
get_orientation(orientation_strategy, latitude=latitude)
167-
else:
168-
raise ValueError('orientation_strategy or surface_tilt and '
169-
'surface_azimuth must be provided')
170-
171153
if altitude is None and pressure is None:
172154
altitude = 0.
173155
pressure = 101325.
@@ -332,12 +314,6 @@ class ModelChain:
332314
A :py:class:`~pvlib.location.Location` object that represents
333315
the physical location at which to evaluate the model.
334316
335-
orientation_strategy : None or str, default None
336-
The strategy for aligning the modules. If not None, sets the
337-
``surface_azimuth`` and ``surface_tilt`` properties of the
338-
``system``. Allowed strategies include 'flat',
339-
'south_at_latitude_tilt'. Ignored for SingleAxisTracker systems.
340-
341317
clearsky_model : str, default 'ineichen'
342318
Passed to location.get_clearsky.
343319
@@ -395,7 +371,6 @@ class ModelChain:
395371
'dc', 'ac', 'diode_params', 'tracking']
396372

397373
def __init__(self, system, location,
398-
orientation_strategy=None,
399374
clearsky_model='ineichen',
400375
transposition_model='haydavies',
401376
solar_position_method='nrel_numpy',
@@ -421,7 +396,6 @@ def __init__(self, system, location,
421396
self.temperature_model = temperature_model
422397

423398
self.losses_model = losses_model
424-
self.orientation_strategy = orientation_strategy
425399

426400
self.weather = None
427401
self.times = None
@@ -451,7 +425,6 @@ def __setattr__(self, key, value):
451425

452426
@classmethod
453427
def with_pvwatts(cls, system, location,
454-
orientation_strategy=None,
455428
clearsky_model='ineichen',
456429
airmass_model='kastenyoung1989',
457430
name=None,
@@ -469,12 +442,6 @@ def with_pvwatts(cls, system, location,
469442
A :py:class:`~pvlib.location.Location` object that represents
470443
the physical location at which to evaluate the model.
471444
472-
orientation_strategy : None or str, default None
473-
The strategy for aligning the modules. If not None, sets the
474-
``surface_azimuth`` and ``surface_tilt`` properties of the
475-
``system``. Allowed strategies include 'flat',
476-
'south_at_latitude_tilt'. Ignored for SingleAxisTracker systems.
477-
478445
clearsky_model : str, default 'ineichen'
479446
Passed to location.get_clearsky.
480447
@@ -502,7 +469,6 @@ def with_pvwatts(cls, system, location,
502469
>>> ModelChain.with_pvwatts(system, location)
503470
ModelChain:
504471
name: None
505-
orientation_strategy: None
506472
clearsky_model: ineichen
507473
transposition_model: perez
508474
solar_position_method: nrel_numpy
@@ -518,7 +484,6 @@ def with_pvwatts(cls, system, location,
518484
config.update(kwargs)
519485
return ModelChain(
520486
system, location,
521-
orientation_strategy=orientation_strategy,
522487
clearsky_model=clearsky_model,
523488
airmass_model=airmass_model,
524489
name=name,
@@ -527,7 +492,6 @@ def with_pvwatts(cls, system, location,
527492

528493
@classmethod
529494
def with_sapm(cls, system, location,
530-
orientation_strategy=None,
531495
clearsky_model='ineichen',
532496
transposition_model='haydavies',
533497
solar_position_method='nrel_numpy',
@@ -548,12 +512,6 @@ def with_sapm(cls, system, location,
548512
A :py:class:`~pvlib.location.Location` object that represents
549513
the physical location at which to evaluate the model.
550514
551-
orientation_strategy : None or str, default None
552-
The strategy for aligning the modules. If not None, sets the
553-
``surface_azimuth`` and ``surface_tilt`` properties of the
554-
``system``. Allowed strategies include 'flat',
555-
'south_at_latitude_tilt'. Ignored for SingleAxisTracker systems.
556-
557515
clearsky_model : str, default 'ineichen'
558516
Passed to location.get_clearsky.
559517
@@ -589,7 +547,6 @@ def with_sapm(cls, system, location,
589547
>>> ModelChain.with_sapm(system, location)
590548
ModelChain:
591549
name: None
592-
orientation_strategy: None
593550
clearsky_model: ineichen
594551
transposition_model: haydavies
595552
solar_position_method: nrel_numpy
@@ -605,7 +562,6 @@ def with_sapm(cls, system, location,
605562
config.update(kwargs)
606563
return ModelChain(
607564
system, location,
608-
orientation_strategy=orientation_strategy,
609565
clearsky_model=clearsky_model,
610566
transposition_model=transposition_model,
611567
solar_position_method=solar_position_method,
@@ -616,7 +572,7 @@ def with_sapm(cls, system, location,
616572

617573
def __repr__(self):
618574
attrs = [
619-
'name', 'orientation_strategy', 'clearsky_model',
575+
'name', 'clearsky_model',
620576
'transposition_model', 'solar_position_method',
621577
'airmass_model', 'dc_model', 'ac_model', 'aoi_model',
622578
'spectral_model', 'temperature_model', 'losses_model'
@@ -634,21 +590,6 @@ def getmcattr(self, attr):
634590
return ('ModelChain: \n ' + '\n '.join(
635591
f'{attr}: {getmcattr(self, attr)}' for attr in attrs))
636592

637-
@property
638-
def orientation_strategy(self):
639-
return self._orientation_strategy
640-
641-
@orientation_strategy.setter
642-
def orientation_strategy(self, strategy):
643-
if strategy == 'None':
644-
strategy = None
645-
646-
if strategy is not None:
647-
self.system.surface_tilt, self.system.surface_azimuth = \
648-
get_orientation(strategy, latitude=self.location.latitude)
649-
650-
self._orientation_strategy = strategy
651-
652593
@property
653594
def dc_model(self):
654595
return self._dc_model

0 commit comments

Comments
 (0)