Skip to content

Commit

Permalink
add disc test
Browse files Browse the repository at this point in the history
  • Loading branch information
wholmgren committed Mar 12, 2015
1 parent 6d029aa commit e495c42
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pvlib/test/test_clearsky.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

from nose.tools import raises

from numpy.testing import assert_almost_equal

from pvlib.location import Location
from pvlib import clearsky
from pvlib import solarposition
Expand Down Expand Up @@ -54,3 +56,23 @@ def test_haurwitz():
def test_haurwitz_keys():
clearsky_data = clearsky.haurwitz(ephem_data['zenith'])
assert 'GHI' in clearsky_data.columns


# test DISC
def test_disc_keys():
clearsky_data = clearsky.ineichen(times, tus)
disc_data = clearsky.disc(clearsky_data['GHI'], ephem_data['zenith'],
ephem_data.index)
assert 'DNI_gen_DISC' in disc_data.columns
assert 'Kt_gen_DISC' in disc_data.columns
assert 'AM' in disc_data.columns

def test_disc_value():
times = pd.DatetimeIndex(['2014-06-24T12-0700','2014-06-24T18-0700'])
ghi = pd.Series([1038.62, 254.53], index=times)
zenith = pd.Series([10.567, 72.469], index=times)
pressure = 93193.
disc_data = clearsky.disc(ghi, zenith, times, pressure=pressure)
assert_almost_equal(disc_data['DNI_gen_DISC'].values,
np.array([830.46, 676.09]), 1)

0 comments on commit e495c42

Please sign in to comment.