@@ -101,7 +101,8 @@ def get_solarposition(time, location=None, latitude=None, longitude=None,
101
101
return ephem_df
102
102
103
103
104
- def spa_c (time , latitude , longitude , pressure = 101325 , temperature = 12 , delta_t = 67.0 ,
104
+ def spa_c (time , latitude , longitude , pressure = 101325 ,
105
+ temperature = 12 , delta_t = 67.0 ,
105
106
raw_spa_output = False ):
106
107
"""
107
108
Calculate the solar position using the C implementation of the NREL
@@ -223,7 +224,8 @@ def _spa_python_import(how):
223
224
return spa
224
225
225
226
226
- def spa_python (time , location , pressure = 101325 , temperature = 12 , delta_t = None ,
227
+ def spa_python (time , latitude , longitude ,
228
+ altitude = 0 , pressure = 101325 , temperature = 12 , delta_t = None ,
227
229
atmos_refract = None , how = 'numpy' , numthreads = 4 ):
228
230
"""
229
231
Calculate the solar position using a python implementation of the
@@ -237,7 +239,9 @@ def spa_python(time, location, pressure=101325, temperature=12, delta_t=None,
237
239
Parameters
238
240
----------
239
241
time : pandas.DatetimeIndex
240
- location : pvlib.Location object
242
+ latitude : float
243
+ longitude : float
244
+ altitude : float
241
245
pressure : int or float, optional
242
246
avg. yearly air pressure in Pascals.
243
247
temperature : int or float, optional
@@ -286,9 +290,9 @@ def spa_python(time, location, pressure=101325, temperature=12, delta_t=None,
286
290
287
291
pvl_logger .debug ('Calculating solar position with spa_python code' )
288
292
289
- lat = location . latitude
290
- lon = location . longitude
291
- elev = location . altitude
293
+ lat = latitude
294
+ lon = longitude
295
+ elev = altitude
292
296
pressure = pressure / 100 # pressure must be in millibars for calculation
293
297
delta_t = delta_t or 67.0
294
298
atmos_refract = atmos_refract or 0.5667
@@ -299,7 +303,7 @@ def spa_python(time, location, pressure=101325, temperature=12, delta_t=None,
299
303
except (TypeError , ValueError ):
300
304
time = pd .DatetimeIndex ([time , ])
301
305
302
- unixtime = localize_to_utc ( time , location ) .astype (np .int64 )/ 10 ** 9
306
+ unixtime = time .astype (np .int64 )/ 10 ** 9
303
307
304
308
spa = _spa_python_import (how )
305
309
@@ -314,9 +318,9 @@ def spa_python(time, location, pressure=101325, temperature=12, delta_t=None,
314
318
index = time )
315
319
316
320
try :
317
- result = result .tz_convert (location .tz )
321
+ result = result .tz_convert (time .tz )
318
322
except TypeError :
319
- result = result .tz_localize (location .tz )
323
+ result = result .tz_localize (time .tz )
320
324
321
325
return result
322
326
0 commit comments