1
0
Fork 0

Replace st_get.sh with tleupdate

This commit removes the oudated version of st_get.sh and replaces it
with `tleupdate` from strf. This simplifies maintainance (buth repos
use the same tleupdate script now) and makes the fixes from `tleupdate`
available in sattools.
pull/18/head
Fabian P. Schmidt 2019-09-02 12:15:24 +02:00
parent 7640bba06f
commit 1def2f53c9
3 changed files with 72 additions and 41 deletions

View File

@ -29,12 +29,13 @@ Install
Run notes
---------
* You will need to set the following environment variables to run sattools.
These vars are set with default values after running install_sattolls.sh.
`ST_COSPAR` COSPAR number
`ST_DATADIR` path to sattools directory
`ST_TLEDIR` path to TLE directory
`ST_OBSDIR` path to observations directory
* You will need to set the following environment variables to run **sattools**.
* `ST_COSPAR` COSPAR number
* `ST_DATADIR` path to sattools directory
* `ST_TLEDIR` path to TLE directory
* `ST_OBSDIR` path to observations directory
* `ST_LOGIN` space-track.org login info (of the form `ST_LOGIN="identity=username&password=password"`)
These variables are set with default values after running install_sattools.sh (except `ST_LOGIN`).
* If you have multiple capture devices you will need to add a /etc/udev/rules.d/99-server.rules file to add symlinks and use them to
address a particular camera. Sattools will automatically select the camera that is scheduled for each observation.
You may use a command such as 'udevadm info -a -n /dev/video0' to get your capture device attributes and
@ -44,7 +45,6 @@ Run notes
and copied to /etc/udev/rules.d/
* You should install NTP support on the system and configure time/date to automatically
sinchronize to time servers.
* Modify stget.sh for your space-track.org login and password (--post-data='identity=login&password=password')
Tools
-----
@ -93,3 +93,10 @@ Tools
```
launchtle -c prelaunch.tle -i 70002 -t 2018-11-11T03:00:00 -T 2018-11-11T05:00:00 -I 70003
```
* `tleupdate`: Update the local database of TLEs from various
sources (Space-Track, inttles and classfd.zip).
Usage:
```
tleupdate
```

View File

@ -1,34 +0,0 @@
#!/bin/bash
# Get date
DATE=`date +%Y%m%d_%H%M%S`
# Get cookie
wget --post-data='identity=yourlogin&password=yourpassword' --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 $ST_TLEDIR/catalog.tle
dos2unix $ST_TLEDIR/catalog.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" $ST_TLEDIR/catalog.tle
cp $ST_TLEDIR/catalog.tle $ST_TLEDIR/${DATE}_catalog.txt
# Get classfd
wget http://www.prismnet.com/~mmccants/tles/classfd.zip --no-check-certificate -O $ST_TLEDIR/classfd.zip
unzip -o $ST_TLEDIR/classfd.zip
dos2unix $ST_TLEDIR/classfd.tle
cp $ST_TLEDIR/classfd.tle $ST_TLEDIR/${DATE}_classfd.txt
#mv $HOME/classfd.tle $ST_TLEDIR/classfd.tle
rm $ST_TLEDIR/classfd.zip
# Get inttles
wget http://www.prismnet.com/~mmccants/tles/inttles.zip --no-check-certificate -O $ST_TLEDIR/inttles.zip
unzip -o $ST_TLEDIR/inttles.zip
dos2unix $ST_TLEDIR/inttles.tle
cp $ST_TLEDIR/inttles.tle $ST_TLEDIR/${DATE}_inttles.txt
#mv $HOME/inttles.tle $ST_TLEDIR/inttles.tle
rm $ST_TLEDIR/inttles.zip
#rm $HOME/login
# Create bulk file
cat $ST_TLEDIR/classfd.tle $ST_TLEDIR/catalog.tle >$ST_TLEDIR/bulk.tle

58
tleupdate 100755
View File

@ -0,0 +1,58 @@
#!/bin/bash
# Check if TLE directory exists
if [ ! -d $ST_TLEDIR ]; then
mkdir -p $ST_TLEDIR
fi
# Goto TLE dir
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 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
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
dos2unix classfd.tle
cp classfd.tle ${DATE}_classfd.txt
rm classfd.zip
# Get inttles
wget http://www.prismnet.com/~mmccants/tles/inttles.zip --no-check-certificate -O inttles.zip
unzip -o inttles.zip
dos2unix inttles.tle
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
# 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