Skip to content

Commit 9f5ac3f

Browse files
authored
Remove deprecated spectrum.get_am15g function (#2409)
* remove get_am15g * update associated tests * remove from spectrum init * remove from API reference docs * whatsnew * exclamation marks in old whatsnew files * I guess ! and ~ don't work together
1 parent 432c3b3 commit 9f5ac3f

File tree

7 files changed

+7
-75
lines changed

7 files changed

+7
-75
lines changed

docs/sphinx/source/reference/effects_on_pv_system_output/spectrum.rst

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Spectrum
88

99
spectrum.spectrl2
1010
spectrum.get_example_spectral_response
11-
spectrum.get_am15g
1211
spectrum.get_reference_spectra
1312
spectrum.calc_spectral_mismatch_field
1413
spectrum.spectral_factor_caballero

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Deprecations
2828
~~~~~~~~~~~~
2929
* The ``pvlib.irradiance.SURFACE_ALBEDOS`` dictionary has been moved to
3030
:py:const:`pvlib.albedo.SURFACE_ALBEDOS`. (:pull:`2095`)
31-
* Function :py:func:`pvlib.spectrum.get_am15g` has been deprecated in favor
31+
* Function :py:func:`!pvlib.spectrum.get_am15g` has been deprecated in favor
3232
of the new function :py:func:`pvlib.spectrum.get_reference_spectra`. Use
3333
``pvlib.spectrum.get_reference_spectra(standard="ASTM G173-03")["global"]``
3434
instead. (:pull:`2039`)

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

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Breaking Changes
1616
Additionally, the deprecated ``recolumn`` parameter is now removed. (:issue:`2324`, :pull:`2408`)
1717
* Remove :py:func:`!pvlib.atmosphere.first_solar_spectral_correction`, deprecated in v0.10.0.
1818
Use :py:func:`~pvlib.spectrum.spectral_factor_firstsolar` instead. (:issue:`2130`, :pull:`2131`)
19+
* Remove deprecated :py:func:`!pvlib.spectrum.get_am15g` function; use
20+
:py:func:`~pvlib.spectrum.get_reference_spectra` instead. (:pull:`2409`)
1921

2022
Bug fixes
2123
~~~~~~~~~

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Enhancements
1414
(:issue:`1516`, :pull:`1518`)
1515
* New module to calculate spectral mismatch from field spectral measurements
1616
:py:func:`~pvlib.spectrum.get_example_spectral_response`
17-
:py:func:`~pvlib.spectrum.get_am15g`
17+
:py:func:`!pvlib.spectrum.get_am15g`
1818
:py:func:`~pvlib.spectrum.calc_spectral_mismatch_field`
1919
(:issue:`1523`, :pull:`1524`)
2020
* Added Townsend-Powers monthly snow loss model:

pvlib/spectrum/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
spectral_factor_jrc,
99
)
1010
from pvlib.spectrum.irradiance import ( # noqa: F401
11-
get_am15g,
1211
get_reference_spectra,
1312
average_photon_energy,
1413
)

pvlib/spectrum/irradiance.py

-63
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"""
55

66
import pvlib
7-
from pvlib._deprecation import deprecated
87
import numpy as np
98
import pandas as pd
109
from pathlib import Path
@@ -13,68 +12,6 @@
1312
from scipy.integrate import trapezoid
1413

1514

16-
@deprecated(
17-
since="0.11",
18-
removal="0.12",
19-
name="pvlib.spectrum.get_am15g",
20-
alternative="pvlib.spectrum.get_reference_spectra",
21-
addendum=(
22-
"The new function reads more data. Use it with "
23-
+ "standard='ASTM G173-03' and extract the 'global' column."
24-
),
25-
)
26-
def get_am15g(wavelength=None):
27-
r"""
28-
Read the ASTM G173-03 AM1.5 global spectrum on a 37-degree tilted surface,
29-
optionally interpolated to the specified wavelength(s).
30-
31-
Global (tilted) irradiance includes direct and diffuse irradiance from sky
32-
and ground reflections, and is more formally called hemispherical
33-
irradiance (on a tilted surface). In the context of photovoltaic systems
34-
the irradiance on a flat receiver is frequently called plane-of-array (POA)
35-
irradiance.
36-
37-
Parameters
38-
----------
39-
wavelength: 1-D sequence of numeric, optional
40-
Wavelengths at which the spectrum is interpolated.
41-
By default the 2002 wavelengths of the standard are returned. [nm].
42-
43-
Returns
44-
-------
45-
am15g: pandas.Series
46-
The AM1.5g standard spectrum indexed by ``wavelength``. [W/(m²nm)].
47-
48-
Notes
49-
-----
50-
If ``wavelength`` is specified this function uses linear interpolation.
51-
52-
If the values in ``wavelength`` are too widely spaced, the integral of the
53-
spectrum may deviate from the standard value of 1000.37 W/m².
54-
55-
The values in the data file provided with pvlib-python are copied from an
56-
Excel file distributed by NREL, which is found here:
57-
https://www.nrel.gov/grid/solar-resource/assets/data/astmg173.xls
58-
59-
More information about reference spectra is found here:
60-
https://www.nrel.gov/grid/solar-resource/spectra-am1.5.html
61-
62-
See Also
63-
--------
64-
pvlib.spectrum.get_reference_spectra : reads also the direct and
65-
extraterrestrial components of the spectrum.
66-
67-
References
68-
----------
69-
.. [1] ASTM "G173-03 Standard Tables for Reference Solar Spectral
70-
Irradiances: Direct Normal and Hemispherical on 37° Tilted Surface."
71-
""" # noqa: E501
72-
# Contributed by Anton Driesse (@adriesse), PV Performance Labs. Aug. 2022
73-
# modified by @echedey-ls, as a wrapper of spectrum.get_reference_spectra
74-
standard = get_reference_spectra(wavelength, standard="ASTM G173-03")
75-
return standard["global"]
76-
77-
7815
def get_reference_spectra(wavelengths=None, standard="ASTM G173-03"):
7916
r"""
8017
Read a standard spectrum specified by ``standard``, optionally

tests/spectrum/test_irradiance.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,22 @@
33
import pandas as pd
44
import numpy as np
55
from pvlib import spectrum
6-
from pvlib._deprecation import pvlibDeprecationWarning
76

87
from tests.conftest import assert_series_equal, fail_on_pvlib_version
98

109

1110
@fail_on_pvlib_version('0.12')
12-
def test_get_am15g():
11+
def test_get_reference_spectra_am15g():
1312
# test that the reference spectrum is read and interpolated correctly
14-
with pytest.warns(pvlibDeprecationWarning,
15-
match="get_reference_spectra instead"):
16-
e = spectrum.get_am15g()
13+
e = spectrum.get_reference_spectra()['global']
1714
assert_equal(len(e), 2002)
1815
assert_equal(np.sum(e.index), 2761442)
1916
assert_approx_equal(np.sum(e), 1002.88, significant=6)
2017

2118
wavelength = [270, 850, 950, 1200, 1201.25, 4001]
2219
expected = [0.0, 0.893720, 0.147260, 0.448250, 0.4371025, 0.0]
2320

24-
with pytest.warns(pvlibDeprecationWarning,
25-
match="get_reference_spectra instead"):
26-
e = spectrum.get_am15g(wavelength)
21+
e = spectrum.get_reference_spectra(wavelength)['global']
2722
assert_equal(len(e), len(wavelength))
2823
assert_allclose(e, expected, rtol=1e-6)
2924

0 commit comments

Comments
 (0)