Skip to content

Commit e1ccae7

Browse files
committed
Remove ifinstance check/Use np.interp
1 parent 486cf38 commit e1ccae7

2 files changed

Lines changed: 3 additions & 10 deletions

File tree

docs/examples/shading/plot_partial_module_shading_simple.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,8 @@ def plot_curves(dfs, labels, title):
178178

179179

180180
def interpolate(df, i):
181-
"""convenience wrapper around scipy.interpolate"""
182-
f_interp = make_interp_spline(np.flipud(df['i']), np.flipud(df['v']), k=1)
183-
184-
return f_interp(i)
185-
181+
"""convenience wrapper around numpy.interp"""
182+
return np.interp(i,np.flipud(df['i']), np.flipud(df['v']))
186183

187184
def combine_series(dfs):
188185
"""

pvlib/iam.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,6 @@ def interp(aoi, theta_ref, iam_ref, method='linear', normalize=True):
470470
pvlib.iam.sapm
471471
'''
472472
# Contributed by Anton Driesse (@adriesse), PV Performance Labs. July, 2019
473-
if isinstance(theta_ref, list):
474-
raise TypeError("theta_ref cannot be a list")
475-
if isinstance(iam_ref, list):
476-
raise TypeError("iam_ref cannot be a list")
477473
# Scipy doesn't give the clearest feedback, so check number of points here.
478474
MIN_REF_VALS = {'linear': 2, 'quadratic': 3, 'cubic': 4, 1: 2, 2: 3, 3: 4}
479475

@@ -495,7 +491,7 @@ def interp(aoi, theta_ref, iam_ref, method='linear', normalize=True):
495491
interpolator = make_interp_spline(theta_ref, iam_ref, k=3)
496492

497493
else:
498-
raise ValueError(f"Invalid interpolation method '{method}'.")
494+
raise ValueError(f"Interpolation method '{method}' is not supported in pvlib-python.")
499495

500496
aoi_input = aoi
501497
aoi = np.asanyarray(aoi)

0 commit comments

Comments
 (0)