1212
1313
1414def test__shaded_fraction ():
15-
1615 # special angles
1716 tracker_rotation = np .array ([60 , 60 , 60 , 60 ])
1817 phi = np .array ([60 , 60 , 60 , 60 ])
@@ -84,7 +83,6 @@ def test__apply_sky_diffuse_model(model):
8483 poa_direct + poa_sky_diffuse + poa_ground , abs = 1e-10 )
8584
8685
87-
8886def test__apply_sky_diffuse_model_errors ():
8987 with pytest .raises (ValueError , match = 'Must supply dni_extra' ):
9088 ants2d ._apply_sky_diffuse_model (0 , 0 , 'haydavies' , None ,
@@ -208,11 +206,12 @@ def test_get_irradiance_return_type(ants_params):
208206 # verify pandas in -> pandas out, and shapes of numpy outputs
209207 out = ants2d .get_irradiance (** ants_params , row_segments = 1 )
210208 assert isinstance (out , pd .DataFrame ) # DataFrame, since n_row_segments=1
211- expected_keys = ['poa_front' , 'poa_front_direct' , 'poa_front_diffuse' ,
212- 'poa_front_sky_diffuse' , 'poa_front_ground_diffuse' ,
213- 'shaded_fraction_front' , 'poa_back' , 'poa_back_direct' ,
214- 'poa_back_diffuse' , 'poa_back_sky_diffuse' , 'poa_back_ground_diffuse' ,
215- 'shaded_fraction_back' ]
209+ expected_keys = [
210+ 'poa_front' , 'poa_front_direct' , 'poa_front_diffuse' ,
211+ 'poa_front_sky_diffuse' , 'poa_front_ground_diffuse' ,
212+ 'shaded_fraction_front' , 'poa_back' , 'poa_back_direct' ,
213+ 'poa_back_diffuse' , 'poa_back_sky_diffuse' , 'poa_back_ground_diffuse' ,
214+ 'shaded_fraction_back' ]
216215 assert set (out .columns ) == set (expected_keys )
217216 assert len (out ) == 2 # 2 timestamps
218217
@@ -245,9 +244,10 @@ def test_get_irradiance_vertical(ants_params, solar_zenith, tracker_rotation):
245244 out = ants2d .get_irradiance (** ants_params , row_segments = 1 )
246245 # inputs are symmetrical morning/afternoon, so morning front should equal
247246 # afternoon back, and vice versa
248- front_keys = ['poa_front' , 'poa_front_direct' , 'poa_front_diffuse' ,
249- 'poa_front_sky_diffuse' , 'poa_front_ground_diffuse' ,
250- 'shaded_fraction_front' ]
247+ front_keys = [
248+ 'poa_front' , 'poa_front_direct' , 'poa_front_diffuse' ,
249+ 'poa_front_sky_diffuse' , 'poa_front_ground_diffuse' ,
250+ 'shaded_fraction_front' ]
251251 for front_key in front_keys :
252252 back_key = front_key .replace ("front" , "back" )
253253 np .testing .assert_allclose (out .iloc [0 ][front_key ],
@@ -288,9 +288,9 @@ def test_get_irradiance_limit(ants_params):
288288 model = 'isotropic' )
289289 # 15 W/m2 happens to be just below the difference (determined empirically)
290290 diff_sky = irrad ['poa_sky_diffuse' ] - ants ['poa_front_sky_diffuse' ]
291- diff_ground = irrad ['poa_ground_diffuse' ] - ants ['poa_front_ground_diffuse' ]
291+ diff_grd = irrad ['poa_ground_diffuse' ] - ants ['poa_front_ground_diffuse' ]
292292 assert all (diff_sky > 15 )
293- assert all (diff_ground > 15 )
293+ assert all (diff_grd > 15 )
294294
295295 # but as pitch->infinity, front-side irradiance converges to
296296 # output of get_total_irradiance
@@ -305,7 +305,7 @@ def test_get_irradiance_limit(ants_params):
305305 'poa_front_ground_diffuse' : 'poa_ground_diffuse' }
306306 ants_front = ants [list (colmap )].rename (columns = colmap )
307307 pd .testing .assert_frame_equal (ants_front , irrad , atol = 0.1 )
308-
308+
309309
310310@pytest .fixture
311311def ants_params_fixed ():
@@ -452,43 +452,46 @@ def test_get_irradiance_nonuniform_albedo_limit():
452452
453453
454454@pytest .mark .parametrize ('model,expected' , [
455- ('isotropic' , {'poa_front' : 1006.3548761345762 ,
456- 'poa_front_direct' : 833.3333333333335 ,
457- 'poa_front_diffuse' : 173.0215428012428 ,
458- 'poa_front_sky_diffuse' : 172.27247024391784 ,
459- 'poa_front_ground_diffuse' : 0.7490725573249604 ,
460- 'shaded_fraction_front' : 0.035915234551783914 ,
461- 'poa_back' : 23.626216052516494 ,
462- 'poa_back_direct' : 0.0 ,
463- 'poa_back_diffuse' : 23.626216052516494 ,
464- 'poa_back_sky_diffuse' : 8.509173579096064 ,
465- 'poa_back_ground_diffuse' : 15.11704247342043 ,
466- 'shaded_fraction_back' : 0.035915234551784025 }),
467- ('haydavies' , {'poa_front' : 1124.2311927022897 ,
468- 'poa_front_direct' : 1078.4313725490197 ,
469- 'poa_front_diffuse' : 45.79982015327015 ,
470- 'poa_front_sky_diffuse' : 45.60153624103707 ,
471- 'poa_front_ground_diffuse' : 0.19828391223307773 ,
472- 'shaded_fraction_front' : 0.035915234551783914 ,
473- 'poa_back' : 6.2539983668426 ,
474- 'poa_back_direct' : 0.0 ,
475- 'poa_back_diffuse' : 6.2539983668426 ,
476- 'poa_back_sky_diffuse' : 2.252428300348958 ,
477- 'poa_back_ground_diffuse' : 4.001570066493642 ,
478- 'shaded_fraction_back' : 0.035915234551784025 }),
479- ('perez' , {'poa_front' : 1060.3368384162613 ,
480- 'poa_front_direct' : 945.5770264984124 ,
481- 'poa_front_diffuse' : 114.75981191784896 ,
482- 'poa_front_sky_diffuse' : 114.26297537137229 ,
483- 'poa_front_ground_diffuse' : 0.4968365464766687 ,
484- 'shaded_fraction_front' : 0.035915234551783914 ,
485- 'poa_back' : 15.670534816764919 ,
486- 'poa_back_direct' : 0.0 ,
487- 'poa_back_diffuse' : 15.670534816764919 ,
488- 'poa_back_sky_diffuse' : 5.643870374194696 ,
489- 'poa_back_ground_diffuse' : 10.026664442570222 ,
490- 'shaded_fraction_back' : 0.035915234551784025 })
491- ])
455+ ('isotropic' , {
456+ 'poa_front' : 1006.3548761345762 ,
457+ 'poa_front_direct' : 833.3333333333335 ,
458+ 'poa_front_diffuse' : 173.0215428012428 ,
459+ 'poa_front_sky_diffuse' : 172.27247024391784 ,
460+ 'poa_front_ground_diffuse' : 0.7490725573249604 ,
461+ 'shaded_fraction_front' : 0.035915234551783914 ,
462+ 'poa_back' : 23.626216052516494 ,
463+ 'poa_back_direct' : 0.0 ,
464+ 'poa_back_diffuse' : 23.626216052516494 ,
465+ 'poa_back_sky_diffuse' : 8.509173579096064 ,
466+ 'poa_back_ground_diffuse' : 15.11704247342043 ,
467+ 'shaded_fraction_back' : 0.035915234551784025 }),
468+ ('haydavies' , {
469+ 'poa_front' : 1124.2311927022897 ,
470+ 'poa_front_direct' : 1078.4313725490197 ,
471+ 'poa_front_diffuse' : 45.79982015327015 ,
472+ 'poa_front_sky_diffuse' : 45.60153624103707 ,
473+ 'poa_front_ground_diffuse' : 0.19828391223307773 ,
474+ 'shaded_fraction_front' : 0.035915234551783914 ,
475+ 'poa_back' : 6.2539983668426 ,
476+ 'poa_back_direct' : 0.0 ,
477+ 'poa_back_diffuse' : 6.2539983668426 ,
478+ 'poa_back_sky_diffuse' : 2.252428300348958 ,
479+ 'poa_back_ground_diffuse' : 4.001570066493642 ,
480+ 'shaded_fraction_back' : 0.035915234551784025 }),
481+ ('perez' , {
482+ 'poa_front' : 1060.3368384162613 ,
483+ 'poa_front_direct' : 945.5770264984124 ,
484+ 'poa_front_diffuse' : 114.75981191784896 ,
485+ 'poa_front_sky_diffuse' : 114.26297537137229 ,
486+ 'poa_front_ground_diffuse' : 0.4968365464766687 ,
487+ 'shaded_fraction_front' : 0.035915234551783914 ,
488+ 'poa_back' : 15.670534816764919 ,
489+ 'poa_back_direct' : 0.0 ,
490+ 'poa_back_diffuse' : 15.670534816764919 ,
491+ 'poa_back_sky_diffuse' : 5.643870374194696 ,
492+ 'poa_back_ground_diffuse' : 10.026664442570222 ,
493+ 'shaded_fraction_back' : 0.035915234551784025 })
494+ ])
492495def test_get_irradiance_regression (model , expected , ants_params_fixed ):
493496 # values computed for typical but arbitrary inputs, to verify that output
494497 # is stable over time
0 commit comments