Skip to content

Commit

Permalink
Remove v0.9.0 deprecations (#1771)
Browse files Browse the repository at this point in the history
* remove SingleAxisTracker

* remove pvsyst_cell's `eta_m`

* Remove deprecated PVSystem inverter and temperature methods

* remove deprecated PVSystem attribute passthrough

* remove overlooked eta_m test

* remove deprecated ModelChain attribute passthrough

* whatsnew

* scrub sphinx docs
  • Loading branch information
kandersolar authored Jun 23, 2023
1 parent 9d8ca55 commit 6606af7
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 1,048 deletions.
1 change: 0 additions & 1 deletion docs/sphinx/source/reference/classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ the :ref:`pvsystemdoc` and :ref:`modelchaindoc` pages.
pvsystem.Array
pvsystem.FixedMount
pvsystem.SingleAxisTrackerMount
tracking.SingleAxisTracker
modelchain.ModelChain
modelchain.ModelChainResult
1 change: 0 additions & 1 deletion docs/sphinx/source/reference/irradiance/class-methods.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ Methods for irradiance calculations
pvsystem.PVSystem.get_irradiance
pvsystem.PVSystem.get_aoi
pvsystem.PVSystem.get_iam
tracking.SingleAxisTracker.get_irradiance
13 changes: 0 additions & 13 deletions docs/sphinx/source/reference/tracking.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,6 @@
Tracking
========

SingleAxisTracker
-----------------

The :py:class:`~tracking.SingleAxisTracker` inherits from
:py:class:`~pvsystem.PVSystem`.

.. autosummary::
:toctree: generated/

tracking.SingleAxisTracker
tracking.SingleAxisTracker.singleaxis
tracking.SingleAxisTracker.get_irradiance

Functions
---------

Expand Down
1 change: 0 additions & 1 deletion docs/sphinx/source/user_guide/comparison_pvlib_matlab.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ Major differences
* pvlib-python implements a handful of class designed to simplify the
PV modeling process. These include :py:class:`~pvlib.location.Location`,
:py:class:`~pvlib.pvsystem.PVSystem`,
:py:class:`~pvlib.tracking.SingleAxisTracker`,
and
:py:class:`~pvlib.modelchain.ModelChain`.

Expand Down
13 changes: 0 additions & 13 deletions docs/sphinx/source/user_guide/pvsystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -323,16 +323,3 @@ methods that calculate system losses. At present, these methods include
only :py:meth:`pvlib.pvsystem.PVSystem.pvwatts_losses` and
:py:func:`pvlib.pvsystem.pvwatts_losses`, but we hope to add more related functions
and methods in the future.


.. _sat:

SingleAxisTracker
-----------------

The :py:class:`~pvlib.tracking.SingleAxisTracker` is a subclass of
:py:class:`~pvlib.pvsystem.PVSystem`. The SingleAxisTracker class
includes a few more keyword arguments and attributes that are specific
to trackers, plus the
:py:meth:`~pvlib.tracking.SingleAxisTracker.singleaxis` method. It also
overrides the `get_aoi` and `get_irradiance` methods.
11 changes: 11 additions & 0 deletions docs/sphinx/source/whatsnew/v0.9.6.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ Breaking Changes
(:pull:`1768`)
* For consistency with the rest of pvlib, the ``tilt`` parameter is renamed
to ``surface_tilt`` in :py:func:`pvlib.soiling.hsu`. (:issue:`1717`, :pull:`1738`)
* The following, originally deprecated in :ref:`whatsnew_0900`, is now removed: (:pull:`1770`)

- The :py:class:`pvlib.tracking.SingleAxisTracker` class
- The various model-specific :py:class:`~pvlib.pvsystem.PVSystem` inverter
and cell temperature methods
- Attribute "pass-through" from :py:class:`~pvlib.modelchain.ModelChain`
to :py:class:`~pvlib.modelchain.ModelChainResult`
- Attribute "pass-through" from :py:class:`~pvlib.pvsystem.PVSystem`
to :py:class:`~pvlib.pvsystem.Array`
- The ``eta_m`` parameter in :py:func:`pvlib.temperature.pvsyst_cell`


Deprecations
~~~~~~~~~~~~
Expand Down
59 changes: 6 additions & 53 deletions pvlib/modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
from typing import Union, Tuple, Optional, TypeVar

from pvlib import (atmosphere, clearsky, inverter, pvsystem, solarposition,
temperature, tools)
from pvlib.tracking import SingleAxisTracker
temperature)
import pvlib.irradiance # avoid name conflict with full import
from pvlib.pvsystem import _DC_MODEL_PARAMS
from pvlib._deprecation import pvlibDeprecationWarning
Expand Down Expand Up @@ -465,13 +464,6 @@ class ModelChain:
Name of ModelChain instance.
"""

# list of deprecated attributes
_deprecated_attrs = ['solar_position', 'airmass', 'total_irrad',
'aoi', 'aoi_modifier', 'spectral_modifier',
'cell_temperature', 'effective_irradiance',
'dc', 'ac', 'diode_params', 'tracking',
'weather', 'times', 'losses']

def __init__(self, system, location,
clearsky_model='ineichen',
transposition_model='haydavies',
Expand Down Expand Up @@ -503,26 +495,6 @@ def __init__(self, system, location,

self.results = ModelChainResult()

def __getattr__(self, key):
if key in ModelChain._deprecated_attrs:
msg = f'ModelChain.{key} is deprecated and will' \
f' be removed in v0.10. Use' \
f' ModelChain.results.{key} instead'
warnings.warn(msg, pvlibDeprecationWarning)
return getattr(self.results, key)
# __getattr__ is only called if __getattribute__ fails.
# In that case we should check if key is a deprecated attribute,
# and fail with an AttributeError if it is not.
raise AttributeError

def __setattr__(self, key, value):
if key in ModelChain._deprecated_attrs:
msg = f'ModelChain.{key} is deprecated from v0.9. Use' \
f' ModelChain.results.{key} instead'
warnings.warn(msg, pvlibDeprecationWarning)
setattr(self.results, key, value)
else:
super().__setattr__(key, value)

@classmethod
def with_pvwatts(cls, system, location,
Expand Down Expand Up @@ -1535,27 +1507,11 @@ def prepare_inputs(self, weather):
self._prep_inputs_solar_pos(weather)
self._prep_inputs_airmass()
self._prep_inputs_albedo(weather)
self._prep_inputs_fixed()

# PVSystem.get_irradiance and SingleAxisTracker.get_irradiance
# and PVSystem.get_aoi and SingleAxisTracker.get_aoi
# have different method signatures. Use partial to handle
# the differences.
if isinstance(self.system, SingleAxisTracker):
self._prep_inputs_tracking()
get_irradiance = partial(
self.system.get_irradiance,
self.results.tracking['surface_tilt'],
self.results.tracking['surface_azimuth'],
self.results.solar_position['apparent_zenith'],
self.results.solar_position['azimuth'])
else:
self._prep_inputs_fixed()
get_irradiance = partial(
self.system.get_irradiance,
self.results.solar_position['apparent_zenith'],
self.results.solar_position['azimuth'])

self.results.total_irrad = get_irradiance(
self.results.total_irrad = self.system.get_irradiance(
self.results.solar_position['apparent_zenith'],
self.results.solar_position['azimuth'],
_tuple_from_dfs(self.results.weather, 'dni'),
_tuple_from_dfs(self.results.weather, 'ghi'),
_tuple_from_dfs(self.results.weather, 'dhi'),
Expand Down Expand Up @@ -1636,10 +1592,7 @@ def prepare_inputs_from_poa(self, data):
self._prep_inputs_solar_pos(data)
self._prep_inputs_airmass()

if isinstance(self.system, SingleAxisTracker):
self._prep_inputs_tracking()
else:
self._prep_inputs_fixed()
self._prep_inputs_fixed()

return self

Expand Down
Loading

0 comments on commit 6606af7

Please sign in to comment.