5
5
import numpy as np
6
6
import pandas as pd
7
7
from pandas .util .testing import assert_series_equal
8
- from pvlib .losses import soiling_hsu , soiling_kimber
8
+ from pvlib .soiling import hsu , kimber
9
9
from pvlib .iotools import read_tmy3
10
10
from conftest import (
11
11
requires_scipy , needs_pandas_0_22 , DATA_DIR )
@@ -75,7 +75,7 @@ def rainfall_input():
75
75
76
76
@requires_scipy
77
77
@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 ):
79
79
"""Test Soiling HSU function"""
80
80
81
81
rainfall = rainfall_input
@@ -85,15 +85,15 @@ def test_soiling_hsu_no_cleaning(rainfall_input, expected_output):
85
85
tilt = 0.
86
86
expected_no_cleaning = expected_output
87
87
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' ))
91
91
assert_series_equal (result , expected_no_cleaning )
92
92
93
93
94
94
@requires_scipy
95
95
@needs_pandas_0_22
96
- def test_soiling_hsu (rainfall_input , expected_output_2 ):
96
+ def test_hsu (rainfall_input , expected_output_2 ):
97
97
"""Test Soiling HSU function with cleanings"""
98
98
99
99
rainfall = rainfall_input
@@ -104,21 +104,21 @@ def test_soiling_hsu(rainfall_input, expected_output_2):
104
104
expected = expected_output_2
105
105
106
106
# 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' ))
110
110
111
111
assert_series_equal (result , expected )
112
112
113
113
114
114
@requires_scipy
115
115
@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 ):
117
117
"""
118
118
Test Soiling HSU function with default deposition velocity and default rain
119
119
accumulation period.
120
120
"""
121
- result = soiling_hsu (
121
+ result = hsu (
122
122
rainfall = rainfall_input , cleaning_threshold = 0.5 , tilt = 0.0 , pm2_5 = 1.0 ,
123
123
pm10 = 2.0 )
124
124
assert np .allclose (result .values , expected_output_1 )
@@ -132,50 +132,45 @@ def greensboro_rain():
132
132
133
133
134
134
@pytest .fixture
135
- def expected_kimber_soiling_nowash ():
135
+ def expected_kimber_nowash ():
136
136
return pd .read_csv (
137
137
DATA_DIR / 'greensboro_kimber_soil_nowash.dat' ,
138
138
parse_dates = True , index_col = 'timestamp' )
139
139
140
140
141
141
@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 ):
144
143
"""Test Kimber soiling model with no manual washes"""
145
144
# Greensboro typical expected annual rainfall is 8345mm
146
145
assert greensboro_rain .sum () == 8345
147
146
# calculate soiling with no wash dates
148
- soiling_nowash = soiling_kimber (greensboro_rain )
147
+ nowash = kimber (greensboro_rain )
149
148
# 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 )
153
150
154
151
155
152
@pytest .fixture
156
- def expected_kimber_soiling_manwash ():
153
+ def expected_kimber_manwash ():
157
154
return pd .read_csv (
158
155
DATA_DIR / 'greensboro_kimber_soil_manwash.dat' ,
159
156
parse_dates = True , index_col = 'timestamp' )
160
157
161
158
162
159
@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 ):
165
161
"""Test Kimber soiling model with a manual wash"""
166
162
# a manual wash date
167
163
manwash = [datetime .date (1990 , 2 , 15 ), ]
168
164
# 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 )
171
166
# test manual wash
172
167
assert np .allclose (
173
- soiling_manwash .values ,
174
- expected_kimber_soiling_manwash ['soiling' ].values )
168
+ manwash .values ,
169
+ expected_kimber_manwash ['soiling' ].values )
175
170
176
171
177
172
@pytest .fixture
178
- def expected_kimber_soiling_norain ():
173
+ def expected_kimber_norain ():
179
174
# expected soiling reaches maximum
180
175
soiling_loss_rate = 0.0015
181
176
max_loss_rate = 0.3
@@ -186,19 +181,18 @@ def expected_kimber_soiling_norain():
186
181
187
182
188
183
@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 ):
191
185
"""Test Kimber soiling model with no rain"""
192
186
# a year with no rain
193
187
norain = pd .Series (0 , index = greensboro_rain .index )
194
188
# calculate soiling with no rain
195
- soiling_norain = soiling_kimber (norain )
189
+ norain = kimber (norain )
196
190
# 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 )
198
192
199
193
200
194
@pytest .fixture
201
- def expected_kimber_soiling_initial_soil ():
195
+ def expected_kimber_initial_soil ():
202
196
# expected soiling reaches maximum
203
197
soiling_loss_rate = 0.0015
204
198
max_loss_rate = 0.3
@@ -209,13 +203,11 @@ def expected_kimber_soiling_initial_soil():
209
203
210
204
211
205
@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 ):
214
207
"""Test Kimber soiling model with initial soiling"""
215
208
# a year with no rain
216
209
norain = pd .Series (0 , index = greensboro_rain .index )
217
210
# calculate soiling with no rain
218
- soiling_norain = soiling_kimber (norain , initial_soiling = 0.1 )
211
+ norain = kimber (norain , initial_soiling = 0.1 )
219
212
# 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