I/O

TLE

The TLE representation is a de-facto standard for orbit description.

Module for handling TLE reading and writing

ISS (ZARYA)
1 25544U 98067A   08264.51782528 -.00002182  00000-0 -11606-4 0  2927
2 25544  51.6416 247.4627 0006703 130.5360 325.0288 15.72125391563537

First Line
1   01–01   Line number                                                                      1
2   03–07   Satellite number                                                                 25544
3   08–08   Classification (U=Unclassified)                                                  U
4   10–11   International Designator (Last two digits of launch year)                        98
5   12–14   International Designator (Launch number of the year)                             067
6   15–17   International Designator (piece of the launch)                                   A
7   19–20   Epoch Year (last two digits of year)                                             08
8   21–32   Epoch (day of the year and fractional portion of the day)                        264.51782528
9   34–43   First Time Derivative of the Mean Motion divided by two [10]                     −.00002182
10  45–52   Second Time Derivative of Mean Motion divided by six (decimal point assumed)     00000-0
11  54–61   BSTAR drag term (decimal point assumed) [10]                                     -11606-4
12  63–63   The number 0 (originally this should have been "Ephemeris type")                 0
13  65–68   Element set number. Incremented when a new TLE is generated for this object.[10] 292
14  69–69   Checksum (modulo 10)                                                             7

Second Line
1   01–01   Line number                                         2
2   03–07   Satellite number                                    25544
3   09–16   Inclination (degrees)                               51.6416
4   18–25   Right ascension of the ascending node (degrees)     247.4627
5   27–33   Eccentricity (decimal point assumed)                0006703
6   35–42   Argument of perigee (degrees)                       130.5360
7   44–51   Mean Anomaly (degrees)                              325.0288
8   53–63   Mean Motion (revolutions per day)                   15.72125391
9   64–68   Revolution number at epoch (revolutions)            56353
10  69–69   Checksum (modulo 10)                                7
class beyond.io.tle.Tle(text, **kwargs)

Bases: object

TLE parsing

classmethod from_orbit(orbit, name=None, norad_id=None, cospar_id=None)

Convert an orbit to it’s TLE representation

Parameters
  • orbit (Orbit) –

  • norad_id (str or int) –

  • cospar_id (str) –

Returns

TLE representation

Return type

str

classmethod from_string(text, comments='#', error='warn')

Generator of TLEs from a string

Parameters
  • text (str) – A text containing many TLEs

  • comments (str) – If a line starts with this character, it is ignored

  • error (str) – How to handle errors while parsing the text. Could be ‘raise’, ‘warn’ or ‘ignore’.

Yields

Tle

orbit()

Convert TLE to Orbit object, in order to make computations on it

Return type

Orbit

to_list()

Convert the tle to a list representation, with the order as it can be found in the TLE representation.

exception beyond.io.tle.TleParseError

Bases: ParseError

CCSDS

exception beyond.io.ccsds.CcsdsError
beyond.io.ccsds.dump(data, fp, **kwargs)

Write a CCSDS file depending on the type of data, this could be an OPM file (Orbit), an OEM file (Ephem or list of Ephem), or a TDM file (MeasureSet).

Parameters
  • data (Orbit, Ephem, List[Ephem] or MeasureSet) –

  • fp (file descriptor) –

Keyword Arguments
  • name (str) – Name of the object

  • cospar_id (str) – International designator of the object

  • originator (str) – Originator of the CCSDS file

  • fmt (str) – Output format of the file, can be ‘xml’ or ‘kvn’. Default to ‘kvn’

  • kep (bool) – For OPM only, if False disable the optional osculating keplerian elements.

Raises

TypeError – if the data object class is not handled

If kep = True and the frame of the StateVector is (pseudo-)inertial (i.e. EME2000, CIRF, TOD, etc.) the optional osculating keplerian elements will be added to the OPM.

It is possible to set the configuration dict to change the default value of ‘fmt’.

from beyond.config import config
config["io"] = {"ccsds_default_format": "xml"}
beyond.io.ccsds.dumps(data, **kwargs)

Create a string CCSDS representation of the object

Same arguments and behaviour as dump()

beyond.io.ccsds.load(fp)

Read CCSDS format from a file descriptor, and provide the beyond class corresponding; Orbit or list of Orbit if it’s an OPM, Ephem if it’s an OEM, MeasureSet if it’s a TDM.

Parameters

fp – file descriptor of a CCSDS file

Returns

Orbit, Ephem, List[Ephem] or MeasureSet

Raises

CcsdsError – when the text is not a recognizable CCSDS format

beyond.io.ccsds.loads(text)

Read CCSDS from a string, and provide the beyond class corresponding; Orbit or list of Orbit if it’s an OPM, Ephem if it’s an OEM, MeasureSet if it’s a TDM.

Parameters

text (str) –

Returns

Orbit, Ephem, List[Ephem] or MeasureSet

Raises

CcsdsError – when the text is not a recognizable CCSDS format

Horizon ephemeris

Module dedicated to parsing Horizon ephemeris format retrievable from NASA’s https://ssd.jpl.nasa.gov/horizons.cgi

exception beyond.io.horizon.HorizonParseError
beyond.io.horizon.load(fp)

Read Horizon format ephemeris from a file

Parameters

fp – file descriptor of a Horizon file

Returns

Ephem

Raises

HorizonParseError – The file is not a recognizable Horizon format

beyond.io.horizon.loads(text)

Read Horizon format ephemeris from a text

Parameters

text (str) – text in Horizon format

Returns

Ephem

Raises

HorizonParseError – The text is not a recognizable Horizon format