Skip to content

Commit 25bcf02

Browse files
committed
Update solarposition.py
1 parent 981f394 commit 25bcf02

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

pvlib/solarposition.py

Lines changed: 15 additions & 16 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", "time", "0.12")
394-
def sun_rise_set_transit_spa(time, latitude, longitude, how='numpy',
393+
@renamed_kwarg_warning("0.11.2", "times", "date", "0.12")
394+
def sun_rise_set_transit_spa(date, latitude, longitude, how='numpy',
395395
delta_t=67.0, numthreads=4):
396396
"""
397397
Calculate the sunrise, sunset, and sun transit times using the
@@ -406,12 +406,11 @@ def sun_rise_set_transit_spa(time, latitude, longitude, how='numpy',
406406
407407
Parameters
408408
----------
409-
time : pandas.DatetimeIndex
409+
date : pandas.DatetimeIndex
410410
Must be localized to the timezone for ``latitude`` and ``longitude``.
411411
412-
.. versionchanged:: 0.11.2
413-
The ``times` parameter has been renamed ``time``. The deprecated
414-
``times`` parameter will be removed in ``v0.12.0``.
412+
.. deprecated:: 0.11.2 until 0.12.0
413+
Renamed from ``times`` to ``date``.
415414
416415
latitude : float
417416
Latitude in degrees, positive north of equator, negative to south
@@ -424,15 +423,15 @@ def sun_rise_set_transit_spa(time, latitude, longitude, how='numpy',
424423
delta_t : float or array, optional, default 67.0
425424
Difference between terrestrial time and UT1.
426425
If delta_t is None, uses spa.calculate_deltat
427-
using time.year and time.month from pandas.DatetimeIndex.
426+
using date.year and date.month from pandas.DatetimeIndex.
428427
For most simulations the default delta_t is sufficient.
429428
numthreads : int, optional, default 4
430429
Number of threads to use if how == 'numba'.
431430
432431
Returns
433432
-------
434433
pandas.DataFrame
435-
index is the same as input ``time`` argument
434+
index is the same as input ``date`` argument
436435
columns are 'sunrise', 'sunset', and 'transit'
437436
438437
References
@@ -446,20 +445,20 @@ def sun_rise_set_transit_spa(time, latitude, longitude, how='numpy',
446445
lat = latitude
447446
lon = longitude
448447

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

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

459458
spa = _spa_python_import(how)
460459

461460
if delta_t is None:
462-
delta_t = spa.calculate_deltat(time_utc.year, time_utc.month)
461+
delta_t = spa.calculate_deltat(date_utc.year, date_utc.month)
463462

464463
transit, sunrise, sunset = spa.transit_sunrise_sunset(
465464
unixtime, lat, lon, delta_t, numthreads)
@@ -473,7 +472,7 @@ def sun_rise_set_transit_spa(time, latitude, longitude, how='numpy',
473472
tzinfo).tolist()
474473

475474
return pd.DataFrame(
476-
index=time,
475+
index=date,
477476
data={"sunrise": sunrise, "sunset": sunset, "transit": transit},
478477
)
479478

0 commit comments

Comments
 (0)