|
30 | 30 | # and meteorological conditions. |
31 | 31 |
|
32 | 32 | # %% |
33 | | -import numpy as np |
34 | 33 | import pandas as pd |
35 | 34 | import matplotlib.pyplot as plt |
36 | 35 | from scipy.integrate import trapezoid |
|
89 | 88 | plt.xlabel(r"Wavelength (nm)") |
90 | 89 | time_labels = times.strftime("%H:%M") |
91 | 90 | labels = [ |
92 | | - "{}, AM {:0.02f}".format(*vals) |
| 91 | + "{}, AM={:0.02f}".format(*vals) |
93 | 92 | for vals in zip(time_labels, relative_airmass) |
94 | 93 | ] |
95 | 94 | plt.legend(labels) |
|
104 | 103 | # total broadband irradiance, which we calculate by integrating the entire |
105 | 104 | # spectral irradiance distribution with respect to wavelength. |
106 | 105 |
|
107 | | -poa_global = spectra_components['poa_global'] |
| 106 | +spectral_poa = spectra_components['poa_global'] |
108 | 107 | wavelength = spectra_components['wavelength'] |
109 | 108 |
|
110 | | -broadband_irradiance = trapezoid(poa_global, wavelength, axis=0) |
| 109 | +broadband_irradiance = trapezoid(spectral_poa, wavelength, axis=0) |
111 | 110 |
|
112 | | -poa_global_normalised = poa_global / broadband_irradiance |
| 111 | +spectral_poa_normalised = spectral_poa / broadband_irradiance |
113 | 112 |
|
114 | 113 | # Plot the normalised spectra |
115 | 114 | plt.figure() |
116 | | -plt.plot(wavelength, poa_global_normalised) |
| 115 | +plt.plot(wavelength, spectral_poa_normalised) |
117 | 116 | plt.xlim(200, 2700) |
118 | 117 | plt.ylim(0, 0.0018) |
119 | 118 | plt.ylabel(r"Normalised Irradiance (nm⁻¹)") |
|
150 | 149 | # comparable if calculated between the same integration limits. In this case, |
151 | 150 | # our APE values are calculated between 300nm and 4000nm. |
152 | 151 |
|
153 | | -spectra = pd.DataFrame(poa_global).T # convert to dataframe and transpose |
| 152 | +spectra = pd.DataFrame(spectral_poa).T # convert to dataframe and transpose |
154 | 153 | spectra.index = time_labels # add time index |
155 | 154 | spectra.columns = wavelength # add wavelength column headers |
156 | 155 |
|
|
162 | 161 | # units of the APE are electronvolts (eV). |
163 | 162 |
|
164 | 163 | plt.figure() |
165 | | -plt.plot(wavelength, poa_global_normalised) |
| 164 | +plt.plot(wavelength, spectral_poa_normalised) |
166 | 165 | plt.xlim(200, 2700) |
167 | 166 | plt.ylim(0, 0.0018) |
168 | 167 | plt.ylabel(r"Normalised Irradiance (nm⁻¹)") |
|
0 commit comments