pvlib.solarposition.sun_rise_set_transit_spa#

pvlib.solarposition.sun_rise_set_transit_spa(times, latitude, longitude, how='numpy', delta_t=67.0, numthreads=4)[source]#

Calculate the sunrise, sunset, and sun transit times using the NREL SPA algorithm.

The details of the NREL SPA algorithm are described in 1.

If numba is installed, the functions can be compiled to machine code and the function can be multithreaded. Without numba, the function evaluates via numpy with a slight performance hit.

Parameters
  • times (pandas.DatetimeIndex) – Must be localized to the timezone for latitude and longitude.

  • latitude (float) – Latitude in degrees, positive north of equator, negative to south

  • longitude (float) – Longitude in degrees, positive east of prime meridian, negative to west

  • how (str, optional, default 'numpy') – Options are ‘numpy’ or ‘numba’. If numba >= 0.17.0 is installed, how=’numba’ will compile the spa functions to machine code and run them multithreaded.

  • delta_t (float, optional, default 67.0) – Difference between terrestrial time and UT1. If delta_t is None, uses spa.calculate_deltat using times.year and times.month from pandas.DatetimeIndex. For most simulations the default delta_t is sufficient. Note: delta_t = None will break code using nrel_numba, this will be fixed in a future version.

  • numthreads (int, optional, default 4) – Number of threads to use if how == ‘numba’.

Returns

pandas.DataFrame – index is the same as input times argument columns are ‘sunrise’, ‘sunset’, and ‘transit’

References

1

Reda, I., Andreas, A., 2003. Solar position algorithm for solar radiation applications. Technical report: NREL/TP-560- 34302. Golden, USA, http://www.nrel.gov.