| 
11 | 11 | # This example demonstrates how to use the  | 
12 | 12 | # :py:func:`~pvlib.spectrum.average_photon_energy` function to calculate the  | 
13 | 13 | # Average Photon Energy (APE, :math:`\overline{E_\gamma}`) of spectral  | 
14 |  | -# irradiance distributions. This example uses spectral irradiance simulated  | 
15 |  | -# using :py:func:`~pvlib.spectrum.spectrl2`, but the same method is  | 
 | 14 | +# irradiance distributions. This example uses clearsky spectral irradiance  | 
 | 15 | +# simulated using :py:func:`~pvlib.spectrum.spectrl2`, but the same method is  | 
16 | 16 | # applicable to spectral irradiance from any source.  | 
17 | 17 | # More information on the SPECTRL2 model can be found in [1]_.  | 
18 | 18 | # The APE parameter is a useful indicator of the overall shape of the solar  | 
 | 
35 | 35 | from pvlib import spectrum, solarposition, irradiance, atmosphere  | 
36 | 36 | 
 
  | 
37 | 37 | lat, lon = 39.742, -105.18  # NREL SRRL location  | 
38 |  | -tilt = 25  | 
39 |  | -azimuth = 180  # south-facing system  | 
 | 38 | +surface_tilt = 25  | 
 | 39 | +surface_azimuth = 180  # south-facing system  | 
40 | 40 | pressure = 81190  # at 1828 metres AMSL, roughly  | 
41 |  | -water_vapor_content = 0.5  # cm  | 
42 |  | -tau500 = 0.1  | 
 | 41 | +precipitable_water = 0.5  # cm  | 
 | 42 | +aerosol_turbidity_500nm = 0.1  | 
43 | 43 | ozone = 0.31  # atm-cm  | 
44 | 44 | albedo = 0.2  | 
45 | 45 | 
 
  | 
46 | 46 | times = pd.date_range('2023-01-01 08:00', freq='h', periods=9,  | 
47 | 47 |                       tz='America/Denver')  | 
48 | 48 | solpos = solarposition.get_solarposition(times, lat, lon)  | 
49 |  | -aoi = irradiance.aoi(tilt, azimuth, solpos.apparent_zenith, solpos.azimuth)  | 
 | 49 | +aoi = irradiance.aoi(surface_tilt, surface_azimuth,  | 
 | 50 | +                     solpos.apparent_zenith, solpos.azimuth)  | 
50 | 51 | 
 
  | 
51 | 52 | relative_airmass = atmosphere.get_relative_airmass(solpos.apparent_zenith,  | 
52 | 53 |                                                    model='kastenyoung1989')  | 
 | 
64 | 65 | spectra_components = spectrum.spectrl2(  | 
65 | 66 |     apparent_zenith=solpos.apparent_zenith,  | 
66 | 67 |     aoi=aoi,  | 
67 |  | -    surface_tilt=tilt,  | 
 | 68 | +    surface_tilt=surface_tilt,  | 
68 | 69 |     ground_albedo=albedo,  | 
69 | 70 |     surface_pressure=pressure,  | 
70 | 71 |     relative_airmass=relative_airmass,  | 
71 |  | -    precipitable_water=water_vapor_content,  | 
 | 72 | +    precipitable_water=precipitable_water,  | 
72 | 73 |     ozone=ozone,  | 
73 |  | -    aerosol_turbidity_500nm=tau500,  | 
 | 74 | +    aerosol_turbidity_500nm=aerosol_turbidity_500nm,  | 
74 | 75 | )  | 
75 | 76 | 
 
  | 
76 | 77 | # %%  | 
 | 
0 commit comments