Skip to content

Commit bc67019

Browse files
authored
Refactor variable names for clarity in APE example (#2578)
1 parent c530195 commit bc67019

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

docs/examples/spectrum/average_photon_energy.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
# This example demonstrates how to use the
1212
# :py:func:`~pvlib.spectrum.average_photon_energy` function to calculate the
1313
# 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
1616
# applicable to spectral irradiance from any source.
1717
# More information on the SPECTRL2 model can be found in [1]_.
1818
# The APE parameter is a useful indicator of the overall shape of the solar
@@ -35,18 +35,19 @@
3535
from pvlib import spectrum, solarposition, irradiance, atmosphere
3636

3737
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
4040
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
4343
ozone = 0.31 # atm-cm
4444
albedo = 0.2
4545

4646
times = pd.date_range('2023-01-01 08:00', freq='h', periods=9,
4747
tz='America/Denver')
4848
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)
5051

5152
relative_airmass = atmosphere.get_relative_airmass(solpos.apparent_zenith,
5253
model='kastenyoung1989')
@@ -64,13 +65,13 @@
6465
spectra_components = spectrum.spectrl2(
6566
apparent_zenith=solpos.apparent_zenith,
6667
aoi=aoi,
67-
surface_tilt=tilt,
68+
surface_tilt=surface_tilt,
6869
ground_albedo=albedo,
6970
surface_pressure=pressure,
7071
relative_airmass=relative_airmass,
71-
precipitable_water=water_vapor_content,
72+
precipitable_water=precipitable_water,
7273
ozone=ozone,
73-
aerosol_turbidity_500nm=tau500,
74+
aerosol_turbidity_500nm=aerosol_turbidity_500nm,
7475
)
7576

7677
# %%

0 commit comments

Comments
 (0)