#NEWLINE# def get_solarposition( time , latitude , longitude , altitude = None , pressure = None , method = 'nrel_numpy' , temperature = 12 , **kwargs ) : #NEWLINE# #INDENT# "\n    A convenience wrapper for the solar position calculators.\n\n    Parameters\n    ----------\n    time : pandas.DatetimeIndex\n    latitude : float\n    longitude : float\n    altitude : None or float\n        If None, computed from pressure. Assumed to be 0 m\n        if pressure is also None.\n    pressure : None or float\n        If None, computed from altitude. Assumed to be 101325 Pa\n        if altitude is also None.\n    method : string\n        'pyephem' uses the PyEphem package: :func:`pyephem`\n\n        'nrel_c' uses the NREL SPA C code [3]: :func:`spa_c`\n\n        'nrel_numpy' uses an implementation of the NREL SPA algorithm\n        described in [1] (default): :func:`spa_python`\n\n        'nrel_numba' uses an implementation of the NREL SPA algorithm\n        described in [1], but also compiles the code first: :func:`spa_python`\n\n        'ephemeris' uses the pvlib ephemeris code: :func:`ephemeris`\n    temperature : float\n        Degrees C.\n\n    Other keywords are passed to the underlying solar position function.\n\n    References\n    ----------\n    [1] I. Reda and A. Andreas, Solar position algorithm for solar radiation\n    applications. Solar Energy, vol. 76, no. 5, pp. 577-589, 2004.\n\n    [2] I. Reda and A. Andreas, Corrigendum to Solar position algorithm for\n    solar radiation applications. Solar Energy, vol. 81, no. 6, p. 838, 2007.\n\n    [3] NREL SPA code: http://rredc.nrel.gov/solar/codesandalgorithms/spa/\n    " #NEWLINE# if ( ( altitude is None ) and ( pressure is None ) ) : #NEWLINE# #INDENT# altitude = 0.0 #NEWLINE# pressure = 101325.0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( altitude is None ) : #NEWLINE# #INDENT# altitude = atmosphere . pres2alt ( pressure ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( pressure is None ) : #NEWLINE# #INDENT# pressure = atmosphere . alt2pres ( altitude ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# method = method . lower ( ) #NEWLINE# if isinstance ( time , dt . datetime ) : #NEWLINE# #INDENT# time = pd . DatetimeIndex ( [ time ] ) #NEWLINE# #UNINDENT# if ( method == 'nrel_c' ) : #NEWLINE# #INDENT# ephem_df = spa_c ( time , latitude , longitude , pressure , temperature , ** kwargs ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( method == 'nrel_numba' ) : #NEWLINE# #INDENT# ephem_df = spa_python ( time , latitude , longitude , altitude , pressure , temperature , how = 'numba' , ** kwargs ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( method == 'nrel_numpy' ) : #NEWLINE# #INDENT# ephem_df = spa_python ( time , latitude , longitude , altitude , pressure , temperature , how = 'numpy' , ** kwargs ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( method == 'pyephem' ) : #NEWLINE# #INDENT# ephem_df = pyephem ( time , latitude , longitude , pressure , temperature , ** kwargs ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( method == 'ephemeris' ) : #NEWLINE# #INDENT# ephem_df = ephemeris ( time , latitude , longitude , pressure , temperature , ** kwargs ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( 'Invalid solar position method' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return ephem_df