@@ -445,7 +445,7 @@ def sun_rise_set_transit_spa(times, latitude, longitude, how='numpy',
445
445
446
446
# must convert to midnight UTC on day of interest
447
447
utcday = pd .DatetimeIndex (times .date ).tz_localize ('UTC' )
448
- unixtime = np .array (utcday .astype (np .int64 )/ 10 ** 9 )
448
+ unixtime = np .array (utcday .view (np .int64 )/ 10 ** 9 )
449
449
450
450
spa = _spa_python_import (how )
451
451
@@ -1001,7 +1001,7 @@ def nrel_earthsun_distance(time, how='numpy', delta_t=67.0, numthreads=4):
1001
1001
except (TypeError , ValueError ):
1002
1002
time = pd .DatetimeIndex ([time , ])
1003
1003
1004
- unixtime = np .array (time .astype (np .int64 )/ 10 ** 9 )
1004
+ unixtime = np .array (time .view (np .int64 )/ 10 ** 9 )
1005
1005
1006
1006
spa = _spa_python_import (how )
1007
1007
@@ -1381,8 +1381,8 @@ def hour_angle(times, longitude, equation_of_time):
1381
1381
naive_times = times .tz_localize (None ) # naive but still localized
1382
1382
# hours - timezone = (times - normalized_times) - (naive_times - times)
1383
1383
hrs_minus_tzs = 1 / NS_PER_HR * (
1384
- 2 * times .astype (np .int64 ) - times .normalize ().astype (np .int64 ) -
1385
- naive_times .astype (np .int64 ))
1384
+ 2 * times .view (np .int64 ) - times .normalize ().view (np .int64 ) -
1385
+ naive_times .view (np .int64 ))
1386
1386
# ensure array return instead of a version-dependent pandas <T>Index
1387
1387
return np .asarray (
1388
1388
15. * (hrs_minus_tzs - 12. ) + longitude + equation_of_time / 4. )
@@ -1392,7 +1392,7 @@ def _hour_angle_to_hours(times, hourangle, longitude, equation_of_time):
1392
1392
"""converts hour angles in degrees to hours as a numpy array"""
1393
1393
naive_times = times .tz_localize (None ) # naive but still localized
1394
1394
tzs = 1 / NS_PER_HR * (
1395
- naive_times .astype (np .int64 ) - times .astype (np .int64 ))
1395
+ naive_times .view (np .int64 ) - times .view (np .int64 ))
1396
1396
hours = (hourangle - longitude - equation_of_time / 4. ) / 15. + 12. + tzs
1397
1397
return np .asarray (hours )
1398
1398
@@ -1406,7 +1406,7 @@ def _local_times_from_hours_since_midnight(times, hours):
1406
1406
# normalize local, naive times to previous midnight and add the hours until
1407
1407
# sunrise, sunset, and transit
1408
1408
return pd .DatetimeIndex (
1409
- (naive_times .normalize ().astype (np .int64 ) +
1409
+ (naive_times .normalize ().view (np .int64 ) +
1410
1410
(hours * NS_PER_HR ).astype (np .int64 )).astype ('datetime64[ns]' ),
1411
1411
tz = tz_info )
1412
1412
@@ -1415,7 +1415,7 @@ def _times_to_hours_after_local_midnight(times):
1415
1415
"""convert local pandas datetime indices to array of hours as floats"""
1416
1416
times = times .tz_localize (None )
1417
1417
hrs = 1 / NS_PER_HR * (
1418
- times .astype (np .int64 ) - times .normalize ().astype (np .int64 ))
1418
+ times .view (np .int64 ) - times .normalize ().view (np .int64 ))
1419
1419
return np .array (hrs )
1420
1420
1421
1421
0 commit comments