@@ -1,9 +1,9 @@ | |||
#!/bin/sh | |||
#!/bin/bash | |||
## debug | |||
# set -x | |||
## import common lib | |||
. ~/common.sh | |||
. ~/.noaa.conf | |||
find ${NOAA_HOME}/map/ -type f -name '*.png' -mtime +2 -exec rm -f {} \; | |||
find ${NOAA_OUTPUT}/audio/ -type f -name '*.wav' -mtime +2 -exec rm -f {} \; | |||
find "${NOAA_HOME}/map/" -type f -name '*.png' -mtime +1 -exec rm -f {} \; | |||
log "${NOAA_HOME}/map/ folder pruned" "INFO" | |||
find "${NOAA_OUTPUT}/audio/" -type f -name '*.wav' -mtime +1 -exec rm -f {} \; | |||
log "${NOAA_OUTPUT}/audio/ folder pruned" "INFO" |
@@ -1,44 +1,17 @@ | |||
#!/bin/sh | |||
#!/bin/bash | |||
## debug | |||
# set -x | |||
. ~/.noaa.conf | |||
## import common lib | |||
. ~/common.sh | |||
## sane checks | |||
if [ ! -d "${NOAA_HOME}" ]; then | |||
mkdir -p "${NOAA_HOME}" | |||
fi | |||
if [ ! -d "${NOAA_OUTPUT}" ]; then | |||
mkdir -p "${NOAA_OUTPUT}" | |||
fi | |||
if [ ! -d "${NOAA_AUDIO}/audio/" ]; then | |||
mkdir -p "${NOAA_AUDIO}/audio/" | |||
fi | |||
if [ ! -d "${NOAA_OUTPUT}/image/" ]; then | |||
mkdir -p "${NOAA_OUTPUT}/image/" | |||
fi | |||
if [ ! -d "${NOAA_HOME}/map/" ]; then | |||
mkdir -p "${NOAA_HOME}/map/" | |||
fi | |||
if [ ! -d "${NOAA_HOME}/predict/" ]; then | |||
mkdir -p "${NOAA_HOME}/predict/" | |||
fi | |||
#if pgrep "stream_fm" > /dev/null | |||
#then | |||
# pkill -9 -f stream_fm | |||
# pkill -9 -f rtl_fm | |||
# pkill -9 -f socat | |||
#fi | |||
## pass start timestamp and sun elevation | |||
PASS_START=$(expr "$5" + 90) | |||
SUN_ELEV=$(python3 sun.py "$PASS_START") | |||
if pgrep "rtl_fm" > /dev/null | |||
then | |||
log "There is an existing rtl_fm instance running, I quit" "ERROR" | |||
exit 1 | |||
fi | |||
@@ -50,14 +23,8 @@ fi | |||
# $6 = Time to capture | |||
# $7 = Satellite max elevation | |||
START_DATE=$(date '+%d-%m-%Y %H:%M') | |||
FOLDER_DATE="$(date +%Y)/$(date +%m)/$(date +%d)" | |||
timeout "${6}" /usr/local/bin/rtl_fm -f "${2}"M -s 60k -g 50 -p 55 -E wav -E deemp -F 9 - | /usr/bin/sox -t raw -e signed -c 1 -b 16 -r 60000 - "${NOAA_AUDIO}/audio/${3}.wav" rate 11025 | |||
sudo renice -19 -p "$(pidof rtl_fm)" | |||
PASS_START=$(expr "$5" + 90) | |||
SUN_ELEV=$(python3 sun.py "$PASS_START") | |||
if [ ! -d "{NOAA_OUTPUT}/image/${FOLDER_DATE}" ]; then | |||
mkdir -p "${NOAA_OUTPUT}/image/${FOLDER_DATE}" | |||
fi | |||
@@ -1,42 +1,21 @@ | |||
#!/bin/sh | |||
#!/bin/bash | |||
## debug | |||
# set -x | |||
## import common lib | |||
. ~/common.sh | |||
. ~/.noaa.conf | |||
## pass start timestamp and sun elevation | |||
PASS_START=$(expr "$5" + 90) | |||
SUN_ELEV=$(python3 sun.py "$PASS_START") | |||
## sane checks | |||
if [ ! -d "${NOAA_HOME}" ]; then | |||
mkdir -p "${NOAA_HOME}" | |||
fi | |||
if [ ! -d "${NOAA_OUTPUT}" ]; then | |||
mkdir -p "${NOAA_OUTPUT}" | |||
fi | |||
if [ ! -d "${METEOR_OUTPUT}" ]; then | |||
mkdir -p "${METEOR_OUTPUT}" | |||
fi | |||
if [ ! -d "${NOAA_AUDIO}/audio/" ]; then | |||
mkdir -p "${NOAA_AUDIO}/audio/" | |||
fi | |||
if [ ! -d "${NOAA_OUTPUT}/image/" ]; then | |||
mkdir -p "${NOAA_OUTPUT}/image/" | |||
fi | |||
if [ ! -d "${NOAA_HOME}/map/" ]; then | |||
mkdir -p "${NOAA_HOME}/map/" | |||
fi | |||
if [ ! -d "${NOAA_HOME}/predict/" ]; then | |||
mkdir -p "${NOAA_HOME}/predict/" | |||
if [ "${SUN_ELEV}" -lt "${SUN_MIN_ELEV}" ]; then | |||
log "Sun elev is too low. Meteor IR radiometers are not working" "INFO" | |||
exit 0 | |||
fi | |||
if pgrep "rtl_fm" > /dev/null | |||
then | |||
exit 1 | |||
log "There is an already running rtl_fm instance but I dont care for now, I prefer this pass" "INFO" | |||
pkill -9 -f rtl_fm | |||
fi | |||
# $1 = Satellite Name | |||
@@ -47,28 +26,34 @@ fi | |||
# $6 = Time to capture | |||
# $7 = Satellite max elevation | |||
START_DATE=$(date '+%d-%m-%Y %H:%M') | |||
FOLDER_DATE="$(date +%Y)/$(date +%m)/$(date +%d)" | |||
if [ ! -d "${NOAA_OUTPUT}/image/${FOLDER_DATE}" ]; then | |||
mkdir -p "${NOAA_OUTPUT}/image/${FOLDER_DATE}" | |||
fi | |||
timeout 660 /usr/local/bin/rtl_fm -M raw -f 137.1M -s 288k -g 48 -p 1 | sox -t raw -r 288k -c 2 -b 16 -e s - -t wav "${NOAA_AUDIO}/audio/${3}.wav" rate 96k | |||
log "Starting rtl_fm record" "INFO" | |||
timeout "${6}" /usr/local/bin/rtl_fm -M raw -f "${2}"M -s 288k -g 48 -p 1 | sox -t raw -r 288k -c 2 -b 16 -e s - -t wav "${NOAA_AUDIO}/audio/${3}.wav" rate 96k | |||
log "Normalization in progress" "INFO" | |||
sox "${NOAA_AUDIO}/audio/${3}.wav" "${METEOR_OUTPUT}/${3}.wav" gain -n | |||
rm "${NOAA_AUDIO}/audio/${3}.wav" | |||
log "Demodulation in progress (QPSK)" "INFO" | |||
meteor_demod -B -o "${METEOR_OUTPUT}/${3}.qpsk" "${METEOR_OUTPUT}/${3}.wav" | |||
rm "${METEOR_OUTPUT}/${3}.wav" | |||
log "Decoding in progress (QPSK to BMP)" "INFO" | |||
medet_arm "${METEOR_OUTPUT}/${3}.qpsk" "${METEOR_OUTPUT}/${3}" -cd | |||
rm "${METEOR_OUTPUT}/${3}.qpsk" | |||
if [ -f "${METEOR_OUTPUT}/${3}.dec" ]; then | |||
log "I got a successful ${3}.dec file. Creating false color image" "INFO" | |||
medet_arm "${METEOR_OUTPUT}/${3}.dec" "${METEOR_OUTPUT}/${3}-122" -r 65 -g 65 -b 64 -d | |||
convert "${METEOR_OUTPUT}/${3}-122.bmp" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg" | |||
log "Rectifying image to adjust aspect ratio" "INFO" | |||
python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg" | |||
rm "${METEOR_OUTPUT}/${3}-122.bmp" | |||
python3 "${NOAA_HOME}/post.py" "$1 EXPERIMENTAL ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg" | |||
rm "${METEOR_OUTPUT}/${3}.bmp" | |||
log "Posting to Twitter" "INFO" | |||
python3 "${NOAA_HOME}/post.py" "$1 EXPERIMENTAL ${START_DATE} Resolución completa: http://weather.reyni.co/image/${FOLDER_DATE}/${3}-122-rectified.jpg" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg" | |||
else | |||
log "Decoding failed, either a bad pass/low SNR or a software problem" "ERROR" | |||
fi | |||
@@ -1,9 +1,7 @@ | |||
#!/bin/sh | |||
#!/bin/bash | |||
## debug | |||
#set -x | |||
. ~/.noaa.conf | |||
## import common lib | |||
. ~/common.sh | |||
wget -qr http://www.celestrak.com/NORAD/elements/weather.txt -O "${NOAA_HOME}"/predict/weather.txt | |||
wget -qr http://www.celestrak.com/NORAD/elements/amateur.txt -O "${NOAA_HOME}"/predict/amateur.txt | |||
@@ -1,27 +1,25 @@ | |||
#!/bin/sh | |||
#!/bin/bash | |||
## debug | |||
# set -x | |||
. ~/.noaa.conf | |||
## import common lib | |||
. ~/common.sh | |||
PREDICTION_START=$(/usr/bin/predict -t "${NOAA_HOME}"/predict/weather.tle -p "${1}" | head -1) | |||
PREDICTION_END=$(/usr/bin/predict -t "${NOAA_HOME}"/predict/weather.tle -p "${1}" | tail -1) | |||
var2=$(echo "${PREDICTION_END}" | cut -d " " -f 1) | |||
MAXELEV=$(/usr/bin/predict -t "${NOAA_HOME}"/predict/weather.tle -p "${1}" | awk -v max=0 '{if($5>max){max=$5}}END{print max}') | |||
while [ "$(date --date="@${var2}" +%D)" = "$(date +%D)" ]; do | |||
log "Pass prediction in progress" "INFO" | |||
START_TIME=$(echo "$PREDICTION_START" | cut -d " " -f 3-4) | |||
var1=$(echo "$PREDICTION_START" | cut -d " " -f 1) | |||
var3=$(echo "$START_TIME" | cut -d " " -f 2 | cut -d ":" -f 3) | |||
TIMER=$(expr "${var2}" - "${var1}" + "${var3}") | |||
OUTDATE=$(date --date="TZ=\"UTC\" ${START_TIME}" +%Y%m%d-%H%M%S) | |||
if [ "${MAXELEV}" -gt "${METEOR_MIN_ELEV}" ] | |||
then | |||
if [ "${MAXELEV}" -gt "${METEOR_MIN_ELEV}" ]; then | |||
log "Pass is above ${METEOR_MIN_ELEV}, that is OK for me" "INFO" | |||
SATNAME=$(echo "$1" | sed "s/ //g") | |||
echo "${SATNAME}" "${OUTDATE}" "$MAXELEV" | |||
echo "${NOAA_HOME}/receive_meteor.sh \"${1}\" $2 ${SATNAME}${OUTDATE} "${NOAA_HOME}"/predict/weather.tle \ | |||
@@ -1,14 +1,19 @@ | |||
#!/bin/sh | |||
#!/bin/bash | |||
## debug | |||
# set -x | |||
## import common lib | |||
. ~/common.sh | |||
. ~/.noaa.conf | |||
# $1 = Satellite Name | |||
# $2 = Frequency | |||
# $3 = FileName base | |||
# $4 = TLE File | |||
# $5 = EPOC start time | |||
# $6 = Time to capture | |||
# $7 = Satellite max elevation | |||
PREDICTION_START=$(/usr/bin/predict -t "${NOAA_HOME}"/predict/weather.tle -p "${1}" | head -1) | |||
PREDICTION_END=$(/usr/bin/predict -t "${NOAA_HOME}"/predict/weather.tle -p "${1}" | tail -1) | |||
var2=$(echo "${PREDICTION_END}" | cut -d " " -f 1) | |||
MAXELEV=$(/usr/bin/predict -t "${NOAA_HOME}"/predict/weather.tle -p "${1}" | awk -v max=0 '{if($5>max){max=$5}}END{print max}') | |||
@@ -20,8 +25,7 @@ while [ "$(date --date="@${var2}" +%D)" = "$(date +%D)" ]; do | |||
TIMER=$(expr "${var2}" - "${var1}" + "${var3}") | |||
OUTDATE=$(date --date="TZ=\"UTC\" ${START_TIME}" +%Y%m%d-%H%M%S) | |||
if [ "${MAXELEV}" -gt "${SAT_MIN_ELEV}" ] | |||
then | |||
if [ "${MAXELEV}" -gt "${SAT_MIN_ELEV}" ]; then | |||
SATNAME=$(echo "$1" | sed "s/ //g") | |||
echo "${SATNAME}" "${OUTDATE}" "$MAXELEV" | |||
echo "${NOAA_HOME}/receive.sh \"${1}\" $2 ${SATNAME}${OUTDATE} "${NOAA_HOME}"/predict/weather.tle \ | |||