auromat.coordinates.spacetrack module

class auromat.coordinates.spacetrack.Spacetrack(user, password, minUpdateInterval=datetime.timedelta(30))[source]

Downloads TLE data from http://space-track.org and stores them as files on disk (one file per NORAD ID).

Use the auromat.coordinates.ephem module for calculating coordinates based on the TLE files.

Parameters:
  • user (str) – space-track.org user name
  • password (str) – space-track.org password
  • minUpdateInterval (datetime.timedelta) – The minimum amount of time after which an update of a cached TLE file is performed when using one of the updateTLEs* methods. The time is relative to the file modification dates.
query(query)[source]

Query spacetrack and return the result as string.

Raises DownloadError:
 on any network error
updateTLEs(noradId, tlePath)[source]

Updates the TLEs to the latest available data.

Parameters:
  • noradId (str|int) –
  • tlePath (str) –
Returns:

True, if new TLEs were added, False otherwise

Raise:

DownloadError: on any network error

Raise:

ValueError: if the downloaded TLEs could not be correctly read

updateTLEsFor(noradId, tlePath, observationDate)[source]

Updates the TLEs such that the given observation date is covered. If no suitable TLEs are available (newest TLE Epoch < observationDate), an exception is raised.

Note that TLEs are only appended, which means that TLE files which were produced outside this class and which only contain a certain time period will not be prepended with older TLEs.

Parameters:
  • noradId (str|int) –
  • tlePath (str) –
  • observationDate (datetime.datetime) –
Raise:

DownloadError: on any network error

Raise:

ValueError: if the downloaded TLEs could not be correctly read

Raise:

ValueError: if no TLEs were found for the given date