Skip to content

Commit c89ac2f

Browse files
committed
Update sedes2.py
1 parent f053716 commit c89ac2f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pvlib/spectrum/sedes2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44

55
import numpy as np
6-
from scipy.interpolate import make_interp_spline
76
from pvlib.tools import cosd
87

98
SEDES2_COEFFS = np.array([
@@ -161,9 +160,10 @@ def sedes2(spectra_direct_clear, spectra_diffuse_clear, wavelengths,
161160
cos_aoi = np.clip(cosd(aoi), a_min=0, a_max=None)
162161
cos_aoi = np.atleast_1d(cos_aoi)[np.newaxis, :]
163162

164-
# interpolate coefficients to match input wavelengths
165-
interp = make_interp_spline(SEDES2_COEFFS[:, 0], SEDES2_COEFFS[:, 1:], k=1)
166-
coef = interp(wavelengths).T
163+
# interpolate coefficients to match input wavelengths.
164+
# note that np.interp does nearest-neighbor extrapolation, as desired.
165+
coef = [np.interp(wavelengths, SEDES2_COEFFS[:, 0], SEDES2_COEFFS[:, i])
166+
for i in range(1, 7)]
167167
coef = [x[:, np.newaxis] for x in coef] # add dimension for time
168168
A1, A2, B1, B2, C1, C2 = coef
169169

0 commit comments

Comments
 (0)