3 - Spectral Degradation#

Requirements:

  • spectral irradiance (measured or simulated)

  • wavelengths of spectral irradiance data

  • module RH

  • module temperature

Objectives:

  1. Read in spectral irradiance

  2. Calculate spectral degradation

# if running on google colab, uncomment the next line and execute this cell to install the dependencies and prevent "ModuleNotFoundError" in later cells:
# !pip install pvdeg==0.3.3
import os
import warnings
import pandas as pd
import numpy as np
import pvdeg
from pvdeg import DATA_DIR

warnings.filterwarnings('ignore', message='.*Pyarrow will become a required dependency.*')
# This information helps with debugging and getting support :)
import sys
import platform

print("Working on a ", platform.system(), platform.release())
print("Python version ", sys.version)
print("Pandas version ", pd.__version__)
print("pvdeg version ", pvdeg.__version__)
Working on a  Linux 6.11.0-1018-azure
Python version  3.11.13 (main, Jun  4 2025, 04:12:12) [GCC 13.3.0]
Pandas version  2.3.3
pvdeg version  0.1.dev1+g51172fdc5

1. Read in spectral irradiance data#

Spectral degradation has 4 main requirements:

  • Spectral Irradiance [W/m^2 nm]

  • Wavelength [nm]

  • Module Relative Humidity [%]

  • Module Temperature [C]

For more advanced scenarios, you may want to calculate the degradation of a particular layer within the module. Below, we are using backside irradiance and therefore a slightly different temperature and humidity have been calculated. To calculate degradation on the backside, we used pvdeg.humidity.rh_backsheet. For the the front side, you should use pvdeg.humidity.rh_surface_outside or rh_front_encap

For this tutorial we are using pre-generated data from a ray-tracing simulation. To calculate the degradation rate, we will need the wavelengths used in the simulation.

wavelengths = np.array(range(280, 420, 20))

SPECTRA = pd.read_csv(os.path.join(DATA_DIR, "spectra.csv"), header=0, index_col=0)
SPECTRA.head()
Spectra Temperature RH
timestamp
2021-03-09 10:00:00 [0.6892146677599185, 0.40215646494410884, 0.67... 45 59
2021-03-09 11:00:00 [0.15575709102178648, 0.5464374649246564, 0.68... 44 56
2021-03-09 12:00:00 [0.22782105874481207, 0.9056495270031296, 0.26... 59 39
2021-03-09 13:00:00 [0.3741943134512433, 0.035830980984344674, 0.4... 44 13
2021-03-09 14:00:00 [0.40321187996337626, 0.6473167864022122, 0.69... 25 39

2. Calculate Degradation#

The spectral degradation function has several optional paramters. For more information, refer to the documentation. Below is a function call with the minimum required information.

degradation = pvdeg.degradation.degradation_spectral(
    spectra=SPECTRA["Spectra"],
    rh=SPECTRA["RH"],
    temp=SPECTRA["Temperature"],
    wavelengths=wavelengths,
    time=SPECTRA.index
)
Removing brackets from spectral irradiance data