Skip to content

Commit 125cae2

Browse files
committed
further fixes to min req and transition to all nrel_numpy defaults
1 parent 2d14082 commit 125cae2

File tree

4 files changed

+48
-37
lines changed

4 files changed

+48
-37
lines changed

ci/requirements-py27-min.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: test_env
22
dependencies:
33
- python=2.7
44
- numpy==1.8.2
5-
- scipy
65
- pandas==0.13.1
76
- nose
87
- pytz

pvlib/clearsky.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222
def ineichen(time, latitude, longitude, altitude=0, linke_turbidity=None,
23-
solarposition_method='pyephem', zenith_data=None,
23+
solarposition_method='nrel_numpy', zenith_data=None,
2424
airmass_model='young1994', airmass_data=None,
2525
interp_turbidity=True):
2626
'''

pvlib/test/test_clearsky.py

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,33 @@
2525
@requires_scipy
2626
def test_ineichen_required():
2727
# the clearsky function should call lookup_linke_turbidity by default
28-
expected = pd.DataFrame(np.array([[0.,0.,0.],
29-
[0.,0.,0.],
30-
[51.0100314,259.73341927,82.76689082],
31-
[104.99512329,832.22000002,682.43280974],
32-
[121.97931179,901.31646645,1008.00975362],
33-
[112.5726345,867.73434086,824.48415382],
34-
[76.61228483,587.82419004,253.67624301],
35-
[0.,0.,0.],
36-
[0.,0.,0.]]),
28+
expected = pd.DataFrame(
29+
np.array([[ 0. , 0. , 0. ],
30+
[ 0. , 0. , 0. ],
31+
[ 51.47811191, 265.33462162, 84.48262202],
32+
[ 105.008507 , 832.29100407, 682.67761951],
33+
[ 121.97988054, 901.31821834, 1008.02102657],
34+
[ 112.57957512, 867.76297247, 824.61702926],
35+
[ 76.69672675, 588.8462898 , 254.5808329 ],
36+
[ 0. , 0. , 0. ],
37+
[ 0. , 0. , 0. ]]),
3738
columns=['dhi', 'dni', 'ghi'],
3839
index=times_localized)
3940
out = clearsky.ineichen(times_localized, tus.latitude, tus.longitude)
4041
assert_frame_equal(expected, out)
4142

4243

4344
def test_ineichen_supply_linke():
44-
expected = pd.DataFrame(np.array([[0.,0.,0.],
45-
[0.,0.,0.],
46-
[39.81862097,316.23284759,78.48350328],
47-
[95.12705301,876.43232906,703.24156169],
48-
[118.45796469,939.81499487,1042.33401282],
49-
[105.35769022,909.0884868,851.19721202],
50-
[61.83556162,646.45362207,256.55983299],
51-
[0.,0.,0.],
52-
[0.,0.,0.]]),
45+
expected = pd.DataFrame(
46+
np.array([[ 0. , 0. , 0. ],
47+
[ 0. , 0. , 0. ],
48+
[ 40.19492186, 322.1949484 , 80.27218726],
49+
[ 95.14479487, 876.49778895, 703.49655602],
50+
[ 118.45876694, 939.816594 , 1042.34575261],
51+
[ 105.36721216, 909.11474576, 851.33560265],
52+
[ 61.91851386, 647.43752674, 257.50239737],
53+
[ 0. , 0. , 0. ],
54+
[ 0. , 0. , 0. ]]),
5355
columns=['dhi', 'dni', 'ghi'],
5456
index=times_localized)
5557
out = clearsky.ineichen(times_localized, tus.latitude, tus.longitude,
@@ -65,15 +67,16 @@ def test_ineichen_solpos():
6567

6668

6769
def test_ineichen_airmass():
68-
expected = pd.DataFrame(np.array([[0.,0.,0.],
69-
[0.,0.,0.],
70-
[53.52826665,250.64463008,84.17386592],
71-
[101.32775752,842.86030421,686.14824255],
72-
[117.7568185,909.70199089,1012.03056908],
73-
[108.61662929,877.27820363,828.35817853],
74-
[75.15682967,601.03375193,256.19976209],
75-
[0.,0.,0.],
76-
[0.,0.,0.]]),
70+
expected = pd.DataFrame(
71+
np.array([[ 0. , 0. , 0. ],
72+
[ 0. , 0. , 0. ],
73+
[ 53.90422388, 257.01655613, 85.87406435],
74+
[ 101.34055688, 842.92925705, 686.39337307],
75+
[ 117.7573735 , 909.70367947, 1012.04184961],
76+
[ 108.6233401 , 877.30589626, 828.49118038],
77+
[ 75.23108133, 602.06895546, 257.10961202],
78+
[ 0. , 0. , 0. ],
79+
[ 0. , 0. , 0. ]]),
7780
columns=['dhi', 'dni', 'ghi'],
7881
index=times_localized)
7982
out = clearsky.ineichen(times_localized, tus.latitude, tus.longitude,
@@ -82,6 +85,7 @@ def test_ineichen_airmass():
8285
assert_frame_equal(expected, out)
8386

8487

88+
@requires_scipy
8589
def test_lookup_linke_turbidity():
8690
times = pd.date_range(start='2014-06-24', end='2014-06-25',
8791
freq='12h', tz=tus.tz)
@@ -93,6 +97,7 @@ def test_lookup_linke_turbidity():
9397
assert_series_equal(expected, out)
9498

9599

100+
@requires_scipy
96101
def test_lookup_linke_turbidity_nointerp():
97102
times = pd.date_range(start='2014-06-24', end='2014-06-25',
98103
freq='12h', tz=tus.tz)
@@ -103,6 +108,7 @@ def test_lookup_linke_turbidity_nointerp():
103108
assert_series_equal(expected, out)
104109

105110

111+
@requires_scipy
106112
def test_lookup_linke_turbidity_months():
107113
times = pd.date_range(start='2014-04-01', end='2014-07-01',
108114
freq='1M', tz=tus.tz)
@@ -113,6 +119,7 @@ def test_lookup_linke_turbidity_months():
113119
assert_series_equal(expected, out)
114120

115121

122+
@requires_scipy
116123
def test_lookup_linke_turbidity_nointerp_months():
117124
times = pd.date_range(start='2014-04-10', end='2014-07-10',
118125
freq='1M', tz=tus.tz)

pvlib/test/test_irradiance.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
from pvlib import irradiance
1616
from pvlib import atmosphere
1717

18+
from . import requires_ephem
19+
1820
# setup times and location to be tested.
1921
times = pd.date_range(start=datetime.datetime(2014, 6, 24),
2022
end=datetime.datetime(2014, 6, 26), freq='1Min')
@@ -24,11 +26,11 @@
2426
times_localized = times.tz_localize(tus.tz)
2527

2628
ephem_data = solarposition.get_solarposition(times, tus.latitude,
27-
tus.longitude, method='pyephem')
29+
tus.longitude, method='nrel_numpy')
2830

2931
irrad_data = clearsky.ineichen(times, tus.latitude, tus.longitude,
3032
altitude=tus.altitude, linke_turbidity=3,
31-
solarposition_method='pyephem')
33+
solarposition_method='nrel_numpy')
3234

3335
dni_et = irradiance.extraradiation(times.dayofyear)
3436

@@ -60,15 +62,18 @@ def test_extraradiation_spencer():
6062
1382, irradiance.extraradiation(300, method='spencer'), -1)
6163

6264

65+
@requires_ephem
6366
def test_extraradiation_ephem_dtindex():
6467
irradiance.extraradiation(times, method='pyephem')
6568

6669

70+
@requires_ephem
6771
def test_extraradiation_ephem_scalar():
6872
assert_almost_equals(
6973
1382, irradiance.extraradiation(300, method='pyephem').values[0], -1)
7074

7175

76+
@requires_ephem
7277
def test_extraradiation_ephem_doyarray():
7378
irradiance.extraradiation(times.dayofyear, method='pyephem')
7479

@@ -111,21 +116,21 @@ def test_klucher_series_float():
111116
def test_klucher_series():
112117
irradiance.klucher(40, 180, irrad_data['dhi'], irrad_data['ghi'],
113118
ephem_data['apparent_zenith'],
114-
ephem_data['apparent_azimuth'])
119+
ephem_data['azimuth'])
115120

116121

117122
def test_haydavies():
118123
irradiance.haydavies(40, 180, irrad_data['dhi'], irrad_data['dni'],
119124
dni_et,
120125
ephem_data['apparent_zenith'],
121-
ephem_data['apparent_azimuth'])
126+
ephem_data['azimuth'])
122127

123128

124129
def test_reindl():
125130
irradiance.reindl(40, 180, irrad_data['dhi'], irrad_data['dni'],
126131
irrad_data['ghi'], dni_et,
127132
ephem_data['apparent_zenith'],
128-
ephem_data['apparent_azimuth'])
133+
ephem_data['azimuth'])
129134

130135

131136
def test_king():
@@ -137,7 +142,7 @@ def test_perez():
137142
AM = atmosphere.relativeairmass(ephem_data['apparent_zenith'])
138143
irradiance.perez(40, 180, irrad_data['dhi'], irrad_data['dni'],
139144
dni_et, ephem_data['apparent_zenith'],
140-
ephem_data['apparent_azimuth'], AM)
145+
ephem_data['azimuth'], AM)
141146

142147
# klutcher (misspelling) will be removed in 0.3
143148
def test_total_irrad():
@@ -158,12 +163,12 @@ def test_total_irrad():
158163

159164
def test_globalinplane():
160165
aoi = irradiance.aoi(40, 180, ephem_data['apparent_zenith'],
161-
ephem_data['apparent_azimuth'])
166+
ephem_data['azimuth'])
162167
airmass = atmosphere.relativeairmass(ephem_data['apparent_zenith'])
163168
gr_sand = irradiance.grounddiffuse(40, ghi, surface_type='sand')
164169
diff_perez = irradiance.perez(
165170
40, 180, irrad_data['dhi'], irrad_data['dni'], dni_et,
166-
ephem_data['apparent_zenith'], ephem_data['apparent_azimuth'], airmass)
171+
ephem_data['apparent_zenith'], ephem_data['azimuth'], airmass)
167172
irradiance.globalinplane(
168173
aoi=aoi, dni=irrad_data['dni'], poa_sky_diffuse=diff_perez,
169174
poa_ground_diffuse=gr_sand)

0 commit comments

Comments
 (0)