From d1c328a9fca64678312f8f170dba16dae492b260 Mon Sep 17 00:00:00 2001 From: Johann Lo <65318981+JoLo90@users.noreply.github.com> Date: Fri, 29 May 2026 11:27:30 +0200 Subject: [PATCH 1/4] refactor: deprecate dead code --- docs/sphinx/source/whatsnew/v0.15.2.rst | 9 ++++++++ pvlib/iotools/bsrn.py | 2 +- pvlib/iotools/epw.py | 2 +- pvlib/iotools/sodapro.py | 2 +- pvlib/irradiance.py | 21 +++++++++++++---- pvlib/modelchain.py | 13 ++++++++++- pvlib/tracking.py | 2 +- tests/test_clearsky.py | 14 ++++++++++-- tests/test_irradiance.py | 9 ++++++++ tests/test_modelchain.py | 30 +++++++++++++++++++++++-- 10 files changed, 91 insertions(+), 13 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.15.2.rst b/docs/sphinx/source/whatsnew/v0.15.2.rst index 97383a5723..2841cf8b4c 100644 --- a/docs/sphinx/source/whatsnew/v0.15.2.rst +++ b/docs/sphinx/source/whatsnew/v0.15.2.rst @@ -13,6 +13,15 @@ Deprecations :py:func:`~pvlib.irradiance.ghi_from_poa_driesse_2024`. The year now reflects the publication date. The old name will be removed in v0.17.0. (:issue:`2774`, :pull:`2777`) +* The function :py:func:`pvlib.clearsky._is_leap_year` is deprecated and will be + removed in v0.17.0. Use :py:func:`pandas.Timestamp.is_leap_year` instead. + (:issue: `2764`, :pull:`2766`) +* The function :py:func:`pvlib.irradiance._liujordan` is deprecated and will be + removed in v0.17.0. (:issue: `2764`, :pull:`2766`) +* The function :py:func:`pvlib.modelchain.get_orientation` is deprecated and will + be removed in v0.17.0. (:issue: `2764`, :pull:`2766`) +* The method :py:meth:`pvlib.modelchain.ModelChain._prep_inputs_tracking` is + deprecated and will be removed in v0.17.0. (:issue: `2764`, :pull:`2766`) Bug fixes diff --git a/pvlib/iotools/bsrn.py b/pvlib/iotools/bsrn.py index fff3f72614..9e6c222314 100644 --- a/pvlib/iotools/bsrn.py +++ b/pvlib/iotools/bsrn.py @@ -464,5 +464,5 @@ def read_bsrn(filename, logical_records=('0100',)): return content -parse_bsrn = deprecated(since="0.13.0", name="parse_bsrn", +parse_bsrn = deprecated(since="0.13.0", removal="0.17.0", name="parse_bsrn", alternative="read_bsrn")(read_bsrn) diff --git a/pvlib/iotools/epw.py b/pvlib/iotools/epw.py index 4355e7619f..561419fc00 100644 --- a/pvlib/iotools/epw.py +++ b/pvlib/iotools/epw.py @@ -311,5 +311,5 @@ def _parse_epw(csvdata, coerce_year=None): return data, meta -parse_epw = deprecated(since="0.13.0", name="parse_epw", +parse_epw = deprecated(since="0.13.0", removal="0.17.0", name="parse_epw", alternative="read_epw")(read_epw) diff --git a/pvlib/iotools/sodapro.py b/pvlib/iotools/sodapro.py index be11dbf260..81212d8112 100644 --- a/pvlib/iotools/sodapro.py +++ b/pvlib/iotools/sodapro.py @@ -359,5 +359,5 @@ def read_cams(filename, integrated=False, label=None, map_variables=True): return data, metadata -parse_cams = deprecated(since="0.13.0", name="parse_cams", +parse_cams = deprecated(since="0.13.0", removal="0.17.0", name="parse_cams", alternative="read_cams")(read_cams) diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index 677cdba60f..b7a1378590 100644 --- a/pvlib/irradiance.py +++ b/pvlib/irradiance.py @@ -18,6 +18,7 @@ from pvlib._deprecation import pvlibDeprecationWarning, deprecated import warnings +from pvlib._deprecation import deprecated # Deprecation warning based on https://peps.python.org/pep-0562/ @@ -3234,7 +3235,14 @@ def campbell_norman(zenith, transmittance, pressure=101325.0, return irrads -def _liujordan(zenith, transmittance, airmass, dni_extra=1367.0): +@deprecated( + since="0.15.2", + removal="0.17.0", + name="_liujordan", + addendum=None, +) +def _liujordan(zenith: pd.Series, transmittance: float, + airmass: float, dni_extra=1367.0) -> pd.DataFrame: ''' Determine DNI, DHI, GHI from extraterrestrial flux, transmittance, and optical air mass number. @@ -3253,11 +3261,11 @@ def _liujordan(zenith, transmittance, airmass, dni_extra=1367.0): transmittance: float Atmospheric transmittance between 0 and 1. - airmass: numeric - Optical air mass. [unitless] + airmass: float + Absolute airmass. dni_extra: float, default 1367.0 - Direct irradiance incident at the top of the atmosphere. + Direct irradiance incident at the top of the atmosphere. [W/m²] Returns ------- @@ -3273,6 +3281,11 @@ def _liujordan(zenith, transmittance, airmass, dni_extra=1367.0): .. [2] Liu, B. Y., R. C. Jordan, (1960). "The interrelationship and characteristic distribution of direct, diffuse, and total solar radiation". Solar Energy 4:1-19 + + .. deprecated:: 0.15.2 + The ``_liujordan`` function is deprecated and will be + removed in 0.17.0. + Use the ``liujordan`` function instead. ''' tau = transmittance diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index cf7a5bf7e5..34f9f04600 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -63,7 +63,7 @@ @deprecated( since="0.13.1", - removal="", + removal="0.17.0", name="pvlib.modelchain.get_orientation", alternative=None, addendum=None, @@ -84,6 +84,10 @@ def get_orientation(strategy, **kwargs): Returns ------- surface_tilt, surface_azimuth + + .. deprecated:: 0.15.2 + The ``get_orientation`` function is deprecated and will be removed + in 0.17.0. """ if strategy == 'south_at_latitude_tilt': surface_azimuth = 180 @@ -1261,6 +1265,13 @@ def _prep_inputs_airmass(self): model=self.airmass_model) return self + @deprecated( + since="0.15.2", + removal="0.17.0", + name="Modelchain._prep_inputs_tracking", + alternative=None, + addendum=None, + ) def _prep_inputs_tracking(self): """ Calculate tracker position and AOI diff --git a/pvlib/tracking.py b/pvlib/tracking.py index 69c679ef79..e234887cd0 100644 --- a/pvlib/tracking.py +++ b/pvlib/tracking.py @@ -1,7 +1,7 @@ import numpy as np import pandas as pd -from pvlib.tools import cosd, sind, tand, acosd, asind +from pvlib.tools import cosd, sind, tand, acosd from pvlib import irradiance from pvlib import shading from pvlib._deprecation import renamed_kwarg_warning diff --git a/tests/test_clearsky.py b/tests/test_clearsky.py index 638dfb0bc5..d55fd0cc1e 100644 --- a/tests/test_clearsky.py +++ b/tests/test_clearsky.py @@ -8,13 +8,15 @@ import pytest from numpy.testing import assert_allclose -from .conftest import assert_frame_equal, assert_series_equal +from .conftest import (assert_frame_equal, assert_series_equal, + fail_on_pvlib_version) from pvlib.location import Location from pvlib import clearsky from pvlib import solarposition from pvlib import atmosphere from pvlib import irradiance +from pvlib._deprecation import pvlibDeprecationWarning from .conftest import TESTS_DATA_DIR @@ -892,5 +894,13 @@ def test_bird(): # XXX: testdata starts at 1am so noon is at index = 11 np.allclose( [Eb3, Ebh3, Gh3, Dh3], - testdata2[['Direct Beam', 'Direct Hz', 'Global Hz', 'Dif Hz']].iloc[11], + testdata2[['Direct Beam', 'Direct Hz', + 'Global Hz', 'Dif Hz']].iloc[11], rtol=1e-3) + + +@fail_on_pvlib_version('0.17.0') +def test_is_leap_year_deprecation(): + with pytest.warns(pvlibDeprecationWarning, + match='will be removed in 0.17.0.'): + clearsky._is_leap_year(2020) diff --git a/tests/test_irradiance.py b/tests/test_irradiance.py index f5f1c7ebd6..ce1a711e3b 100644 --- a/tests/test_irradiance.py +++ b/tests/test_irradiance.py @@ -14,6 +14,7 @@ from .conftest import ( assert_frame_equal, assert_series_equal, + fail_on_pvlib_version, requires_ephem, requires_numba, ) @@ -1670,3 +1671,11 @@ def test_diffuse_par_spitters(): 0.99591, 0.99576, 0.99472, 0.99270, 0.99283, 0.99406, 0.99581, 0.99591, ]) # fmt: skip assert_allclose(result, expected, atol=1e-5) + + +@fail_on_pvlib_version('0.17.0') +def test_liujordan_deprecation(): + zenith = pd.Series([45.0, 50.0, 55.0]) + with pytest.warns(pvlibDeprecationWarning, + match='will be removed in 0.17.0.'): + irradiance._liujordan(zenith, transmittance=0.7, airmass=1.5) diff --git a/tests/test_modelchain.py b/tests/test_modelchain.py index 6948e0f3bb..638ccf306e 100644 --- a/tests/test_modelchain.py +++ b/tests/test_modelchain.py @@ -1,4 +1,5 @@ import sys +from unittest.mock import MagicMock import numpy as np import pandas as pd @@ -10,7 +11,8 @@ from pvlib._deprecation import pvlibDeprecationWarning -from .conftest import assert_series_equal, assert_frame_equal +from .conftest import (assert_series_equal, assert_frame_equal, + fail_on_pvlib_version) import pytest @@ -1821,12 +1823,36 @@ def test_invalid_models(model, sapm_dc_snl_ac_system, location): ModelChain(sapm_dc_snl_ac_system, location, **kwargs) +@fail_on_pvlib_version('0.17.0') def test_bad_get_orientation(): - with pytest.warns(pvlibDeprecationWarning, match='will be removed soon'): + with pytest.warns(pvlibDeprecationWarning, + match='will be removed in 0.17.0.'): with pytest.raises(ValueError): modelchain.get_orientation('bad value') +@fail_on_pvlib_version('0.17.0') +def test_get_orientation_deprecation(): + with pytest.warns(pvlibDeprecationWarning, + match='will be removed in 0.17.0.'): + surface_tilt, surface_azimuth = modelchain.get_orientation('flat') + assert surface_tilt == 0 + assert surface_azimuth == 180 + + +@fail_on_pvlib_version('0.17.0') +def test_prep_inputs_tracking_deprecation(sapm_dc_snl_ac_system, location): + mc = ModelChain(sapm_dc_snl_ac_system, location) + # Set up mock results and system attributes required by the method + mc.results = MagicMock() + mc.system.singleaxis = MagicMock() + mc.system.axis_tilt = 0.0 + mc.system.axis_azimuth = 180.0 + with pytest.warns(pvlibDeprecationWarning, + match='will be removed in 0.17.0.'): + mc._prep_inputs_tracking() + + # tests for PVSystem with multiple Arrays def test_with_sapm_pvsystem_arrays(sapm_dc_snl_ac_system_Array, location, weather): From 1402b0dee76c791d914bb9f903166f1c9e6edfde Mon Sep 17 00:00:00 2001 From: Johann Lo <65318981+JoLo90@users.noreply.github.com> Date: Wed, 10 Jun 2026 09:09:50 +0200 Subject: [PATCH 2/4] fix: refactor doc comments and keep internal _prep_inputs_tracking --- docs/sphinx/source/whatsnew/v0.15.2.rst | 9 --------- pvlib/modelchain.py | 7 ------- tests/test_modelchain.py | 13 ------------- 3 files changed, 29 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.15.2.rst b/docs/sphinx/source/whatsnew/v0.15.2.rst index 2841cf8b4c..97383a5723 100644 --- a/docs/sphinx/source/whatsnew/v0.15.2.rst +++ b/docs/sphinx/source/whatsnew/v0.15.2.rst @@ -13,15 +13,6 @@ Deprecations :py:func:`~pvlib.irradiance.ghi_from_poa_driesse_2024`. The year now reflects the publication date. The old name will be removed in v0.17.0. (:issue:`2774`, :pull:`2777`) -* The function :py:func:`pvlib.clearsky._is_leap_year` is deprecated and will be - removed in v0.17.0. Use :py:func:`pandas.Timestamp.is_leap_year` instead. - (:issue: `2764`, :pull:`2766`) -* The function :py:func:`pvlib.irradiance._liujordan` is deprecated and will be - removed in v0.17.0. (:issue: `2764`, :pull:`2766`) -* The function :py:func:`pvlib.modelchain.get_orientation` is deprecated and will - be removed in v0.17.0. (:issue: `2764`, :pull:`2766`) -* The method :py:meth:`pvlib.modelchain.ModelChain._prep_inputs_tracking` is - deprecated and will be removed in v0.17.0. (:issue: `2764`, :pull:`2766`) Bug fixes diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index 34f9f04600..fc26dfe1a0 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -1265,13 +1265,6 @@ def _prep_inputs_airmass(self): model=self.airmass_model) return self - @deprecated( - since="0.15.2", - removal="0.17.0", - name="Modelchain._prep_inputs_tracking", - alternative=None, - addendum=None, - ) def _prep_inputs_tracking(self): """ Calculate tracker position and AOI diff --git a/tests/test_modelchain.py b/tests/test_modelchain.py index 638ccf306e..a8d87edd25 100644 --- a/tests/test_modelchain.py +++ b/tests/test_modelchain.py @@ -1840,19 +1840,6 @@ def test_get_orientation_deprecation(): assert surface_azimuth == 180 -@fail_on_pvlib_version('0.17.0') -def test_prep_inputs_tracking_deprecation(sapm_dc_snl_ac_system, location): - mc = ModelChain(sapm_dc_snl_ac_system, location) - # Set up mock results and system attributes required by the method - mc.results = MagicMock() - mc.system.singleaxis = MagicMock() - mc.system.axis_tilt = 0.0 - mc.system.axis_azimuth = 180.0 - with pytest.warns(pvlibDeprecationWarning, - match='will be removed in 0.17.0.'): - mc._prep_inputs_tracking() - - # tests for PVSystem with multiple Arrays def test_with_sapm_pvsystem_arrays(sapm_dc_snl_ac_system_Array, location, weather): From 994816d490619cace2abd039d30b4a72aeccc73a Mon Sep 17 00:00:00 2001 From: Johann Lo <65318981+JoLo90@users.noreply.github.com> Date: Fri, 7 Aug 2026 10:31:05 +0200 Subject: [PATCH 3/4] refactor: delete instead of deprecate liujordan --- docs/sphinx/source/whatsnew/v0.16.0.rst | 8 +++ pvlib/irradiance.py | 71 ------------------------- tests/test_clearsky.py | 11 +--- tests/test_irradiance.py | 9 ---- 4 files changed, 9 insertions(+), 90 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.16.0.rst b/docs/sphinx/source/whatsnew/v0.16.0.rst index 1316a7a9c1..afeedd731c 100644 --- a/docs/sphinx/source/whatsnew/v0.16.0.rst +++ b/docs/sphinx/source/whatsnew/v0.16.0.rst @@ -16,6 +16,13 @@ Breaking Changes * Remove empty ``poa_horizon`` key from the ``diffuse_components`` output of :py:func:`pvlib.irradiance.haydavies`. (:pull:`2788`) +v0.16.0 (Anticipated 2026) +-------------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ +* Removed private function :py:func:`pvlib.irradiance._liujordan`. + (:issue:`2764`, :pull:`2766`) Deprecations @@ -83,3 +90,4 @@ Contributors * Andrew Chen (:ghuser:`chuenchen309`) * Sai Asish Y (:ghuser:`SAY-5`) * Kevin Anderson (:ghuser:`kandersolar`) +* :ghuser:`JoLo90` diff --git a/pvlib/irradiance.py b/pvlib/irradiance.py index b7a1378590..9d6ddbe665 100644 --- a/pvlib/irradiance.py +++ b/pvlib/irradiance.py @@ -18,7 +18,6 @@ from pvlib._deprecation import pvlibDeprecationWarning, deprecated import warnings -from pvlib._deprecation import deprecated # Deprecation warning based on https://peps.python.org/pep-0562/ @@ -3235,76 +3234,6 @@ def campbell_norman(zenith, transmittance, pressure=101325.0, return irrads -@deprecated( - since="0.15.2", - removal="0.17.0", - name="_liujordan", - addendum=None, -) -def _liujordan(zenith: pd.Series, transmittance: float, - airmass: float, dni_extra=1367.0) -> pd.DataFrame: - ''' - Determine DNI, DHI, GHI from extraterrestrial flux, transmittance, - and optical air mass number. - - Liu and Jordan, 1960, developed a simplified direct radiation model. - DHI is from an empirical equation for diffuse radiation from Liu and - Jordan, 1960. - - Parameters - ---------- - zenith: pd.Series - True (not refraction-corrected) zenith angles in decimal - degrees. If Z is a vector it must be of the same size as all - other vector inputs. [°] - - transmittance: float - Atmospheric transmittance between 0 and 1. - - airmass: float - Absolute airmass. - - dni_extra: float, default 1367.0 - Direct irradiance incident at the top of the atmosphere. [W/m²] - - Returns - ------- - irradiance: DataFrame - Modeled direct normal irradiance, direct horizontal irradiance, - and global horizontal irradiance in Wm⁻² - - References - ---------- - .. [1] Campbell, G. S., J. M. Norman (1998) An Introduction to - Environmental Biophysics. 2nd Ed. New York: Springer. - - .. [2] Liu, B. Y., R. C. Jordan, (1960). "The interrelationship and - characteristic distribution of direct, diffuse, and total solar - radiation". Solar Energy 4:1-19 - - .. deprecated:: 0.15.2 - The ``_liujordan`` function is deprecated and will be - removed in 0.17.0. - Use the ``liujordan`` function instead. - ''' - - tau = transmittance - - dni = dni_extra*tau**airmass - dhi = 0.3 * (1.0 - tau**airmass) * dni_extra * np.cos(np.radians(zenith)) - ghi = dhi + dni * np.cos(np.radians(zenith)) - - irrads = OrderedDict() - irrads['ghi'] = ghi - irrads['dni'] = dni - irrads['dhi'] = dhi - - if isinstance(ghi, pd.Series): - irrads = pd.DataFrame(irrads) - - return irrads - - def _get_perez_coefficients(perezmodel): ''' Find coefficients for the Perez model diff --git a/tests/test_clearsky.py b/tests/test_clearsky.py index d55fd0cc1e..ed1ce85c64 100644 --- a/tests/test_clearsky.py +++ b/tests/test_clearsky.py @@ -8,15 +8,13 @@ import pytest from numpy.testing import assert_allclose -from .conftest import (assert_frame_equal, assert_series_equal, - fail_on_pvlib_version) +from .conftest import assert_frame_equal, assert_series_equal from pvlib.location import Location from pvlib import clearsky from pvlib import solarposition from pvlib import atmosphere from pvlib import irradiance -from pvlib._deprecation import pvlibDeprecationWarning from .conftest import TESTS_DATA_DIR @@ -897,10 +895,3 @@ def test_bird(): testdata2[['Direct Beam', 'Direct Hz', 'Global Hz', 'Dif Hz']].iloc[11], rtol=1e-3) - - -@fail_on_pvlib_version('0.17.0') -def test_is_leap_year_deprecation(): - with pytest.warns(pvlibDeprecationWarning, - match='will be removed in 0.17.0.'): - clearsky._is_leap_year(2020) diff --git a/tests/test_irradiance.py b/tests/test_irradiance.py index ce1a711e3b..f5f1c7ebd6 100644 --- a/tests/test_irradiance.py +++ b/tests/test_irradiance.py @@ -14,7 +14,6 @@ from .conftest import ( assert_frame_equal, assert_series_equal, - fail_on_pvlib_version, requires_ephem, requires_numba, ) @@ -1671,11 +1670,3 @@ def test_diffuse_par_spitters(): 0.99591, 0.99576, 0.99472, 0.99270, 0.99283, 0.99406, 0.99581, 0.99591, ]) # fmt: skip assert_allclose(result, expected, atol=1e-5) - - -@fail_on_pvlib_version('0.17.0') -def test_liujordan_deprecation(): - zenith = pd.Series([45.0, 50.0, 55.0]) - with pytest.warns(pvlibDeprecationWarning, - match='will be removed in 0.17.0.'): - irradiance._liujordan(zenith, transmittance=0.7, airmass=1.5) From 1897e4b681dfa41b68a04e6051df17303a340057 Mon Sep 17 00:00:00 2001 From: Johann Lo <65318981+JoLo90@users.noreply.github.com> Date: Fri, 7 Aug 2026 11:02:52 +0200 Subject: [PATCH 4/4] refactor: delete instead of deprecate functions parse_bsrn, parse_epw, parse_cams, get_orientation and delete decorator for deprecation for get_cams --- docs/sphinx/source/reference/iotools.rst | 3 -- docs/sphinx/source/reference/modelchain.rst | 9 ----- docs/sphinx/source/whatsnew/v0.16.0.rst | 20 ++++++---- pvlib/iotools/__init__.py | 4 +- pvlib/iotools/bsrn.py | 5 --- pvlib/iotools/epw.py | 5 --- pvlib/iotools/sodapro.py | 11 ------ pvlib/modelchain.py | 43 --------------------- tests/iotools/test_bsrn.py | 10 +---- tests/iotools/test_epw.py | 11 ------ tests/iotools/test_sodapro.py | 6 --- tests/test_modelchain.py | 22 +---------- 12 files changed, 16 insertions(+), 133 deletions(-) diff --git a/docs/sphinx/source/reference/iotools.rst b/docs/sphinx/source/reference/iotools.rst index 3d5729935d..bd0661e762 100644 --- a/docs/sphinx/source/reference/iotools.rst +++ b/docs/sphinx/source/reference/iotools.rst @@ -54,7 +54,6 @@ clear-sky irradiance globally. iotools.get_cams iotools.read_cams - iotools.parse_cams NASA POWER @@ -152,7 +151,6 @@ long-wave radiation. iotools.get_bsrn iotools.read_bsrn - iotools.parse_bsrn SOLRAD @@ -269,7 +267,6 @@ Functions for reading irradiance/weather data files. iotools.read_tmy2 iotools.read_tmy3 iotools.read_epw - iotools.parse_epw iotools.read_panond diff --git a/docs/sphinx/source/reference/modelchain.rst b/docs/sphinx/source/reference/modelchain.rst index 89de825f0d..56c0cfccd8 100644 --- a/docs/sphinx/source/reference/modelchain.rst +++ b/docs/sphinx/source/reference/modelchain.rst @@ -115,12 +115,3 @@ on the information in the associated :py:class:`~pvsystem.PVSystem` object. modelchain.ModelChain.infer_temperature_model modelchain.ModelChain.infer_losses_model -Functions ---------- - -Functions for power modeling. - -.. autosummary:: - :toctree: generated/ - - modelchain.get_orientation diff --git a/docs/sphinx/source/whatsnew/v0.16.0.rst b/docs/sphinx/source/whatsnew/v0.16.0.rst index afeedd731c..fa04ae1ab7 100644 --- a/docs/sphinx/source/whatsnew/v0.16.0.rst +++ b/docs/sphinx/source/whatsnew/v0.16.0.rst @@ -16,14 +16,20 @@ Breaking Changes * Remove empty ``poa_horizon`` key from the ``diffuse_components`` output of :py:func:`pvlib.irradiance.haydavies`. (:pull:`2788`) -v0.16.0 (Anticipated 2026) --------------------------- - -Breaking Changes -~~~~~~~~~~~~~~~~ * Removed private function :py:func:`pvlib.irradiance._liujordan`. (:issue:`2764`, :pull:`2766`) - +* Removed deprecated iotools aliases :py:func:`pvlib.iotools.parse_bsrn`, + :py:func:`pvlib.iotools.parse_epw`, and + :py:func:`pvlib.iotools.parse_cams`. Use + :py:func:`pvlib.iotools.read_bsrn`, :py:func:`pvlib.iotools.read_epw`, + and :py:func:`pvlib.iotools.read_cams` instead. + (:issue:`2767`, :pull:`2766`) +* Removed deprecated modelchain function + :py:func:`pvlib.modelchain.get_orientation`. + (:issue:`2767`, :pull:`2766`) +* Removed the deprecated ``server`` keyword argument from + :py:func:`pvlib.iotools.sodapro.get_cams`. Use ``url`` instead. + (:issue:`2767`, :pull:`2766`) Deprecations ~~~~~~~~~~~~ @@ -90,4 +96,4 @@ Contributors * Andrew Chen (:ghuser:`chuenchen309`) * Sai Asish Y (:ghuser:`SAY-5`) * Kevin Anderson (:ghuser:`kandersolar`) -* :ghuser:`JoLo90` +* Johann Loux (:ghuser:`JoLo90`) diff --git a/pvlib/iotools/__init__.py b/pvlib/iotools/__init__.py index 28ff223554..5f9c7103b7 100644 --- a/pvlib/iotools/__init__.py +++ b/pvlib/iotools/__init__.py @@ -1,5 +1,5 @@ from pvlib.iotools.tmy import read_tmy2, read_tmy3 # noqa: F401 -from pvlib.iotools.epw import read_epw, parse_epw # noqa: F401 +from pvlib.iotools.epw import read_epw # noqa: F401 from pvlib.iotools.srml import read_srml # noqa: F401 from pvlib.iotools.srml import get_srml # noqa: F401 from pvlib.iotools.surfrad import read_surfrad # noqa: F401 @@ -22,10 +22,8 @@ from pvlib.iotools.pvgis import get_pvgis_horizon # noqa: F401 from pvlib.iotools.bsrn import get_bsrn # noqa: F401 from pvlib.iotools.bsrn import read_bsrn # noqa: F401 -from pvlib.iotools.bsrn import parse_bsrn # noqa: F401 from pvlib.iotools.sodapro import get_cams # noqa: F401 from pvlib.iotools.sodapro import read_cams # noqa: F401 -from pvlib.iotools.sodapro import parse_cams # noqa: F401 from pvlib.iotools.panond import read_panond # noqa: F401 from pvlib.iotools.acis import get_acis_prism # noqa: F401 from pvlib.iotools.acis import get_acis_nrcc # noqa: F401 diff --git a/pvlib/iotools/bsrn.py b/pvlib/iotools/bsrn.py index 9e6c222314..7c02866e1c 100644 --- a/pvlib/iotools/bsrn.py +++ b/pvlib/iotools/bsrn.py @@ -10,7 +10,6 @@ import os from pvlib.tools import _file_context_manager -from pvlib._deprecation import deprecated BSRN_FTP_URL = "ftp.bsrn.awi.de" @@ -462,7 +461,3 @@ def read_bsrn(filename, logical_records=('0100',)): with open_func(filename, mode) as f: content = _parse_bsrn(f, logical_records) return content - - -parse_bsrn = deprecated(since="0.13.0", removal="0.17.0", name="parse_bsrn", - alternative="read_bsrn")(read_bsrn) diff --git a/pvlib/iotools/epw.py b/pvlib/iotools/epw.py index 561419fc00..01c87c180a 100644 --- a/pvlib/iotools/epw.py +++ b/pvlib/iotools/epw.py @@ -7,7 +7,6 @@ import pandas as pd from pvlib.tools import _file_context_manager -from pvlib._deprecation import deprecated def read_epw(filename, coerce_year=None): @@ -309,7 +308,3 @@ def _parse_epw(csvdata, coerce_year=None): data.index = idx return data, meta - - -parse_epw = deprecated(since="0.13.0", removal="0.17.0", name="parse_epw", - alternative="read_epw")(read_epw) diff --git a/pvlib/iotools/sodapro.py b/pvlib/iotools/sodapro.py index 81212d8112..2e88590ddd 100644 --- a/pvlib/iotools/sodapro.py +++ b/pvlib/iotools/sodapro.py @@ -9,8 +9,6 @@ import warnings from pvlib import tools -from pvlib._deprecation import deprecated, renamed_kwarg_warning - URL = 'api.soda-solardata.com' CAMS_INTEGRATED_COLUMNS = [ @@ -45,11 +43,6 @@ '0 year 1 month 0 day 0 h 0 min 0 s': '1M'} -@renamed_kwarg_warning( - since='0.13.0', - old_param_name='server', - new_param_name='url', - removal="0.14.0") def get_cams(latitude, longitude, start, end, email, identifier='mcclear', altitude=None, time_step='1h', time_ref='UT', verbose=False, integrated=False, label=None, map_variables=True, @@ -357,7 +350,3 @@ def read_cams(filename, integrated=False, label=None, map_variables=True): data = data.rename(columns=VARIABLE_MAP) return data, metadata - - -parse_cams = deprecated(since="0.13.0", removal="0.17.0", name="parse_cams", - alternative="read_cams")(read_cams) diff --git a/pvlib/modelchain.py b/pvlib/modelchain.py index fc26dfe1a0..32af129fd7 100644 --- a/pvlib/modelchain.py +++ b/pvlib/modelchain.py @@ -18,8 +18,6 @@ from pvlib.pvsystem import _DC_MODEL_PARAMS from pvlib.tools import _build_kwargs -from pvlib._deprecation import deprecated - # keys that are used to detect input data and assign data to appropriate # ModelChain attribute # for ModelChain.weather @@ -61,47 +59,6 @@ ) -@deprecated( - since="0.13.1", - removal="0.17.0", - name="pvlib.modelchain.get_orientation", - alternative=None, - addendum=None, -) -def get_orientation(strategy, **kwargs): - """ - Determine a PV system's surface tilt and surface azimuth - using a named strategy. - - Parameters - ---------- - strategy: str - The orientation strategy. - Allowed strategies include 'flat', 'south_at_latitude_tilt'. - **kwargs: - Strategy-dependent keyword arguments. See code for details. - - Returns - ------- - surface_tilt, surface_azimuth - - .. deprecated:: 0.15.2 - The ``get_orientation`` function is deprecated and will be removed - in 0.17.0. - """ - if strategy == 'south_at_latitude_tilt': - surface_azimuth = 180 - surface_tilt = kwargs['latitude'] - elif strategy == 'flat': - surface_azimuth = 180 - surface_tilt = 0 - else: - raise ValueError('invalid orientation strategy. strategy must ' - 'be one of south_at_latitude_tilt, flat,') - - return surface_tilt, surface_azimuth - - def _getmcattr(self, attr): """ Helper for __repr__ methods, needed to avoid recursion in property diff --git a/tests/iotools/test_bsrn.py b/tests/iotools/test_bsrn.py index 5bb9434f47..6b5f356836 100644 --- a/tests/iotools/test_bsrn.py +++ b/tests/iotools/test_bsrn.py @@ -6,7 +6,7 @@ import pytest import os import tempfile -from pvlib.iotools import read_bsrn, get_bsrn, parse_bsrn +from pvlib.iotools import read_bsrn, get_bsrn from tests.conftest import ( TESTS_DATA_DIR, RERUNS, @@ -15,8 +15,6 @@ requires_bsrn_credentials, ) -from pvlib._deprecation import pvlibDeprecationWarning - @pytest.fixture(scope="module") def bsrn_credentials(): @@ -35,12 +33,6 @@ def expected_index(): tz='UTC') -def test_parse_bsrn_deprecated(): - with pytest.warns(pvlibDeprecationWarning, match='Use read_bsrn instead'): - with open(TESTS_DATA_DIR / 'bsrn-lr0100-pay0616.dat') as fbuf: - data, metadata = parse_bsrn(fbuf) - - @pytest.mark.parametrize('testfile', [ ('bsrn-pay0616.dat.gz'), ('bsrn-lr0100-pay0616.dat'), diff --git a/tests/iotools/test_epw.py b/tests/iotools/test_epw.py index a2c7883269..9f1dd48ff4 100644 --- a/tests/iotools/test_epw.py +++ b/tests/iotools/test_epw.py @@ -3,8 +3,6 @@ from pvlib.iotools import epw from tests.conftest import TESTS_DATA_DIR, RERUNS, RERUNS_DELAY -from pvlib._deprecation import pvlibDeprecationWarning - epw_testfile = TESTS_DATA_DIR / 'NLD_Amsterdam062400_IWEC.epw' @@ -23,15 +21,6 @@ def test_read_epw_buffer(): assert meta['latitude'] == 52.3 -def test_parse_epw_deprecated(): - with pytest.warns(pvlibDeprecationWarning, match='Use read_epw instead'): - with open(epw_testfile, 'r') as f: - df, meta = epw.parse_epw(f) - assert len(df) == 8760 - assert 'ghi' in df.columns - assert meta['latitude'] == 52.3 - - @pytest.mark.remote_data @pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) def test_read_epw_remote(): diff --git a/tests/iotools/test_sodapro.py b/tests/iotools/test_sodapro.py index 4276b8826e..cf40c654a2 100644 --- a/tests/iotools/test_sodapro.py +++ b/tests/iotools/test_sodapro.py @@ -193,12 +193,6 @@ def test_read_cams_integrated_unmapped_label(): assert_frame_equal(out, expected, check_less_precise=True) -def test_parse_cams_deprecated(): - with pytest.warns(pvlibDeprecationWarning, match='Use read_cams instead'): - with open(testfile_radiation_verbose, mode="r") as fbuf: - _ = sodapro.parse_cams(fbuf) - - def test_read_cams_metadata(): _, metadata = sodapro.read_cams(testfile_mcclear_monthly, integrated=False) assert metadata['Time reference'] == 'Universal time (UT)' diff --git a/tests/test_modelchain.py b/tests/test_modelchain.py index a8d87edd25..e15e155dbb 100644 --- a/tests/test_modelchain.py +++ b/tests/test_modelchain.py @@ -1,5 +1,4 @@ import sys -from unittest.mock import MagicMock import numpy as np import pandas as pd @@ -9,10 +8,8 @@ from pvlib.pvsystem import PVSystem from pvlib.location import Location -from pvlib._deprecation import pvlibDeprecationWarning +from .conftest import assert_series_equal, assert_frame_equal -from .conftest import (assert_series_equal, assert_frame_equal, - fail_on_pvlib_version) import pytest @@ -1823,23 +1820,6 @@ def test_invalid_models(model, sapm_dc_snl_ac_system, location): ModelChain(sapm_dc_snl_ac_system, location, **kwargs) -@fail_on_pvlib_version('0.17.0') -def test_bad_get_orientation(): - with pytest.warns(pvlibDeprecationWarning, - match='will be removed in 0.17.0.'): - with pytest.raises(ValueError): - modelchain.get_orientation('bad value') - - -@fail_on_pvlib_version('0.17.0') -def test_get_orientation_deprecation(): - with pytest.warns(pvlibDeprecationWarning, - match='will be removed in 0.17.0.'): - surface_tilt, surface_azimuth = modelchain.get_orientation('flat') - assert surface_tilt == 0 - assert surface_azimuth == 180 - - # tests for PVSystem with multiple Arrays def test_with_sapm_pvsystem_arrays(sapm_dc_snl_ac_system_Array, location, weather):