`spa.solar_position` documentation bug
Describe the bug
I think the returns statement in spa.solar_position() lists the elevation outputs in the wrong order.
solar_position_numpy() returns the following (and the numba path solar_position_loop() fills its output array in the same order):
return theta, theta0, e, e0, phi, eot
From the calculation it looks like the 0 means no atmospheric refraction correction, so e is apparent elevation and e0 is real elevation, but the solar_position() docstring reads:
Numpy Array with elements:
apparent zenith,
zenith,
elevation,
apparent_elevation,
azimuth,
equation_of_time
so elevation and apparent_elevation are swapped.
Expected behavior
solar_position() docstring should read:
Numpy Array with elements:
apparent zenith,
zenith,
apparent_elevation,
elevation,
azimuth,
equation_of_time
This is my understanding anyway... if someone can double check this and confirm it's a bug, I'll fix it in a PR.
Note: docstring-only fix. spa_python() in solarposition.py, which uses spa.solar_position(), unpacks the elements in the correct order:
I can confirm this is a docstring bug. In pvlib/spa.py, solar_position_numpy returns theta, theta0, e, e0, phi, eot (line ~1027), where e is the elevation with atmospheric refraction applied — e = topocentric_elevation_angle(e0, delta_e), and e0 comes from topocentric_elevation_angle_without_atmosphere. The numba path fills the same order in solar_position_loop (out[2] = e, out[3] = e0). But the solar_position() docstring lists element 3 as elevation and element 4 as apparent_elevation — swapped. spa_python() in solarposition.py unpacks them in the correct order (app_zenith, zenith, app_elevation, elevation), so this is docstring-only.