Two-Line Element Sets and SGP-4

class satkit.TLE

Two-Line Element Set (TLE) representing a satellite ephemeris

Stucture representing a Two-Line Element Set (TLE), a satellite ephemeris format from the 1970s that is still somehow in use today and can be used to calculate satellite position and velcocity in the “TEME” frame (not-quite GCRF) using the “Simplified General Perturbations-4” (SGP-4) mathemematical model that is also included in this package.

For details, see: https://en.wikipedia.org/wiki/Two-line_element_set

The TLE format is still commonly used to represent satellite ephemerides, and satellite ephemerides catalogs in this format are publicly availalble at www.space-track.org (registration required)

TLEs sometimes have a “line 0” that includes the name of the satellite

property arg_of_perigee: time

Argument of Perigee, in degrees

property bstar: str

Drag of the satellite

should be rho0 * Cd * A / 2 / m

Units (which are strange) is multiples of 1 / Earth radius

property eccen: float

Satellite eccentricity, in range [0,1]

property epoch: time

TLE epoch

static from_file(filename: str) list[TLE] | TLE

Load TLEs from input text file Return a list of TLES loaded from input text file.

If the file contains lines only represent a single TLE, the TLE will be output, rather than a list with a single TLE element

Parameters:

filename (str) – name of textfile lines for TLE(s) to load

Returns:

a list of TLE objects or a single TLE of lines for only 1 are passed in

Return type:

list[TLE] | TLE

static from_lines(lines: list[str]) list[TLE] | TLE

Return a list of TLES loaded from input list of lines

If the file contains lines only represent a single TLE, the TLE will be output, rather than a list with a single TLE element

Parameters:

lines (list[str]) – list of strings with lines for TLE(s) to load

Returns:

a list of TLE objects or a single TLE of lines for only 1 are passed in

Return type:

list[TLE] | TLE

property inclination: float

Inclination, in degrees

property mean_anomaly: float

Mean anomaly in degrees

property mean_motion: float

Mean motion in revs / day

property mean_motion_dot: float

1/2 of first derivative of mean motion, in revs/day^2

Note

the “1/2” is because that is how number is stored in the TLE

property mean_motion_dot_dot: float

1/6 of 2nd derivative of mean motion, in revs/day^3

Note

The “1/6” is because that is how number is stored in the TLE

property name: str

The name of the satellite

property satnum: int

Satellite number, or equivalently the NORAD ID

class satkit.sgp4_opsmode

Ops Mode for SGP4 Propagation

afspc() int

afspc (Air Force Space Command), the default

property improved: int

Improved

class satkit.sgp4_gravconst

Gravity constant to use for SGP4 propagation

wgs72() sgp4_gravconst

WGS-72

wgs72old() sgp4_gravconst

WGS-72 Old

wgs84() sgp4_gravconst

WGS-84

satkit.sgp4(tle: TLE | list[TLE], tm: time | list[time] | numpy.typing.ArrayLike, **kwargs) tuple[numpy.typing.NDArray[numpy.float64], numpy.typing.NDArray[numpy.float64]]

SGP-4 propagator for TLE

Note

Run Simplified General Perturbations (SGP)-4 propagator on Two-Line Element Set to output satellite position and velocity at given time in the “TEME” coordinate system

A detailed description is at: https://celestrak.org/publications/AIAA/2008-6770/AIAA-2008-6770.pdf

Parameters:
  • tle (TLE | list[TLE]) – TLE (or list of TLES) on which to operate

  • tm (time | list[time] | npt.ArrayLike[time]) – time(s) at which to compute position and velocity

Keyword Arguments:
  • gravconst (satkit.sgp4_gravconst) – gravity constant to use. Default is gravconst.wgs72

  • opsmode (satkit.sgp4_opsmode) – opsmode.afspc (Air Force Space Command) or opsmode.improved. Default is opsmode.afspc

  • errflag (bool) – whether or not to output error conditions for each TLE and time output. Default is False (this is likely rarely needed, but can be useful for debugging) (this may also flag a typing error … I can’t figure out how to get rid of it)

Returns:

position and velocity in meters and meters/second, respectively, in the TEME frame at each of the “Ntime” input times and each of the “Ntle” tles

Additional return value if errflag is True: list[sgp4_error]: list of errors for each TLE and time output, if errflag is True

Return type:

tuple[npt.ArrayLike[np.float64], npt.ArrayLike[np.float64]]

Example

>>> lines = [
>>>        "0 INTELSAT 902",
>>>     "1 26900U 01039A   06106.74503247  .00000045  00000-0  10000-3 0  8290",
>>>     "2 26900   0.0164 266.5378 0003319  86.1794 182.2590  1.00273847 16981   9300."
>>> ]
>>>
>>> tle = satkit.TLE.single_from_lines(lines)
>>>
>>> # Compute TEME position & velocity at epoch
>>> pteme, vteme = satkit.sgp4(tle, tle.epoch)
>>>
>>> # Rotate to ITRF frame
>>> q = satkit.frametransform.qteme2itrf(tm)
>>> pitrf = q * pteme
>>> vitrf = q * vteme - np.cross(np.array([0, 0, satkit.univ.omega_earth]), pitrf)
>>>
>>> # convert to ITRF coordinate object
>>> coord = satkit.itrfcoord.from_vector(pitrf)
>>>
>>> # Print ITRF coordinate object location
>>> print(coord)
ITRFCoord(lat:  -0.0363 deg, lon:  -2.2438 deg, hae: 35799.51 km)