@@ -174,8 +174,10 @@ def test_ModelChain_creation(sapm_dc_snl_ac_system, location):
174
174
(None , (32.2 , 180 )), ('None' , (32.2 , 180 )), ('flat' , (0 , 180 )),
175
175
('south_at_latitude_tilt' , (32.2 , 180 ))
176
176
])
177
- def test_orientation_strategy (strategy , expected , sapm_dc_snl_ac_system , location ):
178
- mc = ModelChain (sapm_dc_snl_ac_system , location , orientation_strategy = strategy )
177
+ def test_orientation_strategy (strategy , expected , sapm_dc_snl_ac_system ,
178
+ location ):
179
+ mc = ModelChain (sapm_dc_snl_ac_system , location ,
180
+ orientation_strategy = strategy )
179
181
180
182
# the || accounts for the coercion of 'None' to None
181
183
assert (mc .orientation_strategy == strategy or
@@ -231,7 +233,8 @@ def test_complete_irradiance_times(sapm_dc_snl_ac_system, location):
231
233
232
234
233
235
def test_run_model_perez (sapm_dc_snl_ac_system , location ):
234
- mc = ModelChain (sapm_dc_snl_ac_system , location , transposition_model = 'perez' )
236
+ mc = ModelChain (sapm_dc_snl_ac_system , location ,
237
+ transposition_model = 'perez' )
235
238
times = pd .date_range ('20160101 1200-0700' , periods = 2 , freq = '6H' )
236
239
irradiance = pd .DataFrame ({'dni' : 900 , 'ghi' : 600 , 'dhi' : 150 },
237
240
index = times )
@@ -243,7 +246,8 @@ def test_run_model_perez(sapm_dc_snl_ac_system, location):
243
246
244
247
245
248
def test_run_model_gueymard_perez (sapm_dc_snl_ac_system , location ):
246
- mc = ModelChain (sapm_dc_snl_ac_system , location , airmass_model = 'gueymard1993' ,
249
+ mc = ModelChain (sapm_dc_snl_ac_system , location ,
250
+ airmass_model = 'gueymard1993' ,
247
251
transposition_model = 'perez' )
248
252
times = pd .date_range ('20160101 1200-0700' , periods = 2 , freq = '6H' )
249
253
irradiance = pd .DataFrame ({'dni' : 900 , 'ghi' : 600 , 'dhi' : 150 },
@@ -255,7 +259,8 @@ def test_run_model_gueymard_perez(sapm_dc_snl_ac_system, location):
255
259
assert_series_equal (ac , expected )
256
260
257
261
258
- def test_run_model_with_weather_sapm_temp (sapm_dc_snl_ac_system , location , weather , mocker ):
262
+ def test_run_model_with_weather_sapm_temp (sapm_dc_snl_ac_system , location ,
263
+ weather , mocker ):
259
264
# test with sapm cell temperature model
260
265
weather ['wind_speed' ] = 5
261
266
weather ['temp_air' ] = 10
@@ -273,7 +278,8 @@ def test_run_model_with_weather_sapm_temp(sapm_dc_snl_ac_system, location, weath
273
278
assert not mc .ac .empty
274
279
275
280
276
- def test_run_model_with_weather_pvsyst_temp (sapm_dc_snl_ac_system , location , weather , mocker ):
281
+ def test_run_model_with_weather_pvsyst_temp (sapm_dc_snl_ac_system , location ,
282
+ weather , mocker ):
277
283
# test with pvsyst cell temperature model
278
284
weather ['wind_speed' ] = 5
279
285
weather ['temp_air' ] = 10
@@ -290,11 +296,14 @@ def test_run_model_with_weather_pvsyst_temp(sapm_dc_snl_ac_system, location, wea
290
296
assert not mc .ac .empty
291
297
292
298
293
- def test_run_model_with_weather_faiman_temp (sapm_dc_snl_ac_system , location , weather , mocker ):
299
+ def test_run_model_with_weather_faiman_temp (sapm_dc_snl_ac_system , location ,
300
+ weather , mocker ):
294
301
# test with faiman cell temperature model
295
302
weather ['wind_speed' ] = 5
296
303
weather ['temp_air' ] = 10
297
- sapm_dc_snl_ac_system .temperature_model_parameters = {'u0' : 25.0 , 'u1' : 6.84 }
304
+ sapm_dc_snl_ac_system .temperature_model_parameters = {
305
+ 'u0' : 25.0 , 'u1' : 6.84
306
+ }
298
307
mc = ModelChain (sapm_dc_snl_ac_system , location )
299
308
mc .temperature_model = 'faiman'
300
309
m_faiman = mocker .spy (sapm_dc_snl_ac_system , 'faiman_celltemp' )
@@ -308,7 +317,9 @@ def test_run_model_with_weather_faiman_temp(sapm_dc_snl_ac_system, location, wea
308
317
def test_run_model_tracker (sapm_dc_snl_ac_system , location , weather , mocker ):
309
318
system = SingleAxisTracker (
310
319
module_parameters = sapm_dc_snl_ac_system .module_parameters ,
311
- temperature_model_parameters = sapm_dc_snl_ac_system .temperature_model_parameters ,
320
+ temperature_model_parameters = (
321
+ sapm_dc_snl_ac_system .temperature_model_parameters
322
+ ),
312
323
inverter_parameters = sapm_dc_snl_ac_system .inverter_parameters )
313
324
mocker .spy (system , 'singleaxis' )
314
325
mc = ModelChain (system , location )
@@ -332,9 +343,9 @@ def poadc(mc):
332
343
pytest .param ('pvsyst' , marks = requires_scipy ),
333
344
pytest .param ('singlediode' , marks = requires_scipy ),
334
345
'pvwatts_dc' ])
335
- def test_infer_dc_model (sapm_dc_snl_ac_system , cec_dc_snl_ac_system , pvsyst_dc_snl_ac_system ,
336
- pvwatts_dc_pvwatts_ac_system , location , dc_model ,
337
- weather , mocker ):
346
+ def test_infer_dc_model (sapm_dc_snl_ac_system , cec_dc_snl_ac_system ,
347
+ pvsyst_dc_snl_ac_system , pvwatts_dc_pvwatts_ac_system ,
348
+ location , dc_model , weather , mocker ):
338
349
dc_systems = {'sapm' : sapm_dc_snl_ac_system ,
339
350
'cec' : cec_dc_snl_ac_system ,
340
351
'desoto' : cec_dc_snl_ac_system ,
@@ -374,7 +385,8 @@ def test_infer_dc_model(sapm_dc_snl_ac_system, cec_dc_snl_ac_system, pvsyst_dc_s
374
385
'sapm' ,
375
386
pytest .param ('cec' , marks = requires_scipy ),
376
387
pytest .param ('cec_native' , marks = requires_scipy )])
377
- def test_infer_spectral_model (location , sapm_dc_snl_ac_system , cec_dc_snl_ac_system ,
388
+ def test_infer_spectral_model (location , sapm_dc_snl_ac_system ,
389
+ cec_dc_snl_ac_system ,
378
390
cec_dc_native_snl_ac_system , dc_model ):
379
391
dc_systems = {'sapm' : sapm_dc_snl_ac_system ,
380
392
'cec' : cec_dc_snl_ac_system ,
@@ -407,16 +419,17 @@ def test_infer_temp_model(location, sapm_dc_snl_ac_system,
407
419
def test_infer_temp_model_invalid (location , sapm_dc_snl_ac_system ):
408
420
sapm_dc_snl_ac_system .temperature_model_parameters .pop ('a' )
409
421
with pytest .raises (ValueError ):
410
- ModelChain (sapm_dc_snl_ac_system , location , orientation_strategy = 'None' ,
411
- aoi_model = 'physical' , spectral_model = 'no_loss' )
422
+ ModelChain (sapm_dc_snl_ac_system , location ,
423
+ orientation_strategy = 'None' , aoi_model = 'physical' ,
424
+ spectral_model = 'no_loss' )
412
425
413
426
414
427
@requires_scipy
415
428
def test_temperature_model_inconsistent (location , sapm_dc_snl_ac_system ):
416
429
with pytest .raises (ValueError ):
417
- ModelChain (sapm_dc_snl_ac_system , location , orientation_strategy = 'None' ,
418
- aoi_model = 'physical ' , spectral_model = 'no_loss ' ,
419
- temperature_model = 'pvsyst' )
430
+ ModelChain (sapm_dc_snl_ac_system , location ,
431
+ orientation_strategy = 'None ' , aoi_model = 'physical ' ,
432
+ spectral_model = 'no_loss' , temperature_model = 'pvsyst' )
420
433
421
434
422
435
def test_dc_model_user_func (pvwatts_dc_pvwatts_ac_system , location , weather ,
@@ -437,9 +450,11 @@ def acdc(mc):
437
450
@pytest .mark .parametrize ('ac_model' , [
438
451
'snlinverter' , pytest .param ('adrinverter' , marks = requires_scipy ),
439
452
'pvwatts' ])
440
- def test_ac_models (sapm_dc_snl_ac_system , cec_dc_adr_ac_system , pvwatts_dc_pvwatts_ac_system ,
441
- location , ac_model , weather , mocker ):
442
- ac_systems = {'snlinverter' : sapm_dc_snl_ac_system , 'adrinverter' : cec_dc_adr_ac_system ,
453
+ def test_ac_models (sapm_dc_snl_ac_system , cec_dc_adr_ac_system ,
454
+ pvwatts_dc_pvwatts_ac_system , location , ac_model ,
455
+ weather , mocker ):
456
+ ac_systems = {'snlinverter' : sapm_dc_snl_ac_system ,
457
+ 'adrinverter' : cec_dc_adr_ac_system ,
443
458
'pvwatts' : pvwatts_dc_pvwatts_ac_system }
444
459
system = ac_systems [ac_model ]
445
460
@@ -473,7 +488,8 @@ def constant_aoi_loss(mc):
473
488
@pytest .mark .parametrize ('aoi_model' , [
474
489
'sapm' , 'ashrae' , 'physical' , 'martin_ruiz'
475
490
])
476
- def test_aoi_models (sapm_dc_snl_ac_system , location , aoi_model , weather , mocker ):
491
+ def test_aoi_models (sapm_dc_snl_ac_system , location , aoi_model ,
492
+ weather , mocker ):
477
493
mc = ModelChain (sapm_dc_snl_ac_system , location , dc_model = 'sapm' ,
478
494
aoi_model = aoi_model , spectral_model = 'no_loss' )
479
495
m = mocker .spy (sapm_dc_snl_ac_system , 'get_iam' )
@@ -534,7 +550,8 @@ def constant_spectral_loss(mc):
534
550
@pytest .mark .parametrize ('spectral_model' , [
535
551
'sapm' , 'first_solar' , 'no_loss' , constant_spectral_loss
536
552
])
537
- def test_spectral_models (sapm_dc_snl_ac_system , location , spectral_model , weather ):
553
+ def test_spectral_models (sapm_dc_snl_ac_system , location , spectral_model ,
554
+ weather ):
538
555
# add pw to weather dataframe
539
556
weather ['precipitable_water' ] = [0.3 , 0.5 ]
540
557
mc = ModelChain (sapm_dc_snl_ac_system , location , dc_model = 'sapm' ,
@@ -766,10 +783,11 @@ def test_basic_chain_altitude_pressure(sam_data, cec_inverter_parameters,
766
783
@pytest .mark .parametrize ('strategy, strategy_str' , [
767
784
('south_at_latitude_tilt' , 'south_at_latitude_tilt' ),
768
785
(None , 'None' )]) # GitHub issue 352
769
- def test_ModelChain___repr__ (sapm_dc_snl_ac_system , location , strategy , strategy_str ):
786
+ def test_ModelChain___repr__ (sapm_dc_snl_ac_system , location , strategy ,
787
+ strategy_str ):
770
788
771
- mc = ModelChain (sapm_dc_snl_ac_system , location , orientation_strategy = strategy ,
772
- name = 'my mc' )
789
+ mc = ModelChain (sapm_dc_snl_ac_system , location ,
790
+ orientation_strategy = strategy , name = 'my mc' )
773
791
774
792
expected = '\n ' .join ([
775
793
'ModelChain: ' ,
0 commit comments