tleHandling
- class tleHandling.TleData(oe: ClassicElements, tleEpoch: datetime, satName: str = 'BSK-Sat-00', noradID: str = '00000', classification: str = 'Unknown', revAtEpoch: int = 0, propagator: str = '0', elemSetNo: int = 999, nDot: float = 0.0, nDotDot: float = 0.0, bStar: float = 0.0, launchDate: datetime = None, launchNo: int = 1, pol: str = 'A')[source]
Bases:
objectData class to hold TLE data (orbit elements) and metadata.
- tleHandling.datetime_to_jd(t: datetime)[source]
Convert a datetime object to Julian Date. [JD = continuous count of days since 01.01.4713 BC, 12:00 UTC J2000 epoch corresponds to JD 2451545.0 (01.01.2000, 12:00 UTC)]
Source: https://en.wikipedia.org/wiki/Julian_day
- Parameters:
t – datetime object
- Returns:
Julian Date
- tleHandling.frame_bias()[source]
Frame bias matrix from the GCRS to the mean equator and equinox of J2000.
Uses the IERS Conventions (2010) form \(B = R_1(-\eta_0) R_2(\xi_0) R_3(d\alpha_0)\). Here \(R_i(\theta)\) is the axes (frame) rotation returned by
rot(), which rotates the coordinate frame by \(\theta\) about axis \(i\) (for example \(R_3(\theta)\) has \(+\sin\theta\) in row 1, column 2); under the vector-rotation convention the same product reads as the transpose.- Returns:
3x3 rotation matrix that maps GCRS vector components to mean J2000 components.
- Return type:
numpy.ndarray
- tleHandling.generateTle(tleData: TleData) str[source]
Generate TLE based on satellite orbit_n data for one satellite. This function allows to generate a TLE for one satellite at a time! TLEs for constellations must be concanatenated outside of this function. :param orbitElements: Classical orbital elements of the satellite [om.ClassicElements object] :param satelliteName: Name of the satellite (optional, default: “BSK-Sat-00”) [string, <= 24 char] :param launchYear_dt: Launch date of the satellite (optional, default: current year) [datetime object] :param launch_Noyear: Launch number of the year (optional, default: 1) [int] :param NORAD_ID: NORAD catalog number 0–99999 (optional, default: “00000”). Catalog numbers ≥ 100000 (assigned from ~July 2026) cannot be represented in TLE format. :param classification: Satellite classification (U: Unclassified, C: Classified, S: Secret | default: “U”) [str, 1 char] :param PoL: Piece of the launch (optional, default: “A “) [str, 3 char] :param tleEpoch: Epoch of the TLE as datetime object (optional default: current UTC time) [datetime object] :param element_set_no: Element set number (optional, default: 999) [int] :param nDot: First derivative of mean motion (dn/dt) [float, rev/day^2] :param nDotDot: Second derivative of mean motion (d^2n/dt^2) [float, rev/day^3] :param BStar: B* drag term (optional, default: 0.0) [float, 1/Earth radii] :return: TLE string [str, 3 lines]
- tleHandling.rot(axis, angle)[source]
Rotation matrix for a given axis and angle.
- Parameters:
axis – Axis of rotation (1, 2, or 3)
angle – Rotation angle in radians
- Returns:
3x3 rotation matrix
- tleHandling.satTle2elem(tle_path: str, *, on_error: str = 'raise')[source]
Convert SGP4 TLE records to osculating orbital elements and satellite metadata.
The ephemeris-type field (column 63 of line 1) may be blank,
0or2. Other types, including4(SGP4-XP), are unsupported and follow the per-set error handling below.A blank international designator (columns 10-17 of line 1) is accepted. In that case,
launchDateisNone, whilelaunchNoandpolretain theirTleDatadefaults of1and"A". These defaults do not represent known launch metadata for the object.By default, the first error during parsing or orbital conversion is raised immediately, and no partial result is returned. Set
on_error="skip"to skip complete sets that raiseValueErrororArithmeticErrorand return the readable sets. Each skipped set produces a printed warning. These errors include bad checksums, malformed fields, unsupported catalog numbers, SGP4 errors, overflow and division by zero. If every attempted set fails in skip mode, the first set’s original error is raised. File access errors, file-level format errors and exceptions outside these two classes propagate in both modes.Trailing blank lines are ignored. Lines with a 69-column element-line prefix or a recognizable truncated element header are rejected in title positions as possible orphaned lines. Longer fragments with recognizable field structure are rejected even if their catalog fields are malformed. Intact sequences of element fields also identify shortened headers whose missing characters have shifted later columns. Prefix an intentional element-like title with
0followed by a space to disambiguate it. For a satellite-name line, the prefix is retained insatName.- Parameters:
tle_path – path to a TLE with one or multiple satellites in either 2LE or 3LE format
on_error – keyword-only error policy:
"raise"(default) stops at the first record error;"skip"warns and skips complete sets with validation or arithmetic errors. Other values raiseValueErrorbefore the file is opened.
- Returns:
list of
TleDataobjects for successfully converted records, with osculating orbital elements inoeand satellite metadata in the other attributes