KeiruaProd

Automated history of Celestrak satellite data

TL;DR

Context: Satellite orbital parameters

As a hobbyist astronomer, programmer and kind of data scientist, one of the cool things I can do nowadays is to identify the satellites above my head at nighttime with code.

There are tools for this already (ISS onLive on Android, Celestrak), but it’s fun to make an estimation and check by going outside that I was right. I use Skyfield for things in the Solar System, and hopefully someday I’ll know enough to go beyond and use astropy.

In order to play with satellite locations, you need satellite data. The main source (for hobbyists at least, I don’t know about professionnals) comes from Celestrak. If you browse the orbiting stations data today, you’ll find a list of Two Line Element (TLE) data that describe the orbital parameters of those satellites. If you are interested by what they represent, the (old! 1995!) columns by T.S. Kelso who runs Celestrak are still worth a read.

Among the data, you’ll find the International Space Station (ISS) :

ISS (ZARYA)             
1 25544U 98067A   21141.97474461 -.00000450  00000-0  00000+0 0  9990
2 25544  51.6422 112.3779 0003628  13.3545  90.9576 15.48906521284531

There are many other satellites, like Lemur-2 that you’ll probably have never heard of.

The problem

These satellite data are frequently updated by their agencies (after a maneuver, for instance), and the TLE data are updated on Celestrak too, but the history is lost. If you want to know what was in space 2 years ago, you need to go to archive.org and hope for the best.

A solution: automated backups of those data

Another solution is to make an automatic backup of those data on Github. It’s something I had seen before. Simon Willison, who works on Datasette, wrote a thing about this idea. It used to be a bit tedious (you need a server, a cron, backups of backups…). It’s simpler now setup thanks to Github actions.

I used a recent github action, Flat. Ancient data is lost, but starting now is better than nothing.

I’ve started running a cron that fetches those data twice a day for me. It’s enough for my use case, it won’t hurt Celestrak much and this is missing in the astro community. Also, it’s free because it does not use a lot of Action time.

# .github/workflows/celestrak.yml
name: Fetch Celestrak data

on:
  schedule:
    - cron: '12 */8 * * *' # Run this workflow at 8:12am and 8:12 pm every day

jobs:
  scheduled:
    runs-on: ubuntu-latest
    steps: # This workflow has 2 steps
      # The first step is to check out the repository so it can read the files inside of it and do other operations
      - name: Check out repo
        uses: actions/checkout@v2
      # The second step is a Flat Action step. We fetch the data in the http_url and save it as downloaded_filename
      # https://octo.github.com/projects/flat-data
      - name: Fetch data 
        uses: githubocto/flat@v2
        with:
          http_url: https://celestrak.com/NORAD/elements/active.txt
          downloaded_filename: active.txt

See a typo ? You can suggest a modification on Github.