Skip to content

Commit 98846e6

Browse files
author
Omar
committed
Fix Flake8 errors:
remove whitespace from blank lines and break long lines - Removed trailing whitespace from blank lines in pvlib/pvarray.py - Broke long lines in function definitions and assertions to comply with line length limits - Reformatted comments and code in tests/test_pvarray.py for Flake8 compliance
1 parent 1833dc1 commit 98846e6

2 files changed

Lines changed: 25 additions & 14 deletions

File tree

pvlib/pvarray.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -245,25 +245,21 @@ def _infer_k_huld(cell_type, pdc0):
245245
def _infer_k_huld_eu_jrc(cell_type, pdc0):
246246
"""
247247
Get the EU JRC updated coefficients for the Huld model.
248-
249248
Parameters
250249
----------
251250
cell_type : str
252251
Must be one of 'csi', 'cis', or 'cdte'
253252
pdc0 : numeric
254253
Power of the modules at reference conditions [W]
255-
256254
Returns
257255
-------
258256
tuple
259257
The six coefficients (k1-k6) for the Huld model, scaled by pdc0
260-
261258
Notes
262259
-----
263260
These coefficients are from the EU JRC paper [1]_. The coefficients are
264261
for the version of Huld's equation that has factored Pdc0 out of the
265262
polynomial, so they are multiplied by pdc0 before being returned.
266-
267263
References
268264
----------
269265
.. [1] EU JRC paper, "Updated coefficients for the Huld model",
@@ -280,7 +276,14 @@ def _infer_k_huld_eu_jrc(cell_type, pdc0):
280276
return k
281277

282278

283-
def huld(effective_irradiance, temp_mod, pdc0, k=None, cell_type=None, use_eu_jrc=False):
279+
def huld(
280+
effective_irradiance,
281+
temp_mod,
282+
pdc0,
283+
k=None,
284+
cell_type=None,
285+
use_eu_jrc=False
286+
):
284287
r"""
285288
Power (DC) using the Huld model.
286289
@@ -392,8 +395,10 @@ def huld(effective_irradiance, temp_mod, pdc0, k=None, cell_type=None, use_eu_jr
392395
logGprime = np.log(gprime, out=np.zeros_like(gprime),
393396
where=np.array(gprime > 0))
394397
# Eq. 1 in [1]
395-
pdc = gprime * (pdc0 + k[0] * logGprime + k[1] * logGprime**2 +
396-
k[2] * tprime + k[3] * tprime * logGprime +
397-
k[4] * tprime * logGprime**2 +
398-
k[5] * tprime**2)
398+
pdc = gprime * (
399+
pdc0 + k[0] * logGprime + k[1] * logGprime**2 +
400+
k[2] * tprime + k[3] * tprime * logGprime +
401+
k[4] * tprime * logGprime**2 +
402+
k[5] * tprime**2
403+
)
399404
return pdc

tests/test_pvarray.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,23 @@ def test_huld_eu_jrc():
7777
# Use non-reference values so coefficients affect the result
7878
eff_irr = 800 # W/m^2 (not 1000)
7979
temp_mod = 35 # deg C (not 25)
80-
# Test that EU JRC coefficients give different results than original for all cell types
80+
# Test that EU JRC coefficients give different results
81+
# than original for all cell types
8182
for cell_type in ['cSi', 'CIS', 'CdTe']:
8283
res_orig = pvarray.huld(eff_irr, temp_mod, pdc0, cell_type=cell_type)
8384
res_eu_jrc = pvarray.huld(
84-
eff_irr, temp_mod, pdc0, cell_type=cell_type, use_eu_jrc=True)
85+
eff_irr, temp_mod, pdc0, cell_type=cell_type, use_eu_jrc=True
86+
)
8587
assert not np.isclose(res_orig, res_eu_jrc), (
86-
f"Results should differ for {cell_type}: {res_orig} vs {res_eu_jrc}")
87-
# Also check that all cell types are supported and error is raised for invalid type
88+
f"Results should differ for {cell_type}: "
89+
f"{res_orig} vs {res_eu_jrc}"
90+
)
91+
# Also check that all cell types are supported
92+
# and error is raised for invalid type
8893
try:
8994
pvarray.huld(
90-
eff_irr, temp_mod, pdc0, cell_type='invalid', use_eu_jrc=True)
95+
eff_irr, temp_mod, pdc0, cell_type='invalid', use_eu_jrc=True
96+
)
9197
except KeyError:
9298
pass
9399
else:

0 commit comments

Comments
 (0)