Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
8 changes: 4 additions & 4 deletions pvlib/clearsky.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,13 @@ def haurwitz(apparent_zenith):
'''

cos_zenith = tools.cosd(apparent_zenith.values)
clearsky_ghi = np.zeros_like(apparent_zenith.values)
ghi_clear = np.zeros_like(apparent_zenith.values)
cos_zen_gte_0 = cos_zenith > 0
clearsky_ghi[cos_zen_gte_0] = (1098.0 * cos_zenith[cos_zen_gte_0] *
np.exp(-0.059/cos_zenith[cos_zen_gte_0]))
ghi_clear[cos_zen_gte_0] = (1098.0 * cos_zenith[cos_zen_gte_0] *
np.exp(-0.059/cos_zenith[cos_zen_gte_0]))

df_out = pd.DataFrame(index=apparent_zenith.index,
data=clearsky_ghi,
data=ghi_clear,
columns=['ghi'])

return df_out
Expand Down
12 changes: 11 additions & 1 deletion pvlib/irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from pvlib import atmosphere, solarposition, tools
import pvlib # used to avoid dni name collision in complete_irradiance

from pvlib._deprecation import pvlibDeprecationWarning
from pvlib._deprecation import pvlibDeprecationWarning, renamed_kwarg_warning
import warnings


Expand Down Expand Up @@ -1614,6 +1614,11 @@ def ghi_from_poa_driesse_2023(surface_tilt, surface_azimuth,
return ghi


@renamed_kwarg_warning(
since='11.2',
old_param_name='clearsky_ghi',
new_param_name='ghi_clear',
removal="12.0")
def clearsky_index(ghi, clearsky_ghi, max_clearsky_index=2.0):
"""
Calculate the clearsky index.
Expand Down Expand Up @@ -2151,6 +2156,11 @@ def _dirint_bins(times, kt_prime, zenith, w, delta_kt_prime):
return kt_prime_bin, zenith_bin, w_bin, delta_kt_prime_bin


@renamed_kwarg_warning(
since='11.2',
old_param_name='ghi_clearsky',
new_param_name='ghi_clear',
removal="12.0")
def dirindex(ghi, ghi_clearsky, dni_clearsky, zenith, times, pressure=101325.,
use_delta_kt_prime=True, temp_dew=None, min_cos_zenith=0.065,
max_zenith=87):
Expand Down
6 changes: 6 additions & 0 deletions pvlib/tests/test_irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,12 @@ def test_clearsky_index():
assert_series_equal(out, expected)


def test_clearsky_index_renaming():
with pytest.warns(pvlibDeprecationWarning, match='ghi_clear'):
ghi, clearsky_ghi = 200, 300
irradiance.clearsky_index(ghi, clearsky_ghi)


def test_clearness_index():
ghi = np.array([-1, 0, 1, 1000])
solar_zenith = np.array([180, 90, 89.999, 0])
Expand Down
Loading