Skip to main content

Simple module for ephemeris download and parse

Project description

spacetrack_files

This module allows you to download and parse Starlink ephemeris files.

Setup

Simply add this module via pip

pip install spacetrack_files

Using

You can:

  • Download any available public files from SpaceTrack
  • Parse Starlink ephemeris

Downloading public files

Downloading public files from SpaceTrack

Script below retrieves all public files and downloads them.

import os
from spacetrack_files.api import SpaceTrackApi

api = SpaceTrackApi('your_username', 'your_password')
dirs = api.getDirsList()

base_download_path = '.'

for download_path in dirs:
    if not os.path.exists(download_path):
        os.mkdir(download_path)

    fs = api.getDirsWithFiles()
    downloading_files = fs[download_path]

    for file in downloading_files:
        file_download_path = os.path.join(base_download_path, download_path, file)
        if os.path.exists(file_download_path):
            continue
        api.downloadFile(file, file_download_path)

Parsing Starlink ephemeris

It's as simple as this:

from spacetrack_files.files import EphemerisFile

# DO NOT RENAME FILE
eph = EphemerisFile('MEME_54190_STARLINK-5281_2210828_Operational_1375864140_UNCLASSIFIED.txt') 

Keep in mind: module's using filename to parse satellite name, NORAD ID, classification and operational status. Thus do not rename file.

Ephemeris structure:

@dataclass
class Ephemeris:
    epoch_j2000: str
    epoch: datetime
    position: np.array
    speed: np.array
    corr_values: np.array

Variables position and speed are 3-dim vectors. corr_values is matrix 3x7.

You can also get ephemeris in DataFrame format:

df = eph.to_dataframe()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spacetrack_files-0.0.3.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

spacetrack_files-0.0.3-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page