Skip to content

Commit b1fd3f7

Browse files
RDaxinikandersolar
andauthored
Deprecate modelchain.get_orientation (#2495)
* enhance tests to check error message * linting, whatsnew * deprecate get_orientation * remove test * Update modelchain.rst * Update v0.13.1.rst * Update v0.13.1.rst * reinstate test * update removal schedule * reinstate function in docs * revert to default deprecation message * remove removal date from whatsnew * test deprecationwarning * linter blank line * Update docs/sphinx/source/whatsnew/v0.13.1.rst --------- Co-authored-by: Kevin Anderson <[email protected]>
1 parent 25c4392 commit b1fd3f7

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Breaking Changes
1010

1111
Deprecations
1212
~~~~~~~~~~~~
13+
* Deprecate :py:func:`~pvlib.modelchain.get_orientation`. (:pull:`2495`)
1314
* Rename parameter name ``aparent_azimuth`` to ``solar_azimuth`` in :py:func:`~pvlib.tracking.singleaxis`.
1415
(:issue:`2479`, :pull:`2480`)
1516

pvlib/modelchain.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
from pvlib.pvsystem import _DC_MODEL_PARAMS
1919
from pvlib.tools import _build_kwargs
2020

21+
from pvlib._deprecation import deprecated
22+
2123
# keys that are used to detect input data and assign data to appropriate
2224
# ModelChain attribute
2325
# for ModelChain.weather
@@ -59,6 +61,13 @@
5961
)
6062

6163

64+
@deprecated(
65+
since="0.13.1",
66+
removal="",
67+
name="pvlib.modelchain.get_orientation",
68+
alternative=None,
69+
addendum=None,
70+
)
6271
def get_orientation(strategy, **kwargs):
6372
"""
6473
Determine a PV system's surface tilt and surface azimuth

tests/test_modelchain.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from pvlib.pvsystem import PVSystem
99
from pvlib.location import Location
1010

11+
from pvlib._deprecation import pvlibDeprecationWarning
12+
1113
from .conftest import assert_series_equal, assert_frame_equal
1214
import pytest
1315

@@ -1786,8 +1788,9 @@ def test_invalid_models(model, sapm_dc_snl_ac_system, location):
17861788

17871789

17881790
def test_bad_get_orientation():
1789-
with pytest.raises(ValueError):
1790-
modelchain.get_orientation('bad value')
1791+
with pytest.warns(pvlibDeprecationWarning, match='will be removed soon'):
1792+
with pytest.raises(ValueError):
1793+
modelchain.get_orientation('bad value')
17911794

17921795

17931796
# tests for PVSystem with multiple Arrays

0 commit comments

Comments
 (0)