Skip to content

Commit 8d2650a

Browse files
authored
add explicit tests for aoi and aoi projection functions (#345)
* add explicit tests for aoi and aoi projection functions * make expected values consistent with atol specification
1 parent eef1992 commit 8d2650a

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

docs/sphinx/source/whatsnew/v0.4.6.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ Documentation
2424
~~~~~~~~~~~~~
2525

2626

27+
Testing
28+
~~~~~~~
29+
30+
* Added explicit tests for aoi and aoi_projection functions.
31+
32+
2733
Contributors
2834
~~~~~~~~~~~~
2935

pvlib/test/test_irradiance.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,3 +422,22 @@ def test_dni():
422422
assert_series_equal(dni,
423423
pd.Series([float('nan'), float('nan'), 573.685662283,
424424
146.190220008, 573.685662283]))
425+
426+
427+
@pytest.mark.parametrize(
428+
'surface_tilt,surface_azimuth,solar_zenith,solar_azimuth,aoi_expected,aoi_proj_expected', [
429+
(0, 0, 0, 0, 0, 1),
430+
(30, 180, 30, 180, 0, 1),
431+
(30, 180, 150, 0, 180, -1),
432+
(90, 0, 30, 60, 75.5224878, 0.25),
433+
(90, 0, 30, 170, 119.4987042, -0.4924038)])
434+
def test_aoi_and_aoi_projection(surface_tilt, surface_azimuth, solar_zenith,
435+
solar_azimuth, aoi_expected,
436+
aoi_proj_expected):
437+
aoi = irradiance.aoi(surface_tilt, surface_azimuth, solar_zenith,
438+
solar_azimuth)
439+
assert_allclose(aoi, aoi_expected, atol=1e-6)
440+
441+
aoi_projection = irradiance.aoi_projection(
442+
surface_tilt, surface_azimuth, solar_zenith, solar_azimuth)
443+
assert_allclose(aoi_projection, aoi_proj_expected, atol=1e-6)

0 commit comments

Comments
 (0)