ns-3-leo/utils/import-tle.sh
2020-08-13 21:51:39 +02:00

30 lines
523 B
Bash
Executable file

#!/bin/sh
set -u
set -e
search=$1
# Get the ids of sats matching the search term
if [ ! -f ids.txt ]
then
curl https://celestrak.com/pub/satcat.txt | grep "$search" | cut -b14-18 > ids.txt
fi
# Download TLE data for each sat
while read id
do
if [ ! -f $id.txt ]
then
wget "https://celestrak.com/satcat/tle.php?CATNR=$id" -O $id.txt
fi
# 6000 s ~ 95 min ~ 1 orbital period
done < ids.txt
while read id
do
if [ ! -f $id.waypoints ]
then
./tle2wps.py $id.txt 2020 08 28 6000 > $id.waypoints
fi
done < ids.txt