pymgp.tleorb.tleread#

pymgp.tleorb.tleread(tlefile, verbose=1)[source]#

Read NORAD Two Line Elements from file.

Reads NORAD two line elements from file and return the two-line elements (TLE’s) as a list of named tuples.

Parameters:
tlefilestring

Name of the file with two-line elements.

verboseint, optional

Verbosity level. If ‘verbose=1’ (default) an overview of the TLE’s is printed, if ‘verbose=0’ the function is quiet.

Returns:
tlelist of named tuples

List with two line elements.

Notes

The mean orbital elements contained in tle are Earth-centered-inertial (ECI) coordinates with respect to the true equator of date and the mean equinox of date. They do not include the effect of nutation. The tle are compatible with the SGP4 and SDP4 orbit propagators of NORAD.

Files with TLE’s can be obtained from www.celestrak.com. You may use the function tleget to do this. The TLE files can have an optional line with a twenty-four character name before the traditional Two Line Element format (Three-Line Elemement Set).

Examples

>>> tle = tleread('gps-20240802.tle')

Satellite              Reference_Epoch    a [km]    ecc [-]  inc [deg] RAAN [deg] argp [deg]    E [deg]    Period

GPS BIIR-2  (PRN 13)    2024-214.14951  26560.17  0.0082086    55.6823   125.3746    53.0305   307.7241  11:57:58
GPS BIIR-4  (PRN 20)    2024-214.54131  26559.29  0.0038299    54.7037    47.0333   215.0749   153.9228  11:57:56
...
GPS BIII-5  (PRN 11)    2024-214.96247  26561.08  0.0016693    55.3656   359.9043   218.6075   141.7489  11:58:00
GPS BIII-6  (PRN 28)    2024-214.66082  26560.55  0.0000873    55.0874   175.3851    64.9315   121.2604  11:57:59
>>> tle = tleread('gps-20240802.tle', verbose=0)
>>> print('type(tle)',type(tle), '   length(tle)',len(tle), '   type(tle[0])',type(tle[0]))
type(tle) <class 'list'>    length(tle) 31    type(tle[0]) <class 'tleorb.TLE'>