@@ -445,7 +445,7 @@ def sun_rise_set_transit_spa(times, latitude, longitude, how='numpy',
445445
446446 # must convert to midnight UTC on day of interest
447447 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 )
449449
450450 spa = _spa_python_import (how )
451451
@@ -1001,7 +1001,7 @@ def nrel_earthsun_distance(time, how='numpy', delta_t=67.0, numthreads=4):
10011001 except (TypeError , ValueError ):
10021002 time = pd .DatetimeIndex ([time , ])
10031003
1004- unixtime = np .array (time .astype (np .int64 )/ 10 ** 9 )
1004+ unixtime = np .array (time .view (np .int64 )/ 10 ** 9 )
10051005
10061006 spa = _spa_python_import (how )
10071007
@@ -1381,8 +1381,8 @@ def hour_angle(times, longitude, equation_of_time):
13811381 naive_times = times .tz_localize (None ) # naive but still localized
13821382 # hours - timezone = (times - normalized_times) - (naive_times - times)
13831383 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 ))
13861386 # ensure array return instead of a version-dependent pandas <T>Index
13871387 return np .asarray (
13881388 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):
13921392 """converts hour angles in degrees to hours as a numpy array"""
13931393 naive_times = times .tz_localize (None ) # naive but still localized
13941394 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 ))
13961396 hours = (hourangle - longitude - equation_of_time / 4. ) / 15. + 12. + tzs
13971397 return np .asarray (hours )
13981398
@@ -1406,7 +1406,7 @@ def _local_times_from_hours_since_midnight(times, hours):
14061406 # normalize local, naive times to previous midnight and add the hours until
14071407 # sunrise, sunset, and transit
14081408 return pd .DatetimeIndex (
1409- (naive_times .normalize ().astype (np .int64 ) +
1409+ (naive_times .normalize ().view (np .int64 ) +
14101410 (hours * NS_PER_HR ).astype (np .int64 )).astype ('datetime64[ns]' ),
14111411 tz = tz_info )
14121412
@@ -1415,7 +1415,7 @@ def _times_to_hours_after_local_midnight(times):
14151415 """convert local pandas datetime indices to array of hours as floats"""
14161416 times = times .tz_localize (None )
14171417 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 ))
14191419 return np .array (hrs )
14201420
14211421
0 commit comments