E5DE [WIP] implement SEDES2 all-sky spectral irradiance model by kandersolar · Pull Request #2616 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update sedes2.py
  • Loading branch information
kandersolar committed Dec 8, 2025
commit c89ac2f54076a18e412dcba63b13ba9c6d22bbec
8 changes: 4 additions & 4 deletions pvlib/spectrum/sedes2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

import numpy as np
from scipy.interpolate import make_interp_spline
from pvlib.tools import cosd

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

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

Expand Down
0