Two-Line Element (TLE)¶
Classes and functions for working with Two-Line Element sets.
TLE Class¶
The TLE
class represents a Two-Line Element set for satellite orbit description.
from brahe import TLE
# Create TLE from strings
tle = TLE(
"ISS (ZARYA)",
"1 25544U 98067A 21001.00000000 .00002182 00000-0 41420-4 0 9990",
"2 25544 51.6461 339.8014 0002571 34.5857 120.4689 15.48919393265104"
)
# Access TLE properties
print(f"Satellite: {tle.name}")
print(f"NORAD ID: {tle.norad_id}")
print(f"Inclination: {tle.inclination} deg")
For complete API documentation, see the Rust API documentation.
TLE Utility Functions¶
epoch_from_tle
builtin
¶
epoch_from_tle(line1: str) -> Epoch
Extract Epoch from TLE line 1
Extracts and parses the epoch timestamp from the first line of TLE data. The epoch is returned in UTC time system.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
line1
|
str
|
First line of TLE data |
required |
Returns:
Name | Type | Description |
---|---|---|
Epoch |
Epoch
|
Extracted epoch in UTC time system |
Examples:
>>> line1 = "1 25544U 98067A 21001.50000000 .00001764 00000-0 40967-4 0 9997"
>>> epoch = epoch_from_tle(line1)
>>> epoch.year()
2021
keplerian_elements_from_tle
builtin
¶
keplerian_elements_from_tle(line1: str, line2: str) -> None
Extract Keplerian orbital elements from TLE lines.
Extracts the standard six Keplerian orbital elements from Two-Line Element (TLE) data. Returns elements in standard order: [a, e, i, raan, argp, M] where angles are in radians.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
line1
|
str
|
First line of TLE data. |
required |
line2
|
str
|
Second line of TLE data. |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
None
|
A tuple containing: - epoch (Epoch): Epoch of the TLE data. - elements (numpy.ndarray): Six Keplerian elements [a, e, i, raan, argp, M] where a is semi-major axis in meters, e is eccentricity (dimensionless), and i, raan, argp, M are in radians. |
keplerian_elements_to_tle
builtin
¶
keplerian_elements_to_tle(epoch: Epoch, elements: ndarray, norad_id: str) -> tuple
Convert Keplerian elements to TLE lines.
Converts standard Keplerian orbital elements to Two-Line Element (TLE) format. Input angles should be in degrees for compatibility with TLE format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
epoch
|
Epoch
|
Epoch of the elements. |
required |
elements
|
ndarray
|
Keplerian elements [a (m), e, i (deg), raan (deg), argp (deg), M (deg)]. |
required |
norad_id
|
str
|
NORAD catalog number (supports numeric and Alpha-5 format). |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
tuple
|
A tuple containing (line1, line2) - the two TLE lines as strings. |
create_tle_lines
builtin
¶
create_tle_lines(epoch: Epoch, inclination: float, raan: float, eccentricity: float, arg_perigee: float, mean_anomaly: float, mean_motion: float, norad_id: str, ephemeris_type: int, element_set_number: int, revolution_number: int, classification=None, intl_designator=None, first_derivative=None, second_derivative=None, bstar=None) -> tuple
Create complete TLE lines from all parameters.
Creates Two-Line Element (TLE) lines from complete set of orbital and administrative parameters. Provides full control over all TLE fields including derivatives and drag terms.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
epoch
|
Epoch
|
Epoch of the elements. |
required |
inclination
|
float
|
Inclination in degrees. |
required |
raan
|
float
|
Right ascension of ascending node in degrees. |
required |
eccentricity
|
float
|
Eccentricity (dimensionless). |
required |
arg_perigee
|
float
|
Argument of periapsis in degrees. |
required |
mean_anomaly
|
float
|
Mean anomaly in degrees. |
required |
mean_motion
|
float
|
Mean motion in revolutions per day. |
required |
norad_id
|
str
|
NORAD catalog number (supports numeric and Alpha-5 format). |
required |
ephemeris_type
|
int
|
Ephemeris type (0-9). |
required |
element_set_number
|
int
|
Element set number. |
required |
revolution_number
|
int
|
Revolution number at epoch. |
required |
classification
|
str
|
Security classification. Defaults to ' '. |
None
|
intl_designator
|
str
|
International designator. Defaults to ''. |
None
|
first_derivative
|
float
|
First derivative of mean motion. Defaults to 0.0. |
None
|
second_derivative
|
float
|
Second derivative of mean motion. Defaults to 0.0. |
None
|
bstar
|
float
|
BSTAR drag term. Defaults to 0.0. |
None
|
Returns:
Name | Type | Description |
---|---|---|
tuple |
tuple
|
A tuple containing (line1, line2) - the two TLE lines as strings. |
validate_tle_line
builtin
¶
validate_tle_line(line: str) -> bool
Validate single TLE line.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
line
|
str
|
TLE line to validate. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the line is valid. |
validate_tle_lines
builtin
¶
validate_tle_lines(line1: str, line2: str) -> bool
Validate TLE lines.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
line1
|
str
|
First line of TLE data. |
required |
line2
|
str
|
Second line of TLE data. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if both lines are valid. |
calculate_tle_line_checksum
builtin
¶
calculate_tle_line_checksum(line: str) -> int
Calculate TLE line checksum.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
line
|
str
|
TLE line. |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Checksum value. |
parse_norad_id
builtin
¶
parse_norad_id(norad_str: str) -> int
Parse NORAD ID from string, handling both classic and Alpha-5 formats.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
norad_str
|
str
|
NORAD ID string from TLE. |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Parsed numeric NORAD ID. |
norad_id_numeric_to_alpha5
builtin
¶
norad_id_numeric_to_alpha5(norad_id: int) -> str
Convert numeric NORAD ID to Alpha-5 format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
norad_id
|
int
|
Numeric NORAD ID (100000-339999). |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Alpha-5 format ID (e.g., "A0001"). |
norad_id_alpha5_to_numeric
builtin
¶
norad_id_alpha5_to_numeric(alpha5_id: str) -> int
Convert Alpha-5 NORAD ID to numeric format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
alpha5_id
|
str
|
Alpha-5 format ID (e.g., "A0001"). |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Numeric NORAD ID. |