SatRec

class huira.SatRec

A satellite’s element set, read from a two-line element set (TLE) or an Orbit Mean-Elements Message (OMM), checked, and ready to be propagated with SGP4. Make one with from_tle() or from_omm().

__init__(*args, **kwargs)
catalog_number(self: huira._huira.SatRec) → int

The NORAD catalog number, decoded from the Alpha-5 form if it is in it

epoch(self: huira._huira.SatRec) → huira._huira.Time

The time the element set describes the orbit at

error_message_at(self: huira._huira.SatRec, time: huira._huira.Time) → str

Why SGP4 can’t propagate the element set to a time, or ‘’ if it can

evaluate(self: huira._huira.SatRec, time: huira._huira.Time) → tuple[huira._huira.Vec3, huira._huira.Vec3] | None

The position, in meters, and velocity, in meters per second, at a time, in the TEME frame (HUIRA_EARTH_TEME, centered on the Earth), as a tuple; or None if SGP4 can’t propagate the element set to it. error_message_at() says why.

static from_omm(fields: dict, mode: huira._huira.Sgp4Mode = <Sgp4Mode.AFSPC: 0>) → huira._huira.SatRec

Read an Orbit Mean-Elements Message (OMM), as a dict of its keywords and values.

The values may be text or numbers, so a record from json.load() of CelesTrak’s or Space-Track’s JSON, or a row from csv.DictReader, can be passed as it is. None is taken as a missing value. SGP4 needs NORAD_CAT_ID, EPOCH (UTC, as YYYY-MM-DDThh:mm:ss.ssssss), MEAN_MOTION, ECCENTRICITY, INCLINATION, RA_OF_ASC_NODE, ARG_OF_PERICENTER, MEAN_ANOMALY, BSTAR, MEAN_MOTION_DOT and MEAN_MOTION_DDOT. OBJECT_NAME and OBJECT_ID give the name and designator. MEAN_ELEMENT_THEORY, REF_FRAME, CENTER_NAME, TIME_SYSTEM and EPHEMERIS_TYPE, if given, are checked; any other keyword is ignored. Raises RuntimeError if the OMM can’t be propagated by SGP4.

static from_tle(*args, **kwargs)

Overloaded function.

  1. from_tle(line1: str, line2: str, mode: huira._huira.Sgp4Mode = <Sgp4Mode.AFSPC: 0>) -> huira._huira.SatRec

Read a TLE’s two lines. Raises RuntimeError if a line is not 69 characters long, isn’t laid out as a TLE line is, or fails its checksum; if the lines are for different satellites; if the element set is for SGP4-XP; or if SGP4 can’t propagate it at its epoch.

  1. from_tle(name: str, line1: str, line2: str, mode: huira._huira.Sgp4Mode = <Sgp4Mode.AFSPC: 0>) -> huira._huira.SatRec

Read a three-line element set: a name line, which may start with ‘0 ‘, then a TLE’s two lines.

international_designator(self: huira._huira.SatRec) → str

The international designator (COSPAR ID) as a TLE writes it, such as ‘98067A’, or ‘’

mode(self: huira._huira.SatRec) → huira._huira.Sgp4Mode

The mode SGP4 propagates the element set with

name(self: huira._huira.SatRec) → str

The name, from a TLE’s name line or an OMM’s OBJECT_NAME, or ‘’ if it has none

class huira.Sgp4Mode

Which of its two behaviors Vallado’s SGP4 propagates an element set with. They differ only for deep-space orbits inclined less than about 11.46 degrees, much of the geostationary belt among them. Use AFSPC, the default, unless you have a specific reason not to: TLEs are fitted with the US Space Force’s own SGP4, which it reproduces. IMPROVED is for matching python-sgp4 and Skyfield, which always use it.

Members:

AFSPC : As the US Space Force’s operational SGP4 does (opsmode ‘a’). The default.

IMPROVED : Vallado’s improved handling (opsmode ‘i’), as python-sgp4 and Skyfield use.

AFSPC = <Sgp4Mode.AFSPC: 0>
IMPROVED = <Sgp4Mode.IMPROVED: 1>
__init__(self: huira._huira.Sgp4Mode, value: int) → None
property name
property value