# Solar Position¶

Functions and methods for calculating solar position.

The location.Location.get_solarposition() method and the solarposition.get_solarposition() function with default parameters are fast and accurate. We recommend using these functions unless you know that you need a different function.

 location.Location.get_solarposition(times[, …]) Uses the pvlib.solarposition.get_solarposition() function to calculate the solar zenith, azimuth, etc. solarposition.get_solarposition(time, …[, …]) A convenience wrapper for the solar position calculators. solarposition.spa_python(time, latitude, …) Calculate the solar position using a python implementation of the NREL SPA algorithm. solarposition.ephemeris(time, latitude, …) Python-native solar position calculator. solarposition.pyephem(time, latitude, longitude) Calculate the solar position using the PyEphem package. solarposition.spa_c(time, latitude, longitude) Calculate the solar position using the C implementation of the NREL SPA code.

Additional functions for quantities closely related to solar position.

 solarposition.calc_time(lower_bound, …[, …]) Calculate the time between lower_bound and upper_bound where the attribute is equal to value. Calculates the distance from the earth to the sun using pyephem. Calculates the distance from the earth to the sun using the NREL SPA algorithm. spa.calculate_deltat(year, month) Calculate the difference between Terrestrial Dynamical Time (TD) and Universal Time (UT).

Functions for calculating sunrise, sunset and transit times.

 Calculate sunrise, sunset and transit times. Calculate the next sunrise and sunset times using the PyEphem package. Calculate the sunrise, sunset, and sun transit times using the NREL SPA algorithm. Geometric calculation of solar sunrise, sunset, and transit.

The spa module contains the implementation of the built-in NREL SPA algorithm.

 spa Calculate the solar position using the NREL SPA algorithm either using numpy arrays or compiling the code to machine language with numba.

Correlations and analytical expressions for low precision solar position calculations.

 Analytical expression of solar zenith angle based on spherical trigonometry. Analytical expression of solar azimuth angle based on spherical trigonometry. Solar declination from Duffie & Beckman and attributed to Spencer (1971) and Iqbal (1983). solarposition.declination_cooper69(dayofyear) Solar declination from Duffie & Beckman and attributed to Cooper (1969). Equation of time from Duffie & Beckman and attributed to Spencer (1971) and Iqbal (1983). Equation of time from PVCDROM. solarposition.hour_angle(times, longitude, …) Hour angle in local solar time.