def get_solarposition(time, latitude, longitude,<EOL>altitude=None, pressure=None,<EOL>method='<STR_LIT>',<EOL>temperature=<NUM_LIT:12>, **kwargs):
if altitude is None and pressure is None:<EOL><INDENT>altitude = <NUM_LIT:0.><EOL>pressure = <NUM_LIT><EOL><DEDENT>elif altitude is None:<EOL><INDENT>altitude = atmosphere.pres2alt(pressure)<EOL><DEDENT>elif pressure is None:<EOL><INDENT>pressure = atmosphere.alt2pres(altitude)<EOL><DEDENT>method = method.lower()<EOL>if isinstance(time, dt.datetime):<EOL><INDENT>time = pd.DatetimeIndex([time, ])<EOL><DEDENT>if method == '<STR_LIT>':<EOL><INDENT>ephem_df = spa_c(time, latitude, longitude, pressure, temperature,<EOL>**kwargs)<EOL><DEDENT>elif method == '<STR_LIT>':<EOL><INDENT>ephem_df = spa_python(time, latitude, longitude, altitude,<EOL>pressure, temperature,<EOL>how='<STR_LIT>', **kwargs)<EOL><DEDENT>elif method == '<STR_LIT>':<EOL><INDENT>ephem_df = spa_python(time, latitude, longitude, altitude,<EOL>pressure, temperature,<EOL>how='<STR_LIT>', **kwargs)<EOL><DEDENT>elif method == '<STR_LIT>':<EOL><INDENT>ephem_df = pyephem(time, latitude, longitude,<EOL>altitude=altitude,<EOL>pressure=pressure,<EOL>temperature=temperature, **kwargs)<EOL><DEDENT>elif method == '<STR_LIT>':<EOL><INDENT>ephem_df = ephemeris(time, latitude, longitude, pressure, temperature,<EOL>**kwargs)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>return ephem_df<EOL>
A convenience wrapper for the solar position calculators.

Parameters
----------
time : pandas.DatetimeIndex

latitude : float
longitude : float

altitude : None or float, default None
    If None, computed from pressure. Assumed to be 0 m
    if pressure is also None.

pressure : None or float, default None
    If None, computed from altitude. Assumed to be 101325 Pa
    if altitude is also None.

method : string, default 'nrel_numpy'
    'nrel_numpy' uses an implementation of the NREL SPA algorithm
    described in [1] (default, recommended): :py:func:`spa_python`

    'nrel_numba' uses an implementation of the NREL SPA algorithm
    described in [1], but also compiles the code first:
    :py:func:`spa_python`

    'pyephem' uses the PyEphem package: :py:func:`pyephem`

    'ephemeris' uses the pvlib ephemeris code: :py:func:`ephemeris`

    'nrel_c' uses the NREL SPA C code [3]: :py:func:`spa_c`

temperature : float, default 12
    Degrees C.

Other keywords are passed to the underlying solar position function.

References
----------
[1] I. Reda and A. Andreas, Solar position algorithm for solar radiation
applications. Solar Energy, vol. 76, no. 5, pp. 577-589, 2004.

[2] I. Reda and A. Andreas, Corrigendum to Solar position algorithm for
solar radiation applications. Solar Energy, vol. 81, no. 6, p. 838, 2007.

[3] NREL SPA code: http://rredc.nrel.gov/solar/codesandalgorithms/spa/