def ephemeris(time, latitude, longitude, pressure=<NUM_LIT>, temperature=<NUM_LIT:12>):
<EOL>Latitude = latitude<EOL>Longitude = -<NUM_LIT:1> * longitude<EOL>Abber = <NUM_LIT:20> / <NUM_LIT><EOL>LatR = np.radians(Latitude)<EOL>try:<EOL><INDENT>time_utc = time.tz_convert('<STR_LIT>')<EOL><DEDENT>except TypeError:<EOL><INDENT>time_utc = time<EOL><DEDENT>DayOfYear = time_utc.dayofyear<EOL>DecHours = (time_utc.hour + time_utc.minute/<NUM_LIT> + time_utc.second/<NUM_LIT> +<EOL>time_utc.microsecond/<NUM_LIT>)<EOL>UnivDate = np.array(DayOfYear)<EOL>UnivHr = np.array(DecHours)<EOL>Yr = np.array(time_utc.year) - <NUM_LIT><EOL>YrBegin = <NUM_LIT> * Yr + np.floor((Yr - <NUM_LIT:1>) / <NUM_LIT>) - <NUM_LIT:0.5><EOL>Ezero = YrBegin + UnivDate<EOL>T = Ezero / <NUM_LIT><EOL>GMST0 = <NUM_LIT:6> / <NUM_LIT> + <NUM_LIT> / <NUM_LIT> + (<EOL><NUM_LIT> + <NUM_LIT> * T + <NUM_LIT> * T ** <NUM_LIT:2>) / <NUM_LIT><EOL>GMST0 = <NUM_LIT> * (GMST0 - np.floor(GMST0))<EOL>GMSTi = np.mod(GMST0 + <NUM_LIT> * (<NUM_LIT> * UnivHr / <NUM_LIT>), <NUM_LIT>)<EOL>LocAST = np.mod((<NUM_LIT> + GMSTi - Longitude), <NUM_LIT>)<EOL>EpochDate = Ezero + UnivHr / <NUM_LIT><EOL>T1 = EpochDate / <NUM_LIT><EOL>ObliquityR = np.radians(<EOL><NUM_LIT> - <NUM_LIT> * T1 - <NUM_LIT> * T1 ** <NUM_LIT:2> + <NUM_LIT> * T1 ** <NUM_LIT:3>)<EOL>MlPerigee = <NUM_LIT> + <NUM_LIT> * EpochDate + <NUM_LIT> * T1 ** <NUM_LIT:2> + (<EOL><NUM_LIT> * T1 ** <NUM_LIT:3>)<EOL>MeanAnom = np.mod((<NUM_LIT> + <NUM_LIT> * EpochDate - <NUM_LIT> *<EOL>T1 ** <NUM_LIT:2> - <NUM_LIT> * T1 ** <NUM_LIT:3>), <NUM_LIT>)<EOL>Eccen = <NUM_LIT> - <NUM_LIT> * T1 - <NUM_LIT> * T1 ** <NUM_LIT:2><EOL>EccenAnom = MeanAnom<EOL>E = <NUM_LIT:0><EOL>while np.max(abs(EccenAnom - E)) > <NUM_LIT>:<EOL><INDENT>E = EccenAnom<EOL>EccenAnom = MeanAnom + np.degrees(Eccen)*np.sin(np.radians(E))<EOL><DEDENT>TrueAnom = (<EOL><NUM_LIT:2> * np.mod(np.degrees(np.arctan2(((<NUM_LIT:1> + Eccen) / (<NUM_LIT:1> - Eccen)) ** <NUM_LIT:0.5> *<EOL>np.tan(np.radians(EccenAnom) / <NUM_LIT>), <NUM_LIT:1>)), <NUM_LIT>))<EOL>EcLon = np.mod(MlPerigee + TrueAnom, <NUM_LIT>) - Abber<EOL>EcLonR = np.radians(EcLon)<EOL>DecR = np.arcsin(np.sin(ObliquityR)*np.sin(EcLonR))<EOL>RtAscen = np.degrees(np.arctan2(np.cos(ObliquityR)*np.sin(EcLonR),<EOL>np.cos(EcLonR)))<EOL>HrAngle = LocAST - RtAscen<EOL>HrAngleR = np.radians(HrAngle)<EOL>HrAngle = HrAngle - (<NUM_LIT> * ((abs(HrAngle) > <NUM_LIT>)))<EOL>SunAz = np.degrees(np.arctan2(-np.sin(HrAngleR),<EOL>np.cos(LatR)*np.tan(DecR) -<EOL>np.sin(LatR)*np.cos(HrAngleR)))<EOL>SunAz[SunAz < <NUM_LIT:0>] += <NUM_LIT><EOL>SunEl = np.degrees(np.arcsin(<EOL>np.cos(LatR) * np.cos(DecR) * np.cos(HrAngleR) +<EOL>np.sin(LatR) * np.sin(DecR)))<EOL>SolarTime = (<NUM_LIT> + HrAngle) / <NUM_LIT><EOL>Elevation = SunEl<EOL>TanEl = pd.Series(np.tan(np.radians(Elevation)), index=time_utc)<EOL>Refract = pd.Series(<NUM_LIT:0>, index=time_utc)<EOL>Refract[(Elevation > <NUM_LIT:5>) & (Elevation <= <NUM_LIT>)] = (<EOL><NUM_LIT>/TanEl - <NUM_LIT>/(TanEl**<NUM_LIT:3>) + <NUM_LIT>/(TanEl**<NUM_LIT:5>))<EOL>Refract[(Elevation > -<NUM_LIT>) & (Elevation <= <NUM_LIT:5>)] = (<EOL>Elevation *<EOL>(-<NUM_LIT> + Elevation*(<NUM_LIT> + Elevation*(-<NUM_LIT> + Elevation*<NUM_LIT>))) +<EOL><NUM_LIT>)<EOL>Refract[(Elevation > -<NUM_LIT:1>) & (Elevation <= -<NUM_LIT>)] = -<NUM_LIT> / TanEl<EOL>Refract *= (<NUM_LIT>/(<NUM_LIT> + temperature)) * (pressure/<NUM_LIT>) / <NUM_LIT><EOL>ApparentSunEl = SunEl + Refract<EOL>DFOut = pd.DataFrame(index=time_utc)<EOL>DFOut['<STR_LIT>'] = ApparentSunEl<EOL>DFOut['<STR_LIT>'] = SunEl<EOL>DFOut['<STR_LIT>'] = SunAz<EOL>DFOut['<STR_LIT>'] = <NUM_LIT> - ApparentSunEl<EOL>DFOut['<STR_LIT>'] = <NUM_LIT> - SunEl<EOL>DFOut['<STR_LIT>'] = SolarTime<EOL>DFOut.index = time<EOL>return DFOut<EOL>
Python-native solar position calculator.
The accuracy of this code is not guaranteed.
Consider using the built-in spa_c code or the PyEphem library.

Parameters
----------
time : pandas.DatetimeIndex
latitude : float
longitude : float
pressure : float or Series, default 101325
    Ambient pressure (Pascals)
temperature : float or Series, default 12
    Ambient temperature (C)

Returns
-------

DataFrame with the following columns:

    * apparent_elevation : apparent sun elevation accounting for
      atmospheric refraction.
    * elevation : actual elevation (not accounting for refraction)
      of the sun in decimal degrees, 0 = on horizon.
      The complement of the zenith angle.
    * azimuth : Azimuth of the sun in decimal degrees East of North.
      This is the complement of the apparent zenith angle.
    * apparent_zenith : apparent sun zenith accounting for atmospheric
      refraction.
    * zenith : Solar zenith angle
    * solar_time : Solar time in decimal hours (solar noon is 12.00).

References
-----------

Grover Hughes' class and related class materials on Engineering
Astronomy at Sandia National Laboratories, 1985.

See also
--------
pyephem, spa_c, spa_python