77from pvlib .bifacial import infinite_sheds
88from ..conftest import assert_series_equal
99
10+ from pvlib ._deprecation import pvlibDeprecationWarning
11+
1012import pytest
1113
1214
@@ -92,11 +94,10 @@ def test_get_irradiance_poa():
9294 dni = 700
9395 albedo = 0
9496 iam = 1.0
95- npoints = 100
9697 res = infinite_sheds .get_irradiance_poa (
9798 surface_tilt , surface_azimuth , solar_zenith , solar_azimuth ,
9899 gcr , height , pitch , ghi , dhi , dni ,
99- albedo , iam = iam , npoints = npoints )
100+ albedo , iam = iam )
100101 expected_diffuse = np .array ([300. ])
101102 expected_direct = np .array ([700. ])
102103 expected_global = expected_diffuse + expected_direct
@@ -118,7 +119,7 @@ def test_get_irradiance_poa():
118119 res = infinite_sheds .get_irradiance_poa (
119120 surface_tilt , surface_azimuth , solar_zenith , solar_azimuth ,
120121 gcr , height , pitch , ghi , dhi , dni ,
121- albedo , iam = iam , npoints = npoints )
122+ albedo , iam = iam )
122123 assert np .allclose (res ['poa_global' ], expected_global )
123124 assert np .allclose (res ['poa_diffuse' ], expected_diffuse )
124125 assert np .allclose (res ['poa_direct' ], expected_direct )
@@ -136,7 +137,7 @@ def test_get_irradiance_poa():
136137 res = infinite_sheds .get_irradiance_poa (
137138 surface_tilt , surface_azimuth , solar_zenith , solar_azimuth ,
138139 gcr , height , pitch , ghi , dhi , dni ,
139- albedo , iam = iam , npoints = npoints )
140+ albedo , iam = iam )
140141 assert isinstance (res , pd .DataFrame )
141142 assert_series_equal (res ['poa_global' ], expected_global )
142143 assert all (k in res .columns for k in [
@@ -152,8 +153,7 @@ def test__backside_tilt():
152153 assert np .allclose (back_az , np .array ([0. , 330. , 90. , 180. ]))
153154
154155
155- @pytest .mark .parametrize ("vectorize" , [True , False ])
156- def test_get_irradiance (vectorize ):
156+ def test_get_irradiance ():
157157 # singleton inputs
158158 solar_zenith = 0.
159159 solar_azimuth = 180.
@@ -168,12 +168,10 @@ def test_get_irradiance(vectorize):
168168 albedo = 0.
169169 iam_front = 1.0
170170 iam_back = 1.0
171- npoints = 100
172171 result = infinite_sheds .get_irradiance (
173172 surface_tilt , surface_azimuth , solar_zenith , solar_azimuth ,
174173 gcr , height , pitch , ghi , dhi , dni , albedo , iam_front , iam_back ,
175- bifaciality = 0.8 , shade_factor = - 0.02 , transmission_factor = 0 ,
176- npoints = npoints , vectorize = vectorize )
174+ bifaciality = 0.8 , shade_factor = - 0.02 , transmission_factor = 0 )
177175 expected_front_diffuse = np .array ([300. ])
178176 expected_front_direct = np .array ([700. ])
179177 expected_front_global = expected_front_diffuse + expected_front_direct
@@ -190,19 +188,42 @@ def test_get_irradiance(vectorize):
190188 result = infinite_sheds .get_irradiance (
191189 surface_tilt , surface_azimuth , solar_zenith , solar_azimuth ,
192190 gcr , height , pitch , ghi , dhi , dni , albedo , iam_front , iam_back ,
193- bifaciality = 0.8 , shade_factor = - 0.02 , transmission_factor = 0 ,
194- npoints = npoints , vectorize = vectorize )
191+ bifaciality = 0.8 , shade_factor = - 0.02 , transmission_factor = 0 )
195192 result_front = infinite_sheds .get_irradiance_poa (
196193 surface_tilt , surface_azimuth , solar_zenith , solar_azimuth ,
197194 gcr , height , pitch , ghi , dhi , dni ,
198- albedo , iam = iam_front , vectorize = vectorize )
195+ albedo , iam = iam_front )
199196 assert isinstance (result , pd .DataFrame )
200197 expected_poa_global = pd .Series (
201198 [1000. , 500. , result_front ['poa_global' ][2 ] * (1 + 0.8 * 0.98 ),
202199 np .nan ], index = ghi .index , name = 'poa_global' )
203200 assert_series_equal (result ['poa_global' ], expected_poa_global )
204201
205202
203+ def test_get_irradiance_deprecated ():
204+ kwargs = {"surface_tilt" : 0 , "surface_azimuth" : 0 , "solar_zenith" : 0 ,
205+ "solar_azimuth" : 0 , "gcr" : 0.5 , "height" : 1 , "pitch" : 1 ,
206+ "ghi" : 1000 , "dhi" : 200 , "dni" : 800 , "albedo" : 0.2 }
207+
208+ with pytest .warns (pvlibDeprecationWarning , match = "have no effect" ):
209+ _ = infinite_sheds .get_irradiance (** kwargs , npoints = 10 )
210+
211+ with pytest .warns (pvlibDeprecationWarning , match = "have no effect" ):
212+ _ = infinite_sheds .get_irradiance (** kwargs , vectorize = True )
213+
214+
215+ def test_get_irradiance_poa_deprecated ():
216+ kwargs = {"surface_tilt" : 0 , "surface_azimuth" : 0 , "solar_zenith" : 0 ,
217+ "solar_azimuth" : 0 , "gcr" : 0.5 , "height" : 1 , "pitch" : 1 ,
218+ "ghi" : 1000 , "dhi" : 200 , "dni" : 800 , "albedo" : 0.2 }
219+
220+ with pytest .warns (pvlibDeprecationWarning , match = "have no effect" ):
221+ _ = infinite_sheds .get_irradiance_poa (** kwargs , npoints = 10 )
222+
223+ with pytest .warns (pvlibDeprecationWarning , match = "have no effect" ):
224+ _ = infinite_sheds .get_irradiance_poa (** kwargs , vectorize = True )
225+
226+
206227def test_get_irradiance_limiting_gcr ():
207228 # test confirms that irradiance on widely spaced rows is approximately
208229 # the same as for a single row array
@@ -219,12 +240,10 @@ def test_get_irradiance_limiting_gcr():
219240 albedo = 1.
220241 iam_front = 1.0
221242 iam_back = 1.0
222- npoints = 100
223243 result = infinite_sheds .get_irradiance (
224244 surface_tilt , surface_azimuth , solar_zenith , solar_azimuth ,
225245 gcr , height , pitch , ghi , dhi , dni , albedo , iam_front , iam_back ,
226- bifaciality = 1. , shade_factor = - 0.00 , transmission_factor = 0. ,
227- npoints = npoints )
246+ bifaciality = 1. , shade_factor = - 0.00 , transmission_factor = 0. )
228247 expected_ground_diffuse = np .array ([500. ])
229248 expected_sky_diffuse = np .array ([150. ])
230249 expected_direct = np .array ([0. ])
@@ -263,12 +282,11 @@ def test_get_irradiance_with_haydavies():
263282 model = 'haydavies'
264283 iam_front = 1.0
265284 iam_back = 1.0
266- npoints = 100
267285 result = infinite_sheds .get_irradiance (
268286 surface_tilt , surface_azimuth , solar_zenith , solar_azimuth ,
269287 gcr , height , pitch , ghi , dhi , dni , albedo , model , dni_extra ,
270288 iam_front , iam_back , bifaciality = 0.8 , shade_factor = - 0.02 ,
271- transmission_factor = 0 , npoints = npoints )
289+ transmission_factor = 0 )
272290 expected_front_diffuse = np .array ([151.38 ])
273291 expected_front_direct = np .array ([848.62 ])
274292 expected_front_global = expected_front_diffuse + expected_front_direct
@@ -282,4 +300,4 @@ def test_get_irradiance_with_haydavies():
282300 surface_tilt , surface_azimuth , solar_zenith , solar_azimuth ,
283301 gcr , height , pitch , ghi , dhi , dni , albedo , model , None ,
284302 iam_front , iam_back , bifaciality = 0.8 , shade_factor = - 0.02 ,
285- transmission_factor = 0 , npoints = npoints )
303+ transmission_factor = 0 )
0 commit comments