Skip to content

Commit 627fed3

Browse files
committed
Fix all styles violations after linter switch to Ruff
1 parent 5f70c5a commit 627fed3

8 files changed

Lines changed: 23 additions & 27 deletions

File tree

docs/examples/irradiance-transposition/use_perez_modelchain.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
# This example shows how the :py:class:`~pvlib.modelchain.ModelChain` can
2323
# be adjusted to use a different set of Perez coefficients.
2424

25-
import pandas as pd
2625
from pvlib.pvsystem import PVSystem
2726
from pvlib.modelchain import ModelChain
2827
from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS

pvlib/singlediode.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -768,12 +768,12 @@ def _lambertw_v_from_i(current, photocurrent, saturation_current,
768768
# Ensure that we are working with read-only views of numpy arrays
769769
# Turns Series into arrays so that we don't have to worry about
770770
# multidimensional broadcasting failing
771-
I, IL, I0, Rs, Gsh, a = \
771+
Iop, IL, I0, Rs, Gsh, a = \
772772
np.broadcast_arrays(current, photocurrent, saturation_current,
773773
resistance_series, conductance_shunt, nNsVth)
774774

775-
# Intitalize output V (I might not be float64)
776-
V = np.full_like(I, np.nan, dtype=np.float64)
775+
# Intitalize output Vop (Iop might not be float64)
776+
Vop = np.full_like(Iop, np.nan, dtype=np.float64)
777777

778778
# Determine indices where 0 < Gsh requires implicit model solution
779779
idx_p = 0. < Gsh
@@ -783,14 +783,14 @@ def _lambertw_v_from_i(current, photocurrent, saturation_current,
783783

784784
# Explicit solutions where Gsh=0
785785
if np.any(idx_z):
786-
V[idx_z] = a[idx_z] * np.log1p((IL[idx_z] - I[idx_z]) / I0[idx_z]) - \
787-
I[idx_z] * Rs[idx_z]
786+
Vop[idx_z] = a[idx_z] * np.log1p((IL[idx_z] - Iop[idx_z]) / I0[idx_z]) - \
787+
Iop[idx_z] * Rs[idx_z]
788788

789789
# Only compute using LambertW if there are cases with Gsh>0
790790
if np.any(idx_p):
791791

792792
# use only the relevant subset for what follows
793-
I = I[idx_p]
793+
Iop = Iop[idx_p]
794794
IL = IL[idx_p]
795795
I0 = I0[idx_p]
796796
Rs = Rs[idx_p]
@@ -800,7 +800,7 @@ def _lambertw_v_from_i(current, photocurrent, saturation_current,
800800
# LambertW argument, cannot be float128, may overflow to np.inf
801801
# overflow is explicitly handled below, so ignore warnings here
802802
with np.errstate(over='ignore'):
803-
argW = I0 / (Gsh * a) * np.exp((-I + IL + I0) / (Gsh * a))
803+
argW = I0 / (Gsh * a) * np.exp((-Iop + IL + I0) / (Gsh * a))
804804

805805
lambertwterm = np.zeros_like(argW)
806806

@@ -814,19 +814,19 @@ def _lambertw_v_from_i(current, photocurrent, saturation_current,
814814
# Calculate using log(argW) in case argW is really big
815815
logargW = (np.log(I0[idx_inf]) - np.log(Gsh[idx_inf]) -
816816
np.log(a[idx_inf]) +
817-
(-I[idx_inf] + IL[idx_inf] + I0[idx_inf]) /
817+
(-Iop[idx_inf] + IL[idx_inf] + I0[idx_inf]) /
818818
(Gsh[idx_inf] * a[idx_inf]))
819819
lambertwterm[idx_inf] = _log_lambertw(logargW)
820820

821821
# Eqn. 3 in Jain and Kapoor, 2004
822822
# V = -I*(Rs + Rsh) + IL*Rsh - a*lambertwterm + I0*Rsh
823823
# Recast in terms of Gsh=1/Rsh for better numerical stability.
824-
V[idx_p] = (IL + I0 - I) / Gsh - I * Rs - a * lambertwterm
824+
Vop[idx_p] = (IL + I0 - Iop) / Gsh - Iop * Rs - a * lambertwterm
825825

826826
if output_is_scalar:
827-
return V.item()
827+
return Vop.item()
828828
else:
829-
return V
829+
return Vop
830830

831831

832832
def _lambertw_i_from_v(voltage, photocurrent, saturation_current,

pvlib/spa.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ def heliocentric_longitude(jme):
472472

473473
l_rad = (l0 + l1 * jme + l2 * jme**2 + l3 * jme**3 + l4 * jme**4 +
474474
l5 * jme**5)/10**8
475-
l = np.rad2deg(l_rad)
476-
return l % 360
475+
l_deg = np.rad2deg(l_rad)
476+
return l_deg % 360
477477

478478
@jcompile('float64(float64)', nopython=True)
479479
def heliocentric_latitude(jme):

pvlib/spectrum/mismatch.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
import pandas as pd
1010
from scipy.integrate import trapezoid
1111

12-
from warnings import warn
13-
1412

1513
def calc_spectral_mismatch_field(sr, e_sun, e_ref=None):
1614
"""

pvlib/tracking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22
import pandas as pd
33

4-
from pvlib.tools import cosd, sind, tand, acosd, asind
4+
from pvlib.tools import cosd, sind, tand, acosd
55
from pvlib import irradiance
66
from pvlib import shading
77
from pvlib._deprecation import renamed_kwarg_warning

tests/iotools/test_midc.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import pandas as pd
22
import pytest
3-
import pytz
43

54
from pvlib.iotools import midc
65
from tests.conftest import TESTS_DATA_DIR, RERUNS, RERUNS_DELAY
@@ -34,7 +33,7 @@ def test_midc__format_index():
3433
start = start.tz_localize("MST")
3534
end = pd.Timestamp("20181014 23:59")
3635
end = end.tz_localize("MST")
37-
assert type(data.index) == pd.DatetimeIndex
36+
assert isinstance(data.index, pd.DatetimeIndex)
3837
assert data.index[0] == start
3938
assert data.index[-1] == end
4039

tests/test_clearsky.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ def test_clearsky_get_threshold_raises_error():
575575
def test_detect_clearsky_calls_threshold(mocker, detect_clearsky_threshold_data):
576576
threshold_spy = mocker.spy(clearsky, '_clearsky_get_threshold')
577577
expected, cs = detect_clearsky_threshold_data
578-
threshold_actual = clearsky.detect_clearsky(expected['GHI'], cs['ghi'],
578+
_ = clearsky.detect_clearsky(expected['GHI'], cs['ghi'],
579579
infer_limits=True)
580580
assert threshold_spy.call_count == 1
581581

tests/test_pvsystem.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,18 +1298,18 @@ def test_v_from_i(fixture_v_from_i, method, atol):
12981298
Rsh = fixture_v_from_i['Rsh']
12991299
Rs = fixture_v_from_i['Rs']
13001300
nNsVth = fixture_v_from_i['nNsVth']
1301-
I = fixture_v_from_i['I']
1301+
Iop = fixture_v_from_i['I']
13021302
I0 = fixture_v_from_i['I0']
13031303
IL = fixture_v_from_i['IL']
13041304
V_expected = fixture_v_from_i['V_expected']
13051305

1306-
V = pvsystem.v_from_i(I, IL, I0, Rs, Rsh, nNsVth, method=method)
1306+
Vop = pvsystem.v_from_i(Iop, IL, I0, Rs, Rsh, nNsVth, method=method)
13071307

1308-
assert isinstance(V, type(V_expected))
1309-
if isinstance(V, np.ndarray):
1310-
assert isinstance(V.dtype, type(V_expected.dtype))
1311-
assert V.shape == V_expected.shape
1312-
assert_allclose(V, V_expected, atol=atol)
1308+
assert isinstance(Vop, type(V_expected))
1309+
if isinstance(Vop, np.ndarray):
1310+
assert isinstance(Vop.dtype, type(V_expected.dtype))
1311+
assert Vop.shape == V_expected.shape
1312+
assert_allclose(Vop, V_expected, atol=atol)
13131313

13141314

13151315
def test_i_from_v_from_i(fixture_v_from_i):

0 commit comments

Comments
 (0)