Skip to content

Commit 909f86d

Browse files
authored
Rename tilt to surface_tilt in soiling.hsu (#1738)
* tilt -> surface_tilt * whatsnew * document surface_tilt as numeric, not float
1 parent 26579be commit 909f86d

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ v0.9.6 (Anticipated June 2023)
55
------------------------------
66

77

8+
Breaking Changes
9+
~~~~~~~~~~~~~~~~
10+
* For consistency with the rest of pvlib, the ``tilt`` parameter is renamed
11+
to ``surface_tilt`` in :py:func:`pvlib.soiling.hsu`. (:issue:`1717`, :pull:`1738`)
12+
13+
814
Deprecations
915
~~~~~~~~~~~~
1016

pvlib/soiling.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from pvlib.tools import cosd
1111

1212

13-
def hsu(rainfall, cleaning_threshold, tilt, pm2_5, pm10,
13+
def hsu(rainfall, cleaning_threshold, surface_tilt, pm2_5, pm10,
1414
depo_veloc=None, rain_accum_period=pd.Timedelta('1h')):
1515
"""
1616
Calculates soiling ratio given particulate and rain data using the
@@ -30,7 +30,7 @@ def hsu(rainfall, cleaning_threshold, tilt, pm2_5, pm10,
3030
Amount of rain in an accumulation period needed to clean the PV
3131
modules. [mm]
3232
33-
tilt : float
33+
surface_tilt : numeric
3434
Tilt of the PV panels from horizontal. [degree]
3535
3636
pm2_5 : numeric
@@ -83,7 +83,7 @@ def hsu(rainfall, cleaning_threshold, tilt, pm2_5, pm10,
8383
horiz_mass_rate = (
8484
pm2_5 * depo_veloc['2_5'] + np.maximum(pm10 - pm2_5, 0.)
8585
* depo_veloc['10']) * dt_sec
86-
tilted_mass_rate = horiz_mass_rate * cosd(tilt) # assuming no rain
86+
tilted_mass_rate = horiz_mass_rate * cosd(surface_tilt) # assuming no rain
8787

8888
# tms -> tilt_mass_rate
8989
tms_cumsum = np.cumsum(tilted_mass_rate * np.ones(rainfall.shape))

pvlib/tests/test_soiling.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_hsu_no_cleaning(rainfall_input, expected_output):
9292
tilt = 0.
9393
expected_no_cleaning = expected_output
9494

95-
result = hsu(rainfall=rainfall, cleaning_threshold=10., tilt=tilt,
95+
result = hsu(rainfall=rainfall, cleaning_threshold=10., surface_tilt=tilt,
9696
pm2_5=pm2_5, pm10=pm10, depo_veloc=depo_veloc,
9797
rain_accum_period=pd.Timedelta('1h'))
9898
assert_series_equal(result, expected_no_cleaning)
@@ -108,7 +108,7 @@ def test_hsu(rainfall_input, expected_output_2):
108108
tilt = 0.
109109

110110
# three cleaning events at 4:00-6:00, 8:00-11:00, and 17:00-20:00
111-
result = hsu(rainfall=rainfall, cleaning_threshold=0.5, tilt=tilt,
111+
result = hsu(rainfall=rainfall, cleaning_threshold=0.5, surface_tilt=tilt,
112112
pm2_5=pm2_5, pm10=pm10, depo_veloc=depo_veloc,
113113
rain_accum_period=pd.Timedelta('3h'))
114114

@@ -120,8 +120,8 @@ def test_hsu_defaults(rainfall_input, expected_output_1):
120120
Test Soiling HSU function with default deposition velocity and default rain
121121
accumulation period.
122122
"""
123-
result = hsu(rainfall=rainfall_input, cleaning_threshold=0.5, tilt=0.0,
124-
pm2_5=1.0e-2, pm10=2.0e-2)
123+
result = hsu(rainfall=rainfall_input, cleaning_threshold=0.5,
124+
surface_tilt=0.0, pm2_5=1.0e-2, pm10=2.0e-2)
125125
assert np.allclose(result.values, expected_output_1)
126126

127127

@@ -138,7 +138,7 @@ def test_hsu_variable_time_intervals(rainfall_input, expected_output_3):
138138
rain['new_time'] = rain.index + rain['mins_added']
139139
rain_var_times = rain.set_index('new_time').iloc[:, 0]
140140
result = hsu(
141-
rainfall=rain_var_times, cleaning_threshold=0.5, tilt=50.0,
141+
rainfall=rain_var_times, cleaning_threshold=0.5, surface_tilt=50.0,
142142
pm2_5=1, pm10=2, depo_veloc=depo_veloc,
143143
rain_accum_period=pd.Timedelta('2h'))
144144
assert np.allclose(result, expected_output_3)

0 commit comments

Comments
 (0)