8
8
9
9
from nose .tools import assert_equals , assert_almost_equals
10
10
from pandas .util .testing import assert_series_equal , assert_frame_equal
11
- from . import incompatible_conda_linux_py3
11
+ from . import incompatible_conda_linux_py3 , incompatible_pandas_0180
12
12
13
13
from pvlib import tmy
14
14
from pvlib import pvsystem
@@ -61,7 +61,7 @@ def test_systemdef_tmy3():
61
61
'surface_azimuth' : 0 ,
62
62
'surface_tilt' : 0 }
63
63
assert_equals (expected , pvsystem .systemdef (tmy3_metadata , 0 , 0 , .1 , 5 , 5 ))
64
-
64
+
65
65
def test_systemdef_tmy2 ():
66
66
expected = {'tz' : - 5 ,
67
67
'albedo' : 0.1 ,
@@ -76,7 +76,7 @@ def test_systemdef_tmy2():
76
76
assert_equals (expected , pvsystem .systemdef (tmy2_metadata , 0 , 0 , .1 , 5 , 5 ))
77
77
78
78
def test_systemdef_dict ():
79
- expected = {'tz' : - 8 , ## Note that TZ is float, but Location sets tz as string
79
+ expected = {'tz' : - 8 , ## Note that TZ is float, but Location sets tz as string
80
80
'albedo' : 0.1 ,
81
81
'altitude' : 10 ,
82
82
'latitude' : 37.8 ,
@@ -87,7 +87,7 @@ def test_systemdef_dict():
87
87
'surface_azimuth' : 0 ,
88
88
'surface_tilt' : 5 }
89
89
assert_equals (expected , pvsystem .systemdef (meta , 5 , 0 , .1 , 5 , 5 ))
90
-
90
+
91
91
92
92
def test_ashraeiam ():
93
93
thetas = np .linspace (- 90 , 90 , 9 )
@@ -143,10 +143,10 @@ def test_sapm():
143
143
index = times )
144
144
am = pd .Series ([0 , 2.25 ], index = times )
145
145
aoi = pd .Series ([180 , 30 ], index = times )
146
-
146
+
147
147
sapm = pvsystem .sapm (module_parameters , irrad_data ['dni' ],
148
148
irrad_data ['dhi' ], 25 , am , aoi )
149
-
149
+
150
150
expected = pd .DataFrame (np .array (
151
151
[[ 0. , 0. , 0. , 0. ,
152
152
0. , 0. , 0. , 0. ],
@@ -155,7 +155,7 @@ def test_sapm():
155
155
columns = ['i_sc' , 'i_mp' , 'v_oc' , 'v_mp' , 'p_mp' , 'i_x' , 'i_xx' ,
156
156
'effective_irradiance' ],
157
157
index = times )
158
-
158
+
159
159
assert_frame_equal (sapm , expected )
160
160
161
161
# just make sure it works with a dict input
@@ -174,9 +174,9 @@ def test_PVSystem_sapm():
174
174
index = times )
175
175
am = pd .Series ([0 , 2.25 ], index = times )
176
176
aoi = pd .Series ([180 , 30 ], index = times )
177
-
177
+
178
178
sapm = system .sapm (irrad_data ['dni' ], irrad_data ['dhi' ], 25 , am , aoi )
179
-
179
+
180
180
expected = pd .DataFrame (np .array (
181
181
[[ 0. , 0. , 0. , 0. ,
182
182
0. , 0. , 0. , 0. ],
@@ -185,13 +185,14 @@ def test_PVSystem_sapm():
185
185
columns = ['i_sc' , 'i_mp' , 'v_oc' , 'v_mp' , 'p_mp' , 'i_x' , 'i_xx' ,
186
186
'effective_irradiance' ],
187
187
index = times )
188
-
188
+
189
189
assert_frame_equal (sapm , expected )
190
190
191
191
192
+ @incompatible_pandas_0180
192
193
def test_calcparams_desoto ():
193
- module = 'Example_Module'
194
- module_parameters = sam_data ['cecmod' ][module ]
194
+ module = 'Example_Module'
195
+ module_parameters = sam_data ['cecmod' ][module ]
195
196
times = pd .DatetimeIndex (start = '2015-01-01' , periods = 2 , freq = '12H' )
196
197
poa_data = pd .Series ([0 , 800 ], index = times )
197
198
@@ -210,8 +211,9 @@ def test_calcparams_desoto():
210
211
assert_almost_equals (nNsVth , 0.473 )
211
212
212
213
214
+ @incompatible_pandas_0180
213
215
def test_PVSystem_calcparams_desoto ():
214
- module = 'Example_Module'
216
+ module = 'Example_Module'
215
217
module_parameters = sam_data ['cecmod' ][module ].copy ()
216
218
module_parameters ['EgRef' ] = 1.121
217
219
module_parameters ['dEgdT' ] = - 0.0002677
@@ -238,7 +240,7 @@ def test_i_from_v():
238
240
239
241
@incompatible_conda_linux_py3
240
242
def test_PVSystem_i_from_v ():
241
- module = 'Example_Module'
243
+ module = 'Example_Module'
242
244
module_parameters = sam_data ['cecmod' ][module ]
243
245
system = pvsystem .PVSystem (module = module ,
244
246
module_parameters = module_parameters )
@@ -247,7 +249,7 @@ def test_PVSystem_i_from_v():
247
249
248
250
249
251
def test_singlediode_series ():
250
- module = 'Example_Module'
252
+ module = 'Example_Module'
251
253
module_parameters = sam_data ['cecmod' ][module ]
252
254
times = pd .DatetimeIndex (start = '2015-01-01' , periods = 2 , freq = '12H' )
253
255
poa_data = pd .Series ([0 , 800 ], index = times )
@@ -257,15 +259,15 @@ def test_singlediode_series():
257
259
alpha_isc = module_parameters ['alpha_sc' ],
258
260
module_parameters = module_parameters ,
259
261
EgRef = 1.121 ,
260
- dEgdT = - 0.0002677 )
262
+ dEgdT = - 0.0002677 )
261
263
out = pvsystem .singlediode (module_parameters , IL , I0 , Rs , Rsh , nNsVth )
262
264
assert isinstance (out , pd .DataFrame )
263
265
264
266
265
267
@incompatible_conda_linux_py3
266
- def test_singlediode_floats ():
267
- module = 'Example_Module'
268
- module_parameters = sam_data ['cecmod' ][module ]
268
+ def test_singlediode_floats ():
269
+ module = 'Example_Module'
270
+ module_parameters = sam_data ['cecmod' ][module ]
269
271
out = pvsystem .singlediode (module_parameters , 7 , 6e-7 , .1 , 20 , .5 )
270
272
expected = {'i_xx' : 4.2549732697234193 ,
271
273
'i_mp' : 6.1390251797935704 ,
@@ -280,11 +282,11 @@ def test_singlediode_floats():
280
282
281
283
282
284
@incompatible_conda_linux_py3
283
- def test_PVSystem_singlediode_floats ():
284
- module = 'Example_Module'
285
+ def test_PVSystem_singlediode_floats ():
286
+ module = 'Example_Module'
285
287
module_parameters = sam_data ['cecmod' ][module ]
286
288
system = pvsystem .PVSystem (module = module ,
287
- module_parameters = module_parameters )
289
+ module_parameters = module_parameters )
288
290
out = system .singlediode (7 , 6e-7 , .1 , 20 , .5 )
289
291
expected = {'i_xx' : 4.2549732697234193 ,
290
292
'i_mp' : 6.1390251797935704 ,
@@ -323,11 +325,11 @@ def test_sapm_celltemp_with_index():
323
325
winds = pd .Series ([10 , 5 , 0 ], index = times )
324
326
325
327
pvtemps = pvsystem .sapm_celltemp (irrads , winds , temps )
326
-
328
+
327
329
expected = pd .DataFrame ({'temp_cell' :[0. , 23.06066166 , 5. ],
328
330
'temp_module' :[0. , 21.56066166 , 5. ]},
329
331
index = times )
330
-
332
+
331
333
assert_frame_equal (expected , pvtemps )
332
334
333
335
@@ -380,7 +382,7 @@ def test_snlinverter_float():
380
382
381
383
pacs = pvsystem .snlinverter (inverters [testinv ], vdcs , pdcs )
382
384
assert_almost_equals (pacs , 132.004278 , 5 )
383
-
385
+
384
386
385
387
def test_PVSystem_creation ():
386
388
pv_system = pvsystem .PVSystem (module = 'blah' , inverter = 'blarg' )
@@ -400,13 +402,13 @@ def test_PVSystem_get_irradiance():
400
402
solar_position = location .get_solarposition (times )
401
403
irrads = pd .DataFrame ({'dni' :[900 ,0 ], 'ghi' :[600 ,0 ], 'dhi' :[100 ,0 ]},
402
404
index = times )
403
-
405
+
404
406
irradiance = system .get_irradiance (solar_position ['apparent_zenith' ],
405
407
solar_position ['azimuth' ],
406
408
irrads ['dni' ],
407
409
irrads ['ghi' ],
408
410
irrads ['dhi' ])
409
-
411
+
410
412
expected = pd .DataFrame (data = np .array (
411
413
[[ 883.65494055 , 745.86141676 , 137.79352379 , 126.397131 ,
412
414
11.39639279 ],
@@ -415,7 +417,7 @@ def test_PVSystem_get_irradiance():
415
417
'poa_diffuse' , 'poa_sky_diffuse' ,
416
418
'poa_ground_diffuse' ],
417
419
index = times )
418
-
420
+
419
421
irradiance = np .round (irradiance , 4 )
420
422
expected = np .round (expected , 4 )
421
423
assert_frame_equal (irradiance , expected )
@@ -425,7 +427,7 @@ def test_PVSystem_localize_with_location():
425
427
system = pvsystem .PVSystem (module = 'blah' , inverter = 'blarg' )
426
428
location = Location (latitude = 32 , longitude = - 111 )
427
429
localized_system = system .localize (location = location )
428
-
430
+
429
431
assert localized_system .module == 'blah'
430
432
assert localized_system .inverter == 'blarg'
431
433
assert localized_system .latitude == 32
@@ -435,7 +437,7 @@ def test_PVSystem_localize_with_location():
435
437
def test_PVSystem_localize_with_latlon ():
436
438
system = pvsystem .PVSystem (module = 'blah' , inverter = 'blarg' )
437
439
localized_system = system .localize (latitude = 32 , longitude = - 111 )
438
-
440
+
439
441
assert localized_system .module == 'blah'
440
442
assert localized_system .inverter == 'blarg'
441
443
assert localized_system .latitude == 32
0 commit comments