|
25 | 25 |
|
26 | 26 | from pvlib import atmosphere, tools
|
27 | 27 | from pvlib.tools import datetime_to_djd, djd_to_datetime
|
| 28 | +from pvlib._deprecation import renamed_kwarg_warning |
28 | 29 |
|
29 | 30 |
|
30 | 31 | def get_solarposition(time, latitude, longitude,
|
@@ -1340,15 +1341,20 @@ def solar_zenith_analytical(latitude, hourangle, declination):
|
1340 | 1341 | )
|
1341 | 1342 |
|
1342 | 1343 |
|
1343 |
| -def hour_angle(times, longitude, equation_of_time): |
| 1344 | +@renamed_kwarg_warning("0.11.2", "times", "time", "0.12.0") |
| 1345 | +def hour_angle(time, longitude, equation_of_time): |
1344 | 1346 | """
|
1345 | 1347 | Hour angle in local solar time. Zero at local solar noon.
|
1346 | 1348 |
|
1347 | 1349 | Parameters
|
1348 | 1350 | ----------
|
1349 |
| - times : :class:`pandas.DatetimeIndex` |
| 1351 | + time : :class:`pandas.DatetimeIndex` |
1350 | 1352 | Corresponding timestamps, must be localized to the timezone for the
|
1351 | 1353 | ``longitude``.
|
| 1354 | +
|
| 1355 | + .. versionchanged:: 0.11.2 |
| 1356 | + Renamed from ``times`` to ``time``. |
| 1357 | +
|
1352 | 1358 | longitude : numeric
|
1353 | 1359 | Longitude in degrees
|
1354 | 1360 | equation_of_time : numeric
|
@@ -1376,14 +1382,14 @@ def hour_angle(times, longitude, equation_of_time):
|
1376 | 1382 | equation_of_time_pvcdrom
|
1377 | 1383 | """
|
1378 | 1384 |
|
1379 |
| - # times must be localized |
1380 |
| - if not times.tz: |
1381 |
| - raise ValueError('times must be localized') |
| 1385 | + # time must be localized |
| 1386 | + if not time.tz: |
| 1387 | + raise ValueError('time must be localized') |
1382 | 1388 |
|
1383 |
| - # hours - timezone = (times - normalized_times) - (naive_times - times) |
1384 |
| - tzs = np.array([ts.utcoffset().total_seconds() for ts in times]) / 3600 |
| 1389 | + # hours - timezone = (time - normalized_time) - (naive_time - time) |
| 1390 | + tzs = np.array([ts.utcoffset().total_seconds() for ts in time]) / 3600 |
1385 | 1391 |
|
1386 |
| - hrs_minus_tzs = _times_to_hours_after_local_midnight(times) - tzs |
| 1392 | + hrs_minus_tzs = _times_to_hours_after_local_midnight(time) - tzs |
1387 | 1393 |
|
1388 | 1394 | return 15. * (hrs_minus_tzs - 12.) + longitude + equation_of_time / 4.
|
1389 | 1395 |
|
|
0 commit comments