You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have an array of Geocentric position and velocity (e.g. from a satellite.at(timearray)), taking a slice or element out of it loses some of the type context and also converts the velocities to nan.
import skyfield.api
import os
import numpy as np
loader = skyfield.api.Loader(os.path.expanduser("~/.config/skyfield"))
ts = loader.timescale()
stations_url = 'http://celestrak.com/NORAD/elements/stations.txt'
satellites = loader.tle(stations_url)
satellite = satellites['ISS (ZARYA)']
# print(satellite)
now = ts.now()
nowandthen = ts.tai_jd(now.tai + np.arange(2)/86400)
atbyseconds = satellite.at(nowandthen)
print("Unsliced, sliced, and indexed:\n")
for posandvel in (atbyseconds, atbyseconds[:], atbyseconds[0]):
print(type(posandvel), posandvel)
print("Position")
print(posandvel.position.km)
print("Velocity")
print(posandvel.velocity.km_per_s)
print("-------------------------------------------")
Result:
Unsliced, sliced, and indexed:
<class 'skyfield.positionlib.Geocentric'> <Geocentric position and velocity at date t center=399 target=<object object at 0x10fe16ef0>>
Position
[[6161.12839736 6159.77530714]
[2749.56861045 2754.20941124]
[ 735.51733732 729.5672061 ]]
Velocity
[[-1.34916969 -1.3570354 ]
[ 4.64268485 4.63917042]
[-5.95007741 -5.95101607]]
-------------------------------------------
<class 'skyfield.positionlib.Geocentric'> <Geocentric position and velocity at date t>
Position
[[6161.12839736 6159.77530714]
[2749.56861045 2754.20941124]
[ 735.51733732 729.5672061 ]]
Velocity
[[nan nan]
[nan nan]
[nan nan]]
-------------------------------------------
<class 'skyfield.positionlib.Geocentric'> <Geocentric position and velocity at date t>
Position
[6161.12839736 2749.56861045 735.51733732]
Velocity
[nan nan nan]
-------------------------------------------
The text was updated successfully, but these errors were encountered:
If you have an array of Geocentric position and velocity (e.g. from a
satellite.at(timearray)
), taking a slice or element out of it loses some of the type context and also converts the velocities to nan.Result:
The text was updated successfully, but these errors were encountered: