Skip to content

Commit 19a8290

Browse files
committed
replace npoints-based test with alternative
1 parent e71e292 commit 19a8290

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

pvlib/tests/bifacial/test_utils.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,15 @@ def test__vf_ground_sky_2d(test_system_fixed_tilt):
9292
assert np.isclose(vf, vfs_gnd_sky[0])
9393

9494

95-
def test_vf_ground_sky_2d_integ(test_system_fixed_tilt):
96-
ts, pts, vfs_gnd_sky = test_system_fixed_tilt
97-
# pass rotation here since max_rows=1 for the hand-solved case in
98-
# the fixture test_system, which means the ground-to-sky view factor
99-
# isn't summed over enough rows for symmetry to hold.
100-
vf_integ = utils.vf_ground_sky_2d_integ(
101-
ts['rotation'], ts['gcr'], ts['height'], ts['pitch'],
102-
max_rows=1, npoints=3)
103-
expected_vf_integ = trapezoid(vfs_gnd_sky, pts, axis=0)
104-
assert np.isclose(vf_integ, expected_vf_integ, rtol=0.1)
95+
def test_vf_ground_sky_2d_integ():
96+
# test against numerical integration with vf_ground_sky_2d
97+
x = np.linspace(0, 1, num=1000)
98+
kwargs = dict(gcr=0.4, pitch=5.0, height=1.5)
99+
vf_x = utils.vf_ground_sky_2d(rotation=-60, x=x, **kwargs)
100+
vf_expected = trapezoid(vf_x, x, axis=0)
101+
102+
vf_actual = utils.vf_ground_sky_2d_integ(surface_tilt=60, **kwargs)
103+
assert np.isclose(vf_expected, vf_actual)
105104

106105

107106
def test_vf_ground_sky_2d_integ_deprecated():

0 commit comments

Comments
 (0)