solposx.solarposition.spa

Contents

solposx.solarposition.spa#

solposx.solarposition.spa(time, latitude, longitude, elevation=0.0, *, air_pressure=101325.0, temperature=12.0, delta_t=67.0, atmos_refract=None, **kwargs)#

Calculate the solar position using a python implementation of the NREL SPA algorithm.

The details of the NREL SPA algorithm are described in [1], [2].

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) – Timestamps - must be localized. Prior to 1970 and far in the future UTC and UT1 may deviate significantly. For such use cases, UT1 times should be provided.

  • latitude (float) – Latitude in decimal degrees. Positive north of equator, negative to south. [degrees]

  • longitude (float) – Longitude in decimal degrees. Positive east of prime meridian, negative to west. [degrees]

  • elevation (float, default : 0) – Altitude of the location of interest. [m]

  • air_pressure (float, default : 101325) – Annual average air pressure. [Pa]

  • temperature (float, default : 12) – Annual average air temperature. [°C] negative to west. [degrees]

  • delta_t (numeric, default : 67.0) – Difference between terrestrial time and UT1. If delta_t is None, uses pvlib.spa.calculate_deltat() using times.year and times.month from pandas.DatetimeIndex. For most simulations the default delta_t is sufficient. The USNO has historical and forecasted delta_t [3]. [seconds]

  • atmos_refract (float, optional) – The approximate atmospheric refraction (in degrees) at sunrise and sunset.

  • Parameters (Extra)

  • ----------------

  • 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.

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

Returns:

DataFrame with the following columns (all values in degrees):

  • elevation : actual sun elevation (not accounting for refraction). [°]

  • apparent_elevation : sun elevation, accounting for atmospheric refraction. [°]

  • zenith : actual sun zenith (not accounting for refraction). [°]

  • apparent_zenith : sun zenith, accounting for atmospheric refraction. [°]

  • azimuth : sun azimuth, east of north. [°]

  • equation_of_time. [minutes]

Return type:

pandas.DataFrame

References