@@ -398,12 +398,12 @@ def test_perez_zero_dhi_and_dni_scalar():
398398 args = (20 , 180 , 0.0 , 0.0 , 1366.1 , 89.96 , 256.28 , 37.32 )
399399
400400 out = irradiance .perez (* args )
401- expected = 0.0
402- assert_equal (out , expected )
401+ poa_sky_diffuse_expected = 0.0
402+ assert_equal (out , poa_sky_diffuse_expected )
403403
404404 out = irradiance .perez (* args , return_components = True )
405405 expected = {
406- "poa_sky_diffuse" : 0.0 ,
406+ "poa_sky_diffuse" : poa_sky_diffuse_expected ,
407407 "poa_isotropic" : 0.0 ,
408408 "poa_circumsolar" : 0.0 ,
409409 "poa_horizon" : 0.0 ,
@@ -419,30 +419,31 @@ def test_perez_zero_dhi_and_dni_scalar():
419419
420420
421421def test_perez_array_dhi_and_dni_combos ():
422- # Divides zero by zero.
422+ # Divides zero and non-zero by zero and various NaN division combos .
423423 args = (
424- 20 , 180 , np .array ([0.0 , 10.0 , np .nan , 0.0 , np .nan ]),
425- np .array ([0.0 , 0.0 , 0.0 , np .nan , np .nan ]), 1366.1 , 89.96 , 256.28 ,
426- 37.32
424+ 20 , 180 ,
425+ np .array ([0.0 , 10.0 , np .nan , np .nan , 0.0 , 100.0 , np .nan ]),
426+ np .array ([0.0 , 0.0 , 0.0 , 100.0 , np .nan , np .nan , np .nan ]),
427+ 1366.1 , 89.96 , 256.28 , 37.32
427428 )
428429
429430 out = irradiance .perez (* args )
430- expected = np .array ([0.0 , 9.424924186619206 , np .nan , np .nan , np .nan ])
431- assert_allclose (out , expected )
431+ poa_sky_diffuse_expected = np .array (
432+ [0.0 , 9.424924186619206 , np .nan , np .nan , np .nan , np .nan , np .nan ]
433+ )
434+ assert_allclose (out , poa_sky_diffuse_expected )
432435
433436 out = irradiance .perez (* args , return_components = True )
434437 expected = {
435- "poa_sky_diffuse" : np .array (
436- [0.0 , 9.424924186619206 , np .nan , np .nan , np .nan ]
437- ),
438+ "poa_sky_diffuse" : poa_sky_diffuse_expected ,
438439 "poa_isotropic" : np .array (
439- [ 0.0 , 9.162258932459126 , np .nan , np .nan , np .nan ]
440+ [0.0 , 9.162258932459126 , np . nan , np . nan , np .nan , np .nan , np .nan ]
440441 ),
441442 "poa_circumsolar" : np .array (
442- [ 0.0 , 0.5187450944545264 , np .nan , np .nan , np .nan ]
443+ [0.0 , 0.5187450944545264 , np . nan , np . nan , np .nan , np .nan , np .nan ]
443444 ),
444445 "poa_horizon" : np .array (
445- [0.0 , - 0.2560798402944465 , np .nan , np .nan , np .nan ]
446+ [0.0 , - 0.2560798402944465 , np .nan , np .nan , np .nan , np . nan , np . nan ]
446447 ),
447448 }
448449 assert len (out ) == len (expected )
0 commit comments