Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/sphinx/source/whatsnew/v0.15.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ Breaking Changes

Deprecations
~~~~~~~~~~~~
* 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
Expand Down Expand Up @@ -62,3 +71,4 @@ Contributors
* Cliff Hansen (:ghuser:`cwhanse`)
* Arthur Onno (:ghuser:`ArthurOnnoTerabase`)
* Adam R. Jensen (:ghuser:`AdamRJensen`)
* :ghuser:`JoLo90`
8 changes: 8 additions & 0 deletions pvlib/clearsky.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from pvlib import atmosphere, tools
from pvlib.tools import _degrees_to_index
from pvlib._deprecation import deprecated


def ineichen(apparent_zenith, airmass_absolute, linke_turbidity,
Expand Down Expand Up @@ -220,6 +221,13 @@ def lookup_linke_turbidity(time, latitude, longitude, filepath=None,
return linke_turbidity


@deprecated(
since="0.15.2",
removal="0.17.0",
name="_is_leap_year",
alternative=None,
addendum=None,
)
def _is_leap_year(year):
"""Determine if a year is leap year.

Expand Down
2 changes: 1 addition & 1 deletion pvlib/iotools/bsrn.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,5 +465,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)
2 changes: 1 addition & 1 deletion pvlib/iotools/epw.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion pvlib/iotools/sodapro.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
21 changes: 17 additions & 4 deletions pvlib/irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from pvlib._deprecation import pvlibDeprecationWarning
import warnings
from pvlib._deprecation import deprecated


# Deprecation warning based on https://peps.python.org/pep-0562/
Expand Down Expand Up @@ -3087,7 +3088,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.
Expand All @@ -3106,11 +3114,11 @@ def _liujordan(zenith, transmittance, airmass, dni_extra=1367.0):
transmittance: float
Atmospheric transmittance between 0 and 1.

pressure: float, default 101325.0
Air pressure
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
-------
Expand All @@ -3126,6 +3134,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
Expand Down
13 changes: 12 additions & 1 deletion pvlib/modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

@deprecated(
since="0.13.1",
removal="",
removal="0.17.0",
name="pvlib.modelchain.get_orientation",
alternative=None,
addendum=None,
Expand All @@ -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
Expand Down Expand Up @@ -1248,6 +1252,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
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tracking.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 12 additions & 2 deletions tests/test_clearsky.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
9 changes: 9 additions & 0 deletions tests/test_irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from .conftest import (
assert_frame_equal,
assert_series_equal,
fail_on_pvlib_version,
requires_ephem,
requires_numba,
)
Expand Down Expand Up @@ -1454,3 +1455,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)
30 changes: 28 additions & 2 deletions tests/test_modelchain.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
from unittest.mock import MagicMock

import numpy as np
import pandas as pd
Expand All @@ -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


Expand Down Expand Up @@ -1799,12 +1801,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):
Expand Down
Loading