Auto Get JPL Ephemeris

A script was needed to get ephemeris data on a daily basis from JPL and to write the data out in individual files. In the good old days, one would visit https://ssd.jpl.nasa.gov/horizons.cgi and manually enter the required data to save out the file containing pointing data. The following was script was written and runs on a Raspberry PI:

command=$1
start_date=`date '+%C%y-%m-%d'`
end_date=`date '+%C%y-%m-%d' -d "$end_date+14 days"`
**coord**="SITE_COORD='e.eeeee,n.nnnnn,h.hhhhh'"
urlbase="https://ssd.jpl.nasa.gov/horizons_batch.cgi?batch=1&COMMAND='$command'&CENTER='coord'&$coord&MAKE_EPHEM='YES'&TABLE_TYPE='OBS'&STEP_SIZE='60%20m'&CAL_FORMAT='CAL'&TIME_DIGITS='MINUTES'&ANG_FORMAT='HMS'&OUT_UNITS='KM-S'&RANGE_UNITS='KM'&APPARENT='AIRLESS'&SOLAR_ELONG='0,180'&SUPPRESS_RANGE_RATE='NO'&SKIP_DAYLT='NO'&REF_SYSTEM='J2000'&CSV_FORMAT='YES'&OBJ_DATA='YES'&QUANTITIES='2,3,4,20'&START_TIME='$start_date%2000:00'&STOP_TIME='$end_date%2023:59'&REF_PLANE='ECLIPTIC'&COORD_TYPE='GEODETIC'&AIRMASS='38.0'&EXTRA_PREC='NO'&ELM_LABELS='YES'&TP_TYPE='ABSOLUTE'&R_T_S_ONLY='NO'&CA_TABLE_TYPE='STANDARD'&TCA3SG_LIMIT='14400'&CALIM_SB='0.1'&CALIM_PL='.1,.1,.1,.1,1.0,1.0,1.0,1.0,.1,.003'"
sleep 5
curl -s -k $urlbase -o /home/pi/ephemeris/tempeph.txt
select="["$command"]"
objname=`cat objects.lst |grep -Fw -- $select|awk {'print $3'}`
file="/home/pi/ephemeris/$objname$command"_60m".txt"
awk 'sub("$", "\r")' /home/pi/ephemeris/tempeph.txt > $file
chmod 666 $file
rm /home/pi/ephemeris/tempeph.txt

The coord line should be modified with your lat/long/height info in decimal, for example SITE_COORD='3.123,52.525,100.9998'. The script should be called via cron and will deliver the files into the directory /home/pi/ephemeris

The objects.lst file contains a list of spacecraft and their JPL ID's:

-1 [-1] Ceres
-82 [-82] Cassini
-203 [-203] Dawn
-140 [-140] EPOXI
-143 [-143] ExoMars_TGO
-139479 [-139479] Gaia
-130 [-130] Hayabusa
-37 [-37] Hayabusa2
-170 [-170] James_Webb_Space_Telescope
-61 [-61] Juno
-227 [-227] Kepler
-202 [-202] MAVEN
-41 [-41] Mars_Express
-53 [-53] Mars_Odyssey
-3 [-3] Mars_Orbiter_Mission
-74 [-74] MRO
-98 [-98] New_Horizons
-64 [-64] OSIRIS-REx
-5 [-5] Planet-C
-234 [-234] STEREO-A
-235 [-235] STEREO-B
-557 [-557] Spektr-R
-79 [-79] Spitzer
-31 [-31] Voyager1
-32 [-32] Voyager2
10 [10] Sun
199 [199] Mercury
299 [299] Venus
499 [499] Mars
599 [599] Jupiter
699 [699] Saturn
799 [799] Uranus
899 [899] Neptune
999 [999] Pluto

On executing the script, output files will be built as follows; these can then be directly accessed by your tracking software to point your antenna at DSN objects.

Ephemeris output

If you update or simplify this script to make getting JPL Ephemeris data great again, please let me know.

{{ message }}

{{ 'Comments are closed.' | trans }}