Skip to content

Commit 2a8b56d

Browse files
committed
date -> time in solarposition.sun_rise_set_transit_spa
1 parent 30e3c65 commit 2a8b56d

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

pvlib/solarposition.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,8 @@ def spa_python(time, latitude, longitude,
390390
return result
391391

392392

393-
@renamed_kwarg_warning("0.11.2", "times", "date", "0.12")
394-
def sun_rise_set_transit_spa(date, latitude, longitude, how='numpy',
393+
@renamed_kwarg_warning("0.11.2", "times", "time", "0.12")
394+
def sun_rise_set_transit_spa(time, latitude, longitude, how='numpy',
395395
delta_t=67.0, numthreads=4):
396396
"""
397397
Calculate the sunrise, sunset, and sun transit times using the
@@ -406,11 +406,11 @@ def sun_rise_set_transit_spa(date, latitude, longitude, how='numpy',
406406
407407
Parameters
408408
----------
409-
date : pandas.DatetimeIndex
409+
time : pandas.DatetimeIndex
410410
Must be localized to the timezone for ``latitude`` and ``longitude``.
411411
412-
.. deprecated:: 0.11.2 until 0.12.0
413-
Renamed from ``times`` to ``date``.
412+
.. deprecated:: 0.11.2
413+
Renamed from ``times`` to ``time``. Removal scheduled for v0.12.0.
414414
415415
latitude : float
416416
Latitude in degrees, positive north of equator, negative to south
@@ -423,15 +423,15 @@ def sun_rise_set_transit_spa(date, latitude, longitude, how='numpy',
423423
delta_t : float or array, optional, default 67.0
424424
Difference between terrestrial time and UT1.
425425
If delta_t is None, uses spa.calculate_deltat
426-
using date.year and date.month from pandas.DatetimeIndex.
426+
using time.year and time.month from pandas.DatetimeIndex.
427427
For most simulations the default delta_t is sufficient.
428428
numthreads : int, optional, default 4
429429
Number of threads to use if how == 'numba'.
430430
431431
Returns
432432
-------
433433
pandas.DataFrame
434-
index is the same as input ``date`` argument
434+
index is the same as input ``time`` argument
435435
columns are 'sunrise', 'sunset', and 'transit'
436436
437437
References
@@ -445,20 +445,20 @@ def sun_rise_set_transit_spa(date, latitude, longitude, how='numpy',
445445
lat = latitude
446446
lon = longitude
447447

448-
# date must be localized
449-
if date.tz:
450-
tzinfo = date.tz
448+
# time must be localized
449+
if time.tz:
450+
tzinfo = time.tz
451451
else:
452-
raise ValueError("'date' must be localized")
452+
raise ValueError("'time' must be localized")
453453

454454
# must convert to midnight UTC on day of interest
455-
date_utc = date.tz_convert('UTC')
456-
unixtime = _datetime_to_unixtime(date_utc.normalize())
455+
time_utc = time.tz_convert('UTC')
456+
unixtime = _datetime_to_unixtime(time_utc.normalize())
457457

458458
spa = _spa_python_import(how)
459459

460460
if delta_t is None:
461-
delta_t = spa.calculate_deltat(date_utc.year, date_utc.month)
461+
delta_t = spa.calculate_deltat(time_utc.year, time_utc.month)
462462

463463
transit, sunrise, sunset = spa.transit_sunrise_sunset(
464464
unixtime, lat, lon, delta_t, numthreads)
@@ -472,7 +472,7 @@ def sun_rise_set_transit_spa(date, latitude, longitude, how='numpy',
472472
tzinfo).tolist()
473473

474474
return pd.DataFrame(
475-
index=date,
475+
index=time,
476476
data={"sunrise": sunrise, "sunset": sunset, "transit": transit},
477477
)
478478

0 commit comments

Comments
 (0)