PyTle#

class cysgp4.PyTle(name, line_one, line_two)#

Bases: object

Thin wrapper around sgp4 (C++) Tle class.

Two-line element sets contain the parameters necessary to describe a satellite’s orbit (around Earth). Although the name suggests that two lines of strings are used, in practice often three lines are defined, the first containing a satellite name (and/or) ID. It is important to note that for many satellites, the corresponding TLEs get outdated quickly. Especially for low earth orbit satellites, one should query up-to-date information at least once per day.

PyTle is only used to parse the TLE strings and store the orbital parameters for use by other sgp4 routines.

Parameters:
namestr

Name/ID of satellite.

line_onestr

First TLE line string.

line_twostr

Second TLE line string.

Returns:
tlePyTle object

Examples

TLEs can be obtained from many sources, such as https://celestrak.com/:

>>> import requests
>>> from cysgp4 import PyTle

>>> url = 'http://celestrak.com/NORAD/elements/science.txt'
>>> ctrak_science = requests.get(url)
>>> all_lines = ctrak_science.text.split('\r\n')
>>> tle_list = list(zip(*tuple(
...     all_lines[idx::3]
...     for idx in range(3)
...     )))
>>> len(tle_list)
>>> print(*tle_list[1], sep='\n')
HST
1 20580U 90037B   19321.38711875  .00000471  00000-0  17700-4 0  9991
2 20580  28.4699 288.8102 0002495 321.7771 171.5855 15.09299865423838

>>> hst_tle = PyTle(*tle_list[1])
>>> hst_tle
<PyTle: HST                     >
>>> print(hst_tle)
Norad Number:         20580
Int. Designator:      90037B
Epoch:                2019-11-17 09:17:27.060000 UTC
Orbit Number:         42383
Mean Motion Dt2:        0.00000471
Mean Motion Ddt6:       0.00000000
Eccentricity:           0.00024950
BStar:                  0.00001770
Inclination:           28.46990000
Right Ascending Node: 288.81020000
Argument Perigee:     321.77710000
Mean Anomaly:         171.58550000
Mean Motion:           15.09299865

Attributes Summary

arg_perigee

Satellite's argument of perigee [deg].

bstar

Satellite's BSTAR drag term.

catalog_number

Satellite's (NORAD) catalog number.

eccentricity

Satellite orbit's eccentricity [dimless].

epoch

Epoch of the satellites TLE.

inclination

Satellite's inclination [deg].

int_designator

Satellite's international designator.

mean_anomaly

Satellite's mean anomaly [deg].

mean_motion

Satellite's mean motion [1 / day].

mean_motion_dt2

Satellite's first time derivative of the mean motion divided by two.

mean_motion_dt6

Satellite's second time derivative of mean motion divided by six.

raan

Satellite's right ascension of the ascending node (RAAN) [deg].

rev_number

Satellite's revolution number at epoch (revolutions).

Methods Summary

tle_strings(self)

Attributes Documentation

arg_perigee#

Satellite’s argument of perigee [deg].

bstar#

Satellite’s BSTAR drag term.

catalog_number#

Satellite’s (NORAD) catalog number.

eccentricity#

Satellite orbit’s eccentricity [dimless].

epoch#

Epoch of the satellites TLE.

Note that TLEs get outdated quickly in which case, the orbit computations can have large errorbars.

Returns:
epochPyDateTime

Epoch of the satellites TLE.

inclination#

Satellite’s inclination [deg].

int_designator#

Satellite’s international designator.

First two digits is the (last two digits of the) launch year. Next three digits are the launch number (in that year). Last digit is the piece of the launch. (see TLEs on Wikipedia)

mean_anomaly#

Satellite’s mean anomaly [deg].

mean_motion#

Satellite’s mean motion [1 / day].

mean_motion_dt2#

Satellite’s first time derivative of the mean motion divided by two.

mean_motion_dt6#

Satellite’s second time derivative of mean motion divided by six.

raan#

Satellite’s right ascension of the ascending node (RAAN) [deg].

rev_number#

Satellite’s revolution number at epoch (revolutions).

Methods Documentation

tle_strings(self)#