pvlib.solarposition.spa_c#

pvlib.solarposition.spa_c(time, latitude, longitude, pressure=101325, altitude=0, temperature=12, delta_t=67.0, raw_spa_output=False)[source]#

Calculate the solar position using the C implementation of the NREL SPA code.

The source files for this code are located in ‘./spa_c_files/’, along with a README file which describes how the C code is wrapped in Python. Due to license restrictions, the C code must be downloaded seperately and used in accordance with it’s license.

This function is slower and no more accurate than spa_python().

Parameters
  • time (pandas.DatetimeIndex) – Must be localized or UTC will be assumed.

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

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

  • pressure (float, default 101325) – Pressure in Pascals

  • altitude (float, default 0) – Height above sea level. [m]

  • temperature (float, default 12) – Temperature in C

  • delta_t (float, default 67.0) – Difference between terrestrial time and UT1. USNO has previous values and predictions.

  • raw_spa_output (bool, default False) – If true, returns the raw SPA output.

Returns

DataFrame – The DataFrame will have the following columns: elevation, azimuth, zenith, apparent_elevation, apparent_zenith.

References

1

NREL SPA reference: http://rredc.nrel.gov/solar/codesandalgorithms/spa/ NREL SPA C files: https://midcdmz.nrel.gov/spa/

Note: The timezone field in the SPA C files is replaced with time_zone to avoid a nameclash with the function __timezone that is redefined by Python>=3.5. This issue is Python bug 24643.

2

USNO delta T: http://www.usno.navy.mil/USNO/earth-orientation/eo-products/long-term