@@ -227,7 +227,7 @@ read -rp "Enter your timezone (Ex: -3 for Argentina time): " | |||
sed -i -e "s/change_latitude/${lat}/g;s/change_longitude/${lon}/g" "$HOME/.noaa.conf" | |||
sed -i -e "s/change_latitude/${lat}/g;s/change_longitude/${lon}/g" "$HOME/.wxtoimgrc" | |||
sed -i -e "s/change_latitude/${lat}/g;s/change_longitude/$(echo "$lon * -1" | bc)/g" "$HOME/.predict/predict.qth" | |||
sed -i -e "s/change_latitude/${lat}/g;s/change_longitude/${lon}/g;s/change_tz/${timezone}/g" "sun.py" | |||
sed -i -e "s/change_latitude/${lat}/g;s/change_longitude/${lon}/g;s/change_tz/$(echo "$timezone * -1" | bc)/g" "sun.py" | |||
# Running WXTOIMG to have the user accept the licensing agreement | |||
wxtoimg | |||
@@ -42,20 +42,18 @@ log "Bulding pass map" "INFO" | |||
/usr/local/bin/wxmap -T "${1}" -H "${4}" -p 0 -l 0 -o "${PASS_START}" "${NOAA_HOME}/map/${3}-map.png" | |||
for i in $ENHANCEMENTS; do | |||
log "Decoding image" "INFO" | |||
/usr/local/bin/wxtoimg -o -m "${NOAA_HOME}/map/${3}-map.png" -e "$i" "${RAMFS_AUDIO}/audio/${3}.wav" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.png" | |||
/usr/bin/convert "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.png" -undercolor black -fill yellow -pointsize 18 -annotate +20+20 "${1} $i ${START_DATE} Elevation: $7°" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.png" | |||
/usr/local/bin/wxtoimg -o -m "${NOAA_HOME}/map/${3}-map.png" -e "$i" "${RAMFS_AUDIO}/audio/${3}.wav" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg" | |||
/usr/bin/convert -quality 90 -format jpg "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg" -undercolor black -fill yellow -pointsize 18 -annotate +20+20 "${1} $i ${START_DATE}" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg" | |||
done | |||
if [ -n "$CONSUMER_KEY" ]; then | |||
log "Posting to Twitter" "INFO" | |||
if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then | |||
python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR-precip.png" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MSA-precip.png" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-HVC-precip.png" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-HVCT-precip.png" | |||
python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MSA-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-HVC-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-HVCT-precip.jpg" | |||
else | |||
python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR-precip.png" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR.png" | |||
python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR.jpg" | |||
fi | |||
fi | |||
rm "${NOAA_HOME}/map/${3}-map.png" | |||
if [ "$DELETE_AUDIO" = true ]; then | |||
log "Deleting audio files" "INFO" | |||
rm "${RAMFS_AUDIO}/audio/${3}.wav" | |||
@@ -9,14 +9,7 @@ | |||
SYSTEM_MEMORY=$(free -m | awk '/^Mem:/{print $2}') | |||
if [ "$SYSTEM_MEMORY" -lt 2000 ]; then | |||
log "The system doesn't have enough space to store a Meteor pass on RAM" "INFO" | |||
RAMFS_AUDIO="${METEOR_OUTPUT}" | |||
fi | |||
if [ "$FLIP_METEOR_IMG" == "true" ]; then | |||
log "I'll flip this image pass because FLIP_METEOR_IMG is set to true" "INFO" | |||
FLIP="-rotate 180" | |||
else | |||
FLIP="" | |||
RAMFS_AUDIO="${METEOR_OUTPUT}" | |||
fi | |||
## pass start timestamp and sun elevation | |||
@@ -49,7 +42,7 @@ meteor_demod -B -o "${METEOR_OUTPUT}/${3}.qpsk" "${METEOR_OUTPUT}/${3}.wav" | |||
if [ "$DELETE_AUDIO" = true ]; then | |||
log "Deleting audio files" "INFO" | |||
rm "${METEOR_OUTPUT}/audio/${3}.wav" | |||
rm "${RAMFS_AUDIO}/audio/${3}.wav" | |||
rm "${RAMFS_AUDIO}/${3}.wav" | |||
fi | |||
log "Decoding in progress (QPSK to BMP)" "INFO" | |||
@@ -61,29 +54,23 @@ if [ -f "${METEOR_OUTPUT}/${3}.dec" ]; then | |||
if [ "${SUN_ELEV}" -lt "${SUN_MIN_ELEV}" ]; then | |||
log "I got a successful ${3}.dec file. Decoding APID 68" "INFO" | |||
medet_arm "${METEOR_OUTPUT}/${3}.dec" "${METEOR_OUTPUT}/${3}-122" -r 68 -g 68 -b 68 -d | |||
convert "${METEOR_OUTPUT}/${3}-122.bmp" -channel RGB -negate $FLIP "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.png" | |||
medet_arm "${METEOR_OUTPUT}/${3}.dec" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122" -r 68 -g 68 -b 68 -d | |||
/usr/bin/convert -rotate 180 "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.bmp" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.bmp" | |||
else | |||
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.png" | |||
medet_arm "${METEOR_OUTPUT}/${3}.dec" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122" -r 65 -g 65 -b 64 -d | |||
fi | |||
log "Rectifying image to adjust aspect ratio" "INFO" | |||
python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.png" | |||
convert "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.png" -undercolor black -fill yellow -pointsize 18 -annotate +20+20 "${1} ${START_DATE} Elevacion: $7°" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified-text.png" | |||
python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.bmp" | |||
convert "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg" -channel rgb -normalize "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg" | |||
rm "${METEOR_OUTPUT}/${3}.bmp" | |||
rm "${METEOR_OUTPUT}/${3}-122.bmp" | |||
if [ -n "$CONSUMER_KEY" ]; then | |||
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-text.jpg" "$7°" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified-text.png" | |||
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" | |||
fi | |||
rm "${METEOR_OUTPUT}/${3}.bmp" | |||
rm "${METEOR_OUTPUT}/${3}-122.bmp" | |||
rm "${METEOR_OUTPUT}/${3}-122.png" | |||
rm "${METEOR_OUTPUT}/${3}.dec" | |||
rm "${METEOR_OUTPUT}/${3}-122.png" | |||
rm "${METEOR_OUTPUT}/${3}-122-rectified.png" | |||
rm "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.png" | |||
rm "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.png" | |||
#rm "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified-text.png" | |||
else | |||
log "Decoding failed, either a bad pass/low SNR or a software problem" "ERROR" | |||
fi |
@@ -8,7 +8,7 @@ from math import atan,sin,cos,sqrt,tan,acos,ceil | |||
from PIL import Image | |||
EARTH_RADIUS = 6371.0 | |||
SAT_HEIGHT = 830.0 | |||
SAT_HEIGHT = 822.5 | |||
SAT_ORBIT_RADIUS = EARTH_RADIUS + SAT_HEIGHT | |||
SWATH_KM = 2800.0 | |||
THETA_C = SWATH_KM / EARTH_RADIUS | |||
@@ -180,4 +180,4 @@ if __name__ == "__main__": | |||
# It's a dead pool now | |||
p.join() | |||
rectified_img.save(out_fname + ".png", "PNG") | |||
rectified_img.save(out_fname + ".jpg", "JPEG", quality=90) |
@@ -2,8 +2,8 @@ | |||
import ephem | |||
import time | |||
import sys | |||
timezone = change_tz + time.localtime().tm_isdst | |||
date = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(sys.argv[1])-(timezone*60*60))) | |||
timezone = change_tz | |||
date = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(sys.argv[1])+(timezone*60*60))) | |||
obs=ephem.Observer() | |||
obs.lat='change_latitude' | |||
@@ -1,7 +1,7 @@ | |||
NOAA_HOME=/home/pi/raspberry-noaa | |||
NOAA_OUTPUT=/var/www/wx | |||
METEOR_OUTPUT=/var/www/wx/meteor | |||
NOAA_AUDIO=/var/ramfs | |||
RAMFS_AUDIO=/var/ramfs | |||
SAT_MIN_ELEV=30 | |||
METEOR_MIN_ELEV=30 | |||
SUN_MIN_ELEV=10 | |||
@@ -9,5 +9,4 @@ LOG_LEVEL=DEBUG | |||
LAT=change_latitude | |||
LON=change_longitude | |||
BIAS_TEE="enable_bias_tee" | |||
DELETE_AUDIO="true" | |||
FLIP_METEOR_IMG="true" | |||
DELETE_AUDIO=true |