Nik
Nik

Reputation: 438

Pyephem elevation seems to be wrong

I'm trying to compute satellite positions using pyephem.

For most cases it seems to provide valid data. But for ~10% space-track's TLEs its results are wrong. For example:

tlelines = [
    '0 SCOUT X-4 DEB',
    '1 00722U 63053C   18107.73853716  .10519988  29718+0  80827-1 0  9998',
    '2 00722  78.3737 228.3264 0048420 261.5483  98.0279 15.81271626581437'
] 

sat = ephem.readtle(*tlelines)
now = ephem.now()  # 43314.17601851852
sat.compute(now)
print sat.elevation  # computed altitude, according to documentation

Result is 9.793773380577526e+18 which is definitely wrong. According to space-track apogee and perigee are 359 and 294 km.

What's wrong and how can I fix this computation?

PS. Python v.2, pyephem v.3.7.6.0

Upvotes: 1

Views: 217

Answers (1)

Brandon Rhodes
Brandon Rhodes

Reputation: 89462

The problem appears to be that your coordinates are too old; satellite coordinates are generally only accurate for a couple of weeks to either side of the moment they're released. In this case:

print(sat._epoch)

the coordinates were 4 months old when you tried them out:

2018/4/17 17:43:30

If you try a value like now = '2018-04-18' I think you'll get a more reasonable number.

Upvotes: 1

Related Questions