Skip to content

Commit 7929b38

Browse files
authored
Rename ghi_from_poa_driesse_2023 to ghi_from_poa_driesse_2024 (#2777)
* Update irradiance.py * Update test_irradiance.py * update sphinx refs, examples * Update v0.15.2.rst * flake8 * test deprecation * Update v0.15.2.rst
1 parent 044ad59 commit 7929b38

6 files changed

Lines changed: 38 additions & 18 deletions

File tree

docs/examples/irradiance-transposition/plot_rtranpose_limitations.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#
2929
# In this example we look at a single point in time and consider a full range
3030
# of possible GHI and POA global values as shown in figures 3 and 4 of [1]_.
31-
# Then we use :py:meth:`pvlib.irradiance.ghi_from_poa_driesse_2023` to estimate
31+
# Then we use :py:meth:`pvlib.irradiance.ghi_from_poa_driesse_2024` to estimate
3232
# the original GHI from POA global.
3333
#
3434
# References
@@ -45,7 +45,7 @@
4545

4646
from pvlib.irradiance import (erbs_driesse,
4747
get_total_irradiance,
48-
ghi_from_poa_driesse_2023,
48+
ghi_from_poa_driesse_2024,
4949
)
5050

5151
matplotlib.rcParams['axes.grid'] = True
@@ -92,7 +92,7 @@
9292

9393
poa_test = 200
9494

95-
ghi_hat = ghi_from_poa_driesse_2023(surface_tilt, surface_azimuth,
95+
ghi_hat = ghi_from_poa_driesse_2024(surface_tilt, surface_azimuth,
9696
solar_zenith, solar_azimuth,
9797
poa_test,
9898
dni_extra,
@@ -156,7 +156,7 @@
156156
# out, other times not.
157157
#
158158

159-
result = ghi_from_poa_driesse_2023(surface_tilt, surface_azimuth,
159+
result = ghi_from_poa_driesse_2024(surface_tilt, surface_azimuth,
160160
solar_zenith, solar_azimuth,
161161
poa_global,
162162
dni_extra,

docs/examples/irradiance-transposition/plot_rtranpose_year.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# Recovering GHI from POA irradiance is termed "reverse transposition."
2222
#
2323
# In this example we start with a TMY file and calculate POA global irradiance.
24-
# Then we use :py:meth:`pvlib.irradiance.ghi_from_poa_driesse_2023` to estimate
24+
# Then we use :py:meth:`pvlib.irradiance.ghi_from_poa_driesse_2024` to estimate
2525
# the original GHI from POA global. Details of the method found in [1]_.
2626
#
2727
# Another method for reverse tranposition called GTI-DIRINT is also
@@ -49,7 +49,7 @@
4949
from pvlib import iotools, location
5050
from pvlib.irradiance import (get_extra_radiation,
5151
get_total_irradiance,
52-
ghi_from_poa_driesse_2023,
52+
ghi_from_poa_driesse_2024,
5353
aoi,
5454
)
5555

@@ -114,7 +114,7 @@
114114

115115
start = time.process_time()
116116

117-
df['ghi_rev'] = ghi_from_poa_driesse_2023(TILT, ORIENT,
117+
df['ghi_rev'] = ghi_from_poa_driesse_2024(TILT, ORIENT,
118118
solpos.apparent_zenith,
119119
solpos.azimuth,
120120
df.poa_global,

docs/sphinx/source/reference/irradiance/reverse-transposition.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ Reverse transposition models
66
.. autosummary::
77
:toctree: ../generated/
88

9-
irradiance.ghi_from_poa_driesse_2023
9+
irradiance.ghi_from_poa_driesse_2024
1010
irradiance.gti_dirint

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

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

1111
Deprecations
1212
~~~~~~~~~~~~
13+
* Rename :py:func:`!pvlib.irradiance.ghi_from_poa_driesse_2023` to
14+
:py:func:`~pvlib.irradiance.ghi_from_poa_driesse_2024`. The year now reflects
15+
the publication date. The old name will be removed in v0.17.0.
16+
(:issue:`2774`, :pull:`2777`)
1317

1418

1519
Bug fixes
@@ -76,3 +80,4 @@ Contributors
7680
* :ghuser:`shethkajal7`
7781
* Arthur Onno (:ghuser:`ArthurOnnoTerabase`)
7882
* Adam R. Jensen (:ghuser:`AdamRJensen`)
83+
* Rajiv Daxini (:ghuser:`RDaxini`)

pvlib/irradiance.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from pvlib import atmosphere, solarposition, tools
1717
import pvlib # used to avoid dni name collision in complete_irradiance
1818

19-
from pvlib._deprecation import pvlibDeprecationWarning
19+
from pvlib._deprecation import pvlibDeprecationWarning, deprecated
2020
import warnings
2121

2222

@@ -1442,7 +1442,7 @@ def _poa_from_ghi(surface_tilt, surface_azimuth,
14421442
Transposition function that includes decomposition of GHI using the
14431443
continuous Erbs-Driesse model.
14441444
1445-
Helper function for ghi_from_poa_driesse_2023.
1445+
Helper function for ghi_from_poa_driesse_2024.
14461446
'''
14471447
# Contributed by Anton Driesse (@adriesse), PV Performance Labs. Nov., 2023
14481448

@@ -1468,7 +1468,7 @@ def _ghi_from_poa(surface_tilt, surface_azimuth,
14681468
'''
14691469
Reverse transposition function that uses the scalar bisection from scipy.
14701470
1471-
Helper function for ghi_from_poa_driesse_2023.
1471+
Helper function for ghi_from_poa_driesse_2024.
14721472
'''
14731473
# Contributed by Anton Driesse (@adriesse), PV Performance Labs. Nov., 2023
14741474

@@ -1512,7 +1512,7 @@ def poa_error(ghi):
15121512
return ghi, conv, niter
15131513

15141514

1515-
def ghi_from_poa_driesse_2023(surface_tilt, surface_azimuth,
1515+
def ghi_from_poa_driesse_2024(surface_tilt, surface_azimuth,
15161516
solar_zenith, solar_azimuth,
15171517
poa_global,
15181518
dni_extra, airmass=None, albedo=0.25,
@@ -1614,6 +1614,14 @@ def ghi_from_poa_driesse_2023(surface_tilt, surface_azimuth,
16141614
return ghi
16151615

16161616

1617+
ghi_from_poa_driesse_2023 = deprecated(
1618+
since="0.15.2",
1619+
name="pvlib.irradiance.ghi_from_poa_driesse_2023",
1620+
alternative="pvlib.irradiance.ghi_from_poa_driesse_2024",
1621+
removal="0.17.0",
1622+
)(ghi_from_poa_driesse_2024)
1623+
1624+
16171625
def clearsky_index(ghi, ghi_clear, max_clearsky_index=2.0):
16181626
"""
16191627
Calculate the clearsky index.

tests/test_irradiance.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ def test_ghi_from_poa_driesse(mocker):
792792
surface_azimuth = 180
793793

794794
# test core function
795-
output = irradiance.ghi_from_poa_driesse_2023(
795+
output = irradiance.ghi_from_poa_driesse_2024(
796796
surface_tilt, surface_azimuth, zenith, azimuth,
797797
poa_global, dni_extra=1366.1)
798798

@@ -802,7 +802,7 @@ def test_ghi_from_poa_driesse(mocker):
802802
# test series output
803803
poa_global = pd.Series([20, 300, 1000], index=times)
804804

805-
output = irradiance.ghi_from_poa_driesse_2023(
805+
output = irradiance.ghi_from_poa_driesse_2024(
806806
surface_tilt, surface_azimuth, zenith, azimuth,
807807
poa_global, dni_extra=1366.1)
808808

@@ -811,7 +811,7 @@ def test_ghi_from_poa_driesse(mocker):
811811
# test full_output option and special cases
812812
poa_global = np.array([0, 1500, np.nan])
813813

814-
ghi, conv, niter = irradiance.ghi_from_poa_driesse_2023(
814+
ghi, conv, niter = irradiance.ghi_from_poa_driesse_2024(
815815
surface_tilt, surface_azimuth, zenith, azimuth,
816816
poa_global, dni_extra=1366.1, full_output=True)
817817

@@ -828,19 +828,26 @@ def test_ghi_from_poa_driesse(mocker):
828828
poa_global = pd.Series([20, 300, 1000], index=times)
829829
# test exception
830830
xtol = -3.14159 # negative value raises exception in scipy.optimize.bisect
831-
with pytest.raises(ValueError, match=rf"xtol too small \({xtol:g} <= 0\)"):
832-
output = irradiance.ghi_from_poa_driesse_2023(
831+
with pytest.raises(ValueError, match=rf"xtol too small \({xtol} <= 0\)"):
832+
output = irradiance.ghi_from_poa_driesse_2024(
833833
surface_tilt, surface_azimuth, zenith, azimuth,
834834
poa_global, dni_extra=1366.1, xtol=xtol)
835835
# test propagation
836836
xtol = 3.141592
837837
bisect_spy = mocker.spy(irradiance, "bisect")
838-
output = irradiance.ghi_from_poa_driesse_2023(
838+
output = irradiance.ghi_from_poa_driesse_2024(
839839
surface_tilt, surface_azimuth, zenith, azimuth,
840840
poa_global, dni_extra=1366.1, xtol=xtol)
841841
assert bisect_spy.call_args[1]["xtol"] == xtol
842842

843843

844+
def test_ghi_from_poa_driesse_2023_deprecated():
845+
with pytest.warns(pvlibDeprecationWarning,
846+
match="ghi_from_poa_driesse_2024"):
847+
irradiance.ghi_from_poa_driesse_2023(
848+
30, 180, 20, 180, 500, dni_extra=1366.1)
849+
850+
844851
def test_gti_dirint():
845852
times = pd.DatetimeIndex(
846853
['2014-06-24T06-0700', '2014-06-24T09-0700', '2014-06-24T12-0700'])

0 commit comments

Comments
 (0)