Skip to content
Draft
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
12 changes: 1 addition & 11 deletions pvlib/irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,10 @@
from pvlib import atmosphere, solarposition, tools
import pvlib # used to avoid dni name collision in complete_irradiance

from pvlib._deprecation import pvlibDeprecationWarning, deprecated
from pvlib._deprecation import deprecated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remember to clean up this import if/when king is also removed.

import warnings


# Deprecation warning based on https://peps.python.org/pep-0562/
def __getattr__(attr):
if attr == 'SURFACE_ALBEDOS':
warnings.warn(f"{attr} has been moved to the albedo module as of "
"v0.11.0. Please use pvlib.albedo.SURFACE_ALBEDOS.",
pvlibDeprecationWarning)
return pvlib.albedo.SURFACE_ALBEDOS
raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")


def get_extra_radiation(datetime_or_doy, solar_constant=1366.1,
method='spencer', epoch_year=2014, **kwargs):
"""
Expand Down
12 changes: 0 additions & 12 deletions tests/test_irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -1639,18 +1639,6 @@ def test_louche():
assert_frame_equal(out, expected)


def test_SURFACE_ALBEDOS_deprecated():
with pytest.warns(pvlibDeprecationWarning, match='SURFACE_ALBEDOS has been'
' moved to the albedo module as of v0.11.0. Please use'
' pvlib.albedo.SURFACE_ALBEDOS.'):
irradiance.SURFACE_ALBEDOS


@pytest.mark.filterwarnings("ignore:SURFACE_ALBEDOS")
def test_SURFACE_ALBEDO_equals():
assert irradiance.SURFACE_ALBEDOS == albedo.SURFACE_ALBEDOS


def test_diffuse_par_spitters():
solar_zenith, global_diffuse_fraction = np.meshgrid(
[90, 85, 75, 60, 40, 30, 10, 0], [0.01, 0.1, 0.3, 0.6, 0.8, 0.99]
Expand Down
Loading