@@ -390,6 +390,7 @@ def spa_python(time, latitude, longitude,
390390 return result
391391
392392
393+ @renamed_kwarg_warning ("0.11.2" , "times" , "date" , "0.12.0" )
393394def sun_rise_set_transit_spa (times , latitude , longitude , how = 'numpy' ,
394395 delta_t = 67.0 , numthreads = 4 ):
395396 """
@@ -405,8 +406,12 @@ def sun_rise_set_transit_spa(times, latitude, longitude, how='numpy',
405406
406407 Parameters
407408 ----------
408- times : pandas.DatetimeIndex
409+ date : pandas.DatetimeIndex
409410 Must be localized to the timezone for ``latitude`` and ``longitude``.
411+
412+ .. deprecated:: 0.11.2 until 0.12.0
413+ Renamed from ``times`` to ``date``.
414+
410415 latitude : float
411416 Latitude in degrees, positive north of equator, negative to south
412417 longitude : float
@@ -418,15 +423,15 @@ def sun_rise_set_transit_spa(times, latitude, longitude, how='numpy',
418423 delta_t : float or array, optional, default 67.0
419424 Difference between terrestrial time and UT1.
420425 If delta_t is None, uses spa.calculate_deltat
421- using times .year and times .month from pandas.DatetimeIndex.
426+ using date .year and date .month from pandas.DatetimeIndex.
422427 For most simulations the default delta_t is sufficient.
423428 numthreads : int, optional, default 4
424429 Number of threads to use if how == 'numba'.
425430
426431 Returns
427432 -------
428433 pandas.DataFrame
429- index is the same as input `times ` argument
434+ index is the same as input ``date` ` argument
430435 columns are 'sunrise', 'sunset', and 'transit'
431436
432437 References
@@ -440,33 +445,33 @@ def sun_rise_set_transit_spa(times, latitude, longitude, how='numpy',
440445 lat = latitude
441446 lon = longitude
442447
443- # times must be localized
444- if times .tz :
445- tzinfo = times .tz
448+ # date must be localized
449+ if date .tz :
450+ tzinfo = date .tz
446451 else :
447- raise ValueError ('times must be localized' )
452+ raise ValueError ("'date' must be localized" )
448453
449454 # must convert to midnight UTC on day of interest
450- times_utc = times .tz_convert ('UTC' )
451- unixtime = _datetime_to_unixtime (times_utc .normalize ())
455+ date_utc = date .tz_convert ('UTC' )
456+ unixtime = _datetime_to_unixtime (date_utc .normalize ())
452457
453458 spa = _spa_python_import (how )
454459
455460 if delta_t is None :
456- delta_t = spa .calculate_deltat (times_utc .year , times_utc .month )
461+ delta_t = spa .calculate_deltat (date_utc .year , date_utc .month )
457462
458463 transit , sunrise , sunset = spa .transit_sunrise_sunset (
459464 unixtime , lat , lon , delta_t , numthreads )
460465
461- # arrays are in seconds since epoch format, need to conver to timestamps
466+ # arrays are in seconds since epoch format, need to convert to timestamps
462467 transit = pd .to_datetime (transit * 1e9 , unit = 'ns' , utc = True ).tz_convert (
463468 tzinfo ).tolist ()
464469 sunrise = pd .to_datetime (sunrise * 1e9 , unit = 'ns' , utc = True ).tz_convert (
465470 tzinfo ).tolist ()
466471 sunset = pd .to_datetime (sunset * 1e9 , unit = 'ns' , utc = True ).tz_convert (
467472 tzinfo ).tolist ()
468473
469- return pd .DataFrame (index = times , data = {'sunrise' : sunrise ,
474+ return pd .DataFrame (index = date , data = {'sunrise' : sunrise ,
470475 'sunset' : sunset ,
471476 'transit' : transit })
472477
0 commit comments