Skip to content

Commit e495c42

Browse files
committed
add disc test
1 parent 6d029aa commit e495c42

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

pvlib/test/test_clearsky.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from nose.tools import raises
1010

11+
from numpy.testing import assert_almost_equal
12+
1113
from pvlib.location import Location
1214
from pvlib import clearsky
1315
from pvlib import solarposition
@@ -54,3 +56,23 @@ def test_haurwitz():
5456
def test_haurwitz_keys():
5557
clearsky_data = clearsky.haurwitz(ephem_data['zenith'])
5658
assert 'GHI' in clearsky_data.columns
59+
60+
61+
# test DISC
62+
def test_disc_keys():
63+
clearsky_data = clearsky.ineichen(times, tus)
64+
disc_data = clearsky.disc(clearsky_data['GHI'], ephem_data['zenith'],
65+
ephem_data.index)
66+
assert 'DNI_gen_DISC' in disc_data.columns
67+
assert 'Kt_gen_DISC' in disc_data.columns
68+
assert 'AM' in disc_data.columns
69+
70+
def test_disc_value():
71+
times = pd.DatetimeIndex(['2014-06-24T12-0700','2014-06-24T18-0700'])
72+
ghi = pd.Series([1038.62, 254.53], index=times)
73+
zenith = pd.Series([10.567, 72.469], index=times)
74+
pressure = 93193.
75+
disc_data = clearsky.disc(ghi, zenith, times, pressure=pressure)
76+
assert_almost_equal(disc_data['DNI_gen_DISC'].values,
77+
np.array([830.46, 676.09]), 1)
78+

0 commit comments

Comments
 (0)