55import numpy as np
66import pandas as pd
77from pandas .util .testing import assert_series_equal
8- from pvlib .losses import soiling_hsu , soiling_kimber
8+ from pvlib .soiling import hsu , kimber
99from pvlib .iotools import read_tmy3
1010from conftest import (
1111 requires_scipy , needs_pandas_0_22 , DATA_DIR )
@@ -75,7 +75,7 @@ def rainfall_input():
7575
7676@requires_scipy
7777@needs_pandas_0_22
78- def test_soiling_hsu_no_cleaning (rainfall_input , expected_output ):
78+ def test_hsu_no_cleaning (rainfall_input , expected_output ):
7979 """Test Soiling HSU function"""
8080
8181 rainfall = rainfall_input
@@ -85,15 +85,15 @@ def test_soiling_hsu_no_cleaning(rainfall_input, expected_output):
8585 tilt = 0.
8686 expected_no_cleaning = expected_output
8787
88- result = soiling_hsu (rainfall = rainfall , cleaning_threshold = 10. , tilt = tilt ,
89- pm2_5 = pm2_5 , pm10 = pm10 , depo_veloc = depo_veloc ,
90- rain_accum_period = pd .Timedelta ('1h' ))
88+ result = hsu (rainfall = rainfall , cleaning_threshold = 10. , tilt = tilt ,
89+ pm2_5 = pm2_5 , pm10 = pm10 , depo_veloc = depo_veloc ,
90+ rain_accum_period = pd .Timedelta ('1h' ))
9191 assert_series_equal (result , expected_no_cleaning )
9292
9393
9494@requires_scipy
9595@needs_pandas_0_22
96- def test_soiling_hsu (rainfall_input , expected_output_2 ):
96+ def test_hsu (rainfall_input , expected_output_2 ):
9797 """Test Soiling HSU function with cleanings"""
9898
9999 rainfall = rainfall_input
@@ -104,21 +104,21 @@ def test_soiling_hsu(rainfall_input, expected_output_2):
104104 expected = expected_output_2
105105
106106 # three cleaning events at 4:00-6:00, 8:00-11:00, and 17:00-20:00
107- result = soiling_hsu (rainfall = rainfall , cleaning_threshold = 0.5 , tilt = tilt ,
108- pm2_5 = pm2_5 , pm10 = pm10 , depo_veloc = depo_veloc ,
109- rain_accum_period = pd .Timedelta ('3h' ))
107+ result = hsu (rainfall = rainfall , cleaning_threshold = 0.5 , tilt = tilt ,
108+ pm2_5 = pm2_5 , pm10 = pm10 , depo_veloc = depo_veloc ,
109+ rain_accum_period = pd .Timedelta ('3h' ))
110110
111111 assert_series_equal (result , expected )
112112
113113
114114@requires_scipy
115115@needs_pandas_0_22
116- def test_soiling_hsu_defaults (rainfall_input , expected_output_1 ):
116+ def test_hsu_defaults (rainfall_input , expected_output_1 ):
117117 """
118118 Test Soiling HSU function with default deposition velocity and default rain
119119 accumulation period.
120120 """
121- result = soiling_hsu (
121+ result = hsu (
122122 rainfall = rainfall_input , cleaning_threshold = 0.5 , tilt = 0.0 , pm2_5 = 1.0 ,
123123 pm10 = 2.0 )
124124 assert np .allclose (result .values , expected_output_1 )
@@ -132,50 +132,45 @@ def greensboro_rain():
132132
133133
134134@pytest .fixture
135- def expected_kimber_soiling_nowash ():
135+ def expected_kimber_nowash ():
136136 return pd .read_csv (
137137 DATA_DIR / 'greensboro_kimber_soil_nowash.dat' ,
138138 parse_dates = True , index_col = 'timestamp' )
139139
140140
141141@needs_pandas_0_22
142- def test_kimber_soiling_nowash (greensboro_rain ,
143- expected_kimber_soiling_nowash ):
142+ def test_kimber_nowash (greensboro_rain , expected_kimber_nowash ):
144143 """Test Kimber soiling model with no manual washes"""
145144 # Greensboro typical expected annual rainfall is 8345mm
146145 assert greensboro_rain .sum () == 8345
147146 # calculate soiling with no wash dates
148- soiling_nowash = soiling_kimber (greensboro_rain )
147+ nowash = kimber (greensboro_rain )
149148 # test no washes
150- assert np .allclose (
151- soiling_nowash .values ,
152- expected_kimber_soiling_nowash ['soiling' ].values )
149+ assert np .allclose (nowash .values , expected_kimber_nowash ['soiling' ].values )
153150
154151
155152@pytest .fixture
156- def expected_kimber_soiling_manwash ():
153+ def expected_kimber_manwash ():
157154 return pd .read_csv (
158155 DATA_DIR / 'greensboro_kimber_soil_manwash.dat' ,
159156 parse_dates = True , index_col = 'timestamp' )
160157
161158
162159@needs_pandas_0_22
163- def test_kimber_soiling_manwash (greensboro_rain ,
164- expected_kimber_soiling_manwash ):
160+ def test_kimber_manwash (greensboro_rain , expected_kimber_manwash ):
165161 """Test Kimber soiling model with a manual wash"""
166162 # a manual wash date
167163 manwash = [datetime .date (1990 , 2 , 15 ), ]
168164 # calculate soiling with manual wash
169- soiling_manwash = soiling_kimber (
170- greensboro_rain , manual_wash_dates = manwash )
165+ manwash = kimber (greensboro_rain , manual_wash_dates = manwash )
171166 # test manual wash
172167 assert np .allclose (
173- soiling_manwash .values ,
174- expected_kimber_soiling_manwash ['soiling' ].values )
168+ manwash .values ,
169+ expected_kimber_manwash ['soiling' ].values )
175170
176171
177172@pytest .fixture
178- def expected_kimber_soiling_norain ():
173+ def expected_kimber_norain ():
179174 # expected soiling reaches maximum
180175 soiling_loss_rate = 0.0015
181176 max_loss_rate = 0.3
@@ -186,19 +181,18 @@ def expected_kimber_soiling_norain():
186181
187182
188183@needs_pandas_0_22
189- def test_kimber_soiling_norain (greensboro_rain ,
190- expected_kimber_soiling_norain ):
184+ def test_kimber_norain (greensboro_rain , expected_kimber_norain ):
191185 """Test Kimber soiling model with no rain"""
192186 # a year with no rain
193187 norain = pd .Series (0 , index = greensboro_rain .index )
194188 # calculate soiling with no rain
195- soiling_norain = soiling_kimber (norain )
189+ norain = kimber (norain )
196190 # test no rain, soiling reaches maximum
197- assert np .allclose (soiling_norain .values , expected_kimber_soiling_norain )
191+ assert np .allclose (norain .values , expected_kimber_norain )
198192
199193
200194@pytest .fixture
201- def expected_kimber_soiling_initial_soil ():
195+ def expected_kimber_initial_soil ():
202196 # expected soiling reaches maximum
203197 soiling_loss_rate = 0.0015
204198 max_loss_rate = 0.3
@@ -209,13 +203,11 @@ def expected_kimber_soiling_initial_soil():
209203
210204
211205@needs_pandas_0_22
212- def test_kimber_soiling_initial_soil (greensboro_rain ,
213- expected_kimber_soiling_initial_soil ):
206+ def test_kimber_initial_soil (greensboro_rain , expected_kimber_initial_soil ):
214207 """Test Kimber soiling model with initial soiling"""
215208 # a year with no rain
216209 norain = pd .Series (0 , index = greensboro_rain .index )
217210 # calculate soiling with no rain
218- soiling_norain = soiling_kimber (norain , initial_soiling = 0.1 )
211+ norain = kimber (norain , initial_soiling = 0.1 )
219212 # test no rain, soiling reaches maximum
220- assert np .allclose (
221- soiling_norain .values , expected_kimber_soiling_initial_soil )
213+ assert np .allclose (norain .values , expected_kimber_initial_soil )
0 commit comments