From 8aaf54252aaa9b3acd69f2d46e2339f54de33ffc Mon Sep 17 00:00:00 2001 From: Cees Bassa Date: Sat, 8 Oct 2022 19:00:33 +0200 Subject: [PATCH] Force identical to sattools version --- tleupdate | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/tleupdate b/tleupdate index 3499e1b..f3ac90c 100755 --- a/tleupdate +++ b/tleupdate @@ -11,28 +11,21 @@ cd $ST_TLEDIR # Get date DATE=`date +%Y%m%d_%H%M%S` -# Get cookie -wget --post-data=$ST_LOGIN --cookies=on --keep-session-cookies --save-cookies=/tmp/cookies.txt 'https://www.space-track.org/ajaxauth/login' -o /tmp/stget.log +# Get space-track catalog +if [[ ! -z "${ST_LOGIN}" ]]; then + # Get cookie + wget --post-data=$ST_LOGIN --cookies=on --keep-session-cookies --save-cookies=/tmp/cookies.txt 'https://www.space-track.org/ajaxauth/login' -o /tmp/stget.log -# Get data -wget --keep-session-cookies --load-cookies=/tmp/cookies.txt 'https://www.space-track.org/basicspacedata/query/class/tle_latest/ORDINAL/1/EPOCH/%3Enow-30/format/3le' -O catalog.tle -dos2unix catalog.tle + # Get data + wget --keep-session-cookies --load-cookies=/tmp/cookies.txt 'https://www.space-track.org/basicspacedata/query/class/tle_latest/ORDINAL/1/EPOCH/%3Enow-30/format/3le' -O catalog.tle + dos2unix catalog.tle -# Determine if we have gsed on our system, which probably means that the regular 'sed' -# is BSD sed, which has a differnet syntax. Use GNU sed instead... -gsed_exists=$(which gsed) -if [ -n "$gsed_exists" ]; then - SED=gsed - echo "Using GSED" -else - SED=sed + # Fix missing leading zeros + sed -i -e "s/^1 /1 0000/g" -e "s/^2 /2 0000/g" -e "s/^1 /1 000/g" -e "s/^2 /2 000/g" -e "s/^1 /1 00/g" -e "s/^2 /2 00/g" -e "s/^1 /1 0/g" -e "s/^2 /2 0/g" catalog.tle + cp catalog.tle ${DATE}_catalog.txt + rm login fi -# Fix missing leading zeros -$SED -i -e "s/^1 /1 0000/g" -e "s/^2 /2 0000/g" -e "s/^1 /1 000/g" -e "s/^2 /2 000/g" -e "s/^1 /1 00/g" -e "s/^2 /2 00/g" -e "s/^1 /1 0/g" -e "s/^2 /2 0/g" catalog.tle -cp catalog.tle ${DATE}_catalog.txt -rm login - # Get classfd wget http://www.prismnet.com/~mmccants/tles/classfd.zip --no-check-certificate -O classfd.zip unzip -o classfd.zip @@ -48,11 +41,11 @@ cp inttles.tle ${DATE}_inttles.txt rm inttles.zip # Get CALPOLY tles -#wget http://mstl.atl.calpoly.edu/~ops/keps/kepler.txt -O kepler.tle -#dos2unix kepler.tle -#sed -i -e "s/^1 /1 0000/g" -e "s/^2 /2 0000/g" -e "s/^1 /1 000/g" -e "s/^2 /2 000/g" -e "s/^1 /1 00/g" -e "s/^2 /2 00/g" -e "s/^1 /1 0/g" -e "s/^2 /2 0/g" kepler.tle +wget http://mstl.atl.calpoly.edu/~ops/keps/kepler.txt -O kepler.tle +dos2unix kepler.tle +sed -i -e "s/^1 /1 0000/g" -e "s/^2 /2 0000/g" -e "s/^1 /1 000/g" -e "s/^2 /2 000/g" -e "s/^1 /1 00/g" -e "s/^2 /2 00/g" -e "s/^1 /1 0/g" -e "s/^2 /2 0/g" kepler.tle # Create TLE bulk file -#cat classfd.tle catalog.tle kepler.tle >bulk.tle -cat classfd.tle catalog.tle >bulk.tle -cat bulk.tle | grep -e "^1 " | awk '{if ($2<80000 || $2>99000) printf("%s %s\n",$2,$3)}' | sort | uniq >$ST_DATADIR/data/desig.txt +cat classfd.tle catalog.tle kepler.tle >bulk.tle +#cat classfd.tle catalog.tle >bulk.tle +cat bulk.tle | grep -e "^1 " | awk '{if ($2<80000 || $2>99000) printf("%05d %s\n",$2,$3)}' | sort | uniq >$ST_DATADIR/data/desig.txt