satpredictor/render.sh

56 lines
1.9 KiB
Bash
Raw Normal View History

2017-02-05 06:36:38 +01:00
#!/bin/bash
2017-02-19 03:50:34 +01:00
#render_options=("ZA" "HVCT" "NO")
render_options=("HVCT")
render_options_night=("MCIR")
direction=${f:(-7):(-6)}
echo $1
#remove the directory structure from the first argument
2017-02-20 01:53:28 +01:00
f1="${1:0:(-4)}"
file="${f1#'/tmp/'}"
2017-02-19 03:50:34 +01:00
#Isolate data values from filename file should begin with YYYYMMDD-HHMM
dyear=${file:(0):(4)}
dmonth=${file:(4):(2)}
dday=${file:(6):(2)}
dhour=${file:(9):(2)}
dminute=${file:(11):(2)}
#Convert file date to unix timestamp, probably don't have to do this but I am.
unixtimestamp=$(date --date="${dyear}/${dmonth}/${dday} ${dhour}:${dminute}" +%s)
#Debug, make sure the file stripper works
echo "${dyear}/${dmonth}/${dday} ${dhour}:${dminute} /" $unixtimestamp
#Render options for all NOAA satellites in orbit
#Put a big cross on receiver's location
#-gRSCFH are for turning on/off the overlays such as long/lat, cities, lakes, borders, etc.
#-H selects the TLE file
#-o is when the satellite is overhead forward one minute from the filename just to ensure that the predictor wxmap uses agrees with the pypredict predictor
wxmap -T "NOAA 15" -T "NOAA 18" -T "NOAA 19" -n "Vancouver,Canada" -c l:0xff000 -g 0 -R 0 -S 1 -C 1 -F 0 -H ~/satellites/weather.txt -o $(($unixtimestamp+60)) /tmp/passmap.png
2017-02-19 03:50:34 +01:00
#If pass is at night time render differently for daytime.
if [[ ${dhour#0} -le 8 ]] || [[ ${dhour#0} -ge 17 ]] #the funny code is to ensure things are translated into base 10.
2017-02-19 03:50:34 +01:00
then
echo "Pass is at night"
for r in "${render_options_night[@]}"
do
echo "Now rendering option: ${r}"
2017-02-20 01:46:32 +01:00
wxtoimg -e $r -ocK -m /tmp/passmap.png /tmp/$file /tmp/$file"_${r}".png
2017-02-19 03:50:34 +01:00
done
else
echo "Pass is in sun"
for r in "${render_options[@]}"
do
echo "Now rendering option: ${r}"
2017-02-20 01:46:32 +01:00
wxtoimg -e $r -ocK -m /tmp/passmap.png /tmp/$file /tmp/$file"_${r}".png
2017-02-19 03:50:34 +01:00
done
fi
#Upload.
bash ~/satellites/ftp.sh /tmp/$file"_${r}".png