From 7f6a815b246381602bf1693e030874d22354f9f3 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sat, 3 Oct 2020 13:39:59 -0300 Subject: [PATCH 01/29] enable meteor m2 night passes --- receive_meteor.sh | 22 ++++++++++++++++------ rectify.py | 30 ++++++++++++++++++++---------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/receive_meteor.sh b/receive_meteor.sh index 52d99d1..ee81fa4 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -9,11 +9,6 @@ PASS_START=$(expr "$5" + 90) SUN_ELEV=$(python3 "$NOAA_HOME"/sun.py "$PASS_START") -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 log "There is an already running rtl_fm instance but I dont care for now, I prefer this pass" "INFO" @@ -49,7 +44,22 @@ 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" + 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 65 -g 65 -b 68 -s -d + convert "${METEOR_OUTPUT}/${3}-122_0.bmp" "${NOAA_OUTPUT}/images/${3}-122.jpg" + python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg" + rm "${METEOR_OUTPUT}/${3}-122_1.bmp" + rm "${METEOR_OUTPUT}/${3}-122_2.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}/images/${3}-122.jpg" + rm "${METEOR_OUTPUT}/${3}-122.bmp" + rm "${METEOR_OUTPUT}/${3}.bmp" + log "Rectifying image to adjust aspect ratio" "INFO" + python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/images/${3}-122.jpg" + fi 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" diff --git a/rectify.py b/rectify.py index 1b95e82..c20ba43 100755 --- a/rectify.py +++ b/rectify.py @@ -73,11 +73,16 @@ def wthread(rectified_width, corr, endrow, startrow): # Linearly interpolate for i in range(delta): - interp_r = int((start_px[0]*(delta-i) + end_px[0]*i) / delta) - interp_g = int((start_px[1]*(delta-i) + end_px[1]*i) / delta) - interp_b = int((start_px[2]*(delta-i) + end_px[2]*i) / delta) - - rectified_pixels[cur_col, row] = (interp_r, interp_g, interp_b) + # For night passes of Meteor the image is just gray level and + # start_px and end_px being an int instead of a tuple + if type(start_px) != int: + interp_r = int((start_px[0]*(delta-i) + end_px[0]*i) / delta) + interp_g = int((start_px[1]*(delta-i) + end_px[1]*i) / delta) + interp_b = int((start_px[2]*(delta-i) + end_px[2]*i) / delta) + rectified_pixels[cur_col,row] = (interp_r, interp_g, interp_b) + else: + interp = int((start_px*(delta-i) + end_px*i) / delta) + rectified_pixels[cur_col,row] = interp cur_col += 1 start_px = end_px @@ -94,11 +99,16 @@ def wthread(rectified_width, corr, endrow, startrow): # Linearly interpolate for i in range(delta): - interp_r = int((start_px[0]*(delta-i) + end_px[0]*i) / delta) - interp_g = int((start_px[1]*(delta-i) + end_px[1]*i) / delta) - interp_b = int((start_px[2]*(delta-i) + end_px[2]*i) / delta) - - rectified_pixels[cur_col, row] = (interp_r, interp_g, interp_b) + # For night passes of Meteor the image is just gray level and + # start_px and end_px being an int instead of a tuple + if type(start_px) != int: + interp_r = int((start_px[0]*(delta-i) + end_px[0]*i) / delta) + interp_g = int((start_px[1]*(delta-i) + end_px[1]*i) / delta) + interp_b = int((start_px[2]*(delta-i) + end_px[2]*i) / delta) + rectified_pixels[cur_col,row] = (interp_r, interp_g, interp_b) + else: + interp = int((start_px*(delta-i) + end_px*i) / delta) + rectified_pixels[cur_col,row] = interp cur_col -= 1 start_px = end_px From 3a403eb8632577b4ce820093bf6349fde0c650f8 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sat, 3 Oct 2020 13:46:34 -0300 Subject: [PATCH 02/29] do not split the image --- receive_meteor.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/receive_meteor.sh b/receive_meteor.sh index ee81fa4..dd3ee78 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -46,11 +46,10 @@ rm "${METEOR_OUTPUT}/${3}.qpsk" 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 65 -g 65 -b 68 -s -d - convert "${METEOR_OUTPUT}/${3}-122_0.bmp" "${NOAA_OUTPUT}/images/${3}-122.jpg" + medet_arm "${METEOR_OUTPUT}/${3}.dec" "${METEOR_OUTPUT}/${3}-122" -r 68 -g 68 -b 68 -d + convert "${METEOR_OUTPUT}/${3}-122.bmp" "${NOAA_OUTPUT}/images/${3}-122.jpg" python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg" - rm "${METEOR_OUTPUT}/${3}-122_1.bmp" - rm "${METEOR_OUTPUT}/${3}-122_2.bmp" + rm "${METEOR_OUTPUT}/${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 From 5c6e96cd3d655ea753e9783e78fd9d4a31cec657 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sat, 3 Oct 2020 13:53:47 -0300 Subject: [PATCH 03/29] delete old code block --- receive_meteor.sh | 9 --------- 1 file changed, 9 deletions(-) diff --git a/receive_meteor.sh b/receive_meteor.sh index dd3ee78..5ec2e37 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -59,15 +59,6 @@ if [ -f "${METEOR_OUTPUT}/${3}.dec" ]; then log "Rectifying image to adjust aspect ratio" "INFO" python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/images/${3}-122.jpg" fi - 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" - convert "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg" -channel rgb -normalize "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg" - log "Deleting base image files" "INFO" - rm "${METEOR_OUTPUT}/${3}-122.bmp" - rm "${METEOR_OUTPUT}/${3}.bmp" - rm "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg" 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.jpg" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg" From e1b819bcc08e5ae294d78412abf610ef161c64c7 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sat, 3 Oct 2020 13:56:54 -0300 Subject: [PATCH 04/29] delete old code block --- receive_meteor.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/receive_meteor.sh b/receive_meteor.sh index 5ec2e37..511a775 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -47,17 +47,17 @@ 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" "${NOAA_OUTPUT}/images/${3}-122.jpg" + convert "${METEOR_OUTPUT}/${3}-122.bmp" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg" python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg" rm "${METEOR_OUTPUT}/${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}/images/${3}-122.jpg" + convert "${METEOR_OUTPUT}/${3}-122.bmp" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg" rm "${METEOR_OUTPUT}/${3}-122.bmp" rm "${METEOR_OUTPUT}/${3}.bmp" log "Rectifying image to adjust aspect ratio" "INFO" - python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/images/${3}-122.jpg" + python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg" fi if [ -n "$CONSUMER_KEY" ]; then log "Posting to Twitter" "INFO" From 6ffbd14682c2e5b0a65a06830693fdc311a8e134 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sat, 3 Oct 2020 13:58:36 -0300 Subject: [PATCH 05/29] Tidy-up if block --- receive_meteor.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/receive_meteor.sh b/receive_meteor.sh index 511a775..f34688f 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -44,21 +44,21 @@ medet_arm "${METEOR_OUTPUT}/${3}.qpsk" "${METEOR_OUTPUT}/${3}" -cd rm "${METEOR_OUTPUT}/${3}.qpsk" 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" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg" - python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg" - rm "${METEOR_OUTPUT}/${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.jpg" - rm "${METEOR_OUTPUT}/${3}-122.bmp" - rm "${METEOR_OUTPUT}/${3}.bmp" - log "Rectifying image to adjust aspect ratio" "INFO" - python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg" fi + + 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}.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.jpg" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg" From c842323a22c4f89d4b95fc805df75ca0b115d465 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sat, 3 Oct 2020 16:57:22 -0300 Subject: [PATCH 06/29] Rectify: save one step --- receive_meteor.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/receive_meteor.sh b/receive_meteor.sh index f34688f..34b7862 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -53,9 +53,8 @@ if [ -f "${METEOR_OUTPUT}/${3}.dec" ]; then medet_arm "${METEOR_OUTPUT}/${3}.dec" "${METEOR_OUTPUT}/${3}-122" -r 65 -g 65 -b 64 -d fi - 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" + python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.bmp" rm "${METEOR_OUTPUT}/${3}.bmp" rm "${METEOR_OUTPUT}/${3}-122.bmp" From a757583f9cd0480a3ac7e3ca3c7bbdac92abf6b5 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sat, 3 Oct 2020 21:05:45 -0300 Subject: [PATCH 07/29] make more space on ramfs partition for meteor passes --- templates/fstab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/fstab b/templates/fstab index dbccb3a..023fb81 100644 --- a/templates/fstab +++ b/templates/fstab @@ -1 +1 @@ -tmpfs /var/ramfs tmpfs nodev,nosuid,size=100M 0 0 +tmpfs /var/ramfs tmpfs nodev,nosuid,size=400M 0 0 From 128aedac2612fb166e0792596037bf1c52d3a6e3 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sat, 3 Oct 2020 22:06:16 -0300 Subject: [PATCH 08/29] replace shebang --- schedule_iss.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/schedule_iss.sh b/schedule_iss.sh index 67e4b16..6660d0c 100755 --- a/schedule_iss.sh +++ b/schedule_iss.sh @@ -1,10 +1,12 @@ -#!/bin/sh +#!/bin/bash ## debug # set -x -. ~/.noaa.conf -. "${NOAA_HOME}"/common.sh +## import common lib +. "$HOME/.noaa.conf" +. "$NOAA_HOME/common.sh" + SAT_MIN_ELEV=10 PREDICTION_START=$(/usr/bin/predict -t "${NOAA_HOME}"/predict/amateur.tle -p "${1}" | head -1) From 5504e18588e6e6c04f0a69c7dd9e979d62b0a6d0 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sat, 3 Oct 2020 22:26:31 -0300 Subject: [PATCH 09/29] fix image path --- receive_meteor.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/receive_meteor.sh b/receive_meteor.sh index 34b7862..3c1e29c 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -47,10 +47,10 @@ 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 + medet_arm "${METEOR_OUTPUT}/${3}.dec" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122" -r 68 -g 68 -b 68 -d 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 + 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" From 0733c045fcda781d91cc8eeb5c0f828d318be5c1 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sun, 4 Oct 2020 13:13:21 -0300 Subject: [PATCH 10/29] disable ramfs for meteor passes on <2Gi ram systems (cherry picked from commit 72f43265b5b929865c3d9696964cb06c9850f799) Signed-off-by: Nico Rey --- install.sh | 4 ++++ receive_meteor.sh | 7 +++++++ templates/fstab | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 742f6f1..5bbf2c0 100755 --- a/install.sh +++ b/install.sh @@ -182,6 +182,10 @@ fi log_done "Nginx configured" ### Setup ramFS +SYSTEM_MEMORY=$(free -m | awk '/^Mem:/{print $2}') +if [ "$SYSTEM_MEMORY" -lt 2000 ]; then + sed -i -e "s/1000M/200M/g" templates/fstab +fi set +e cat /etc/fstab | grep -q "ramfs" if [ $? -eq 0 ]; then diff --git a/receive_meteor.sh b/receive_meteor.sh index 3c1e29c..f9edefc 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -5,6 +5,13 @@ . "$HOME/.tweepy.conf" . "$NOAA_HOME/common.sh" + +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 + ## pass start timestamp and sun elevation PASS_START=$(expr "$5" + 90) SUN_ELEV=$(python3 "$NOAA_HOME"/sun.py "$PASS_START") diff --git a/templates/fstab b/templates/fstab index 023fb81..d76b2c0 100644 --- a/templates/fstab +++ b/templates/fstab @@ -1 +1 @@ -tmpfs /var/ramfs tmpfs nodev,nosuid,size=400M 0 0 +tmpfs /var/ramfs tmpfs nodev,nosuid,size=1000M 0 0 From 79d7a0975793267853b722e42e0cff148e0af7d4 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sun, 4 Oct 2020 13:14:30 -0300 Subject: [PATCH 11/29] disable ramfs for meteor passes on <2Gi ram systems --- receive_meteor.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/receive_meteor.sh b/receive_meteor.sh index f9edefc..f9098bc 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -31,10 +31,10 @@ fi # $7 = Satellite max elevation log "Starting rtl_fm record" "INFO" -timeout "${6}" /usr/local/bin/rtl_fm ${BIAS_TEE} -M raw -f "${2}"M -s 288k -g 48 -p 1 | sox -t raw -r 288k -c 2 -b 16 -e s - -t wav "${METEOR_OUTPUT}/audio/${3}.wav" rate 96k +timeout "${6}" /usr/local/bin/rtl_fm ${BIAS_TEE} -M raw -f "${2}"M -s 288k -g 48 -p 1 | sox -t raw -r 288k -c 2 -b 16 -e s - -t wav "${RAMFS_AUDIO}/audio/${3}.wav" rate 96k log "Normalization in progress" "INFO" -sox "${METEOR_OUTPUT}/audio/${3}.wav" "${METEOR_OUTPUT}/${3}.wav" gain -n +sox "${RAMFS_AUDIO}/audio/${3}.wav" "${METEOR_OUTPUT}/${3}.wav" gain -n log "Demodulation in progress (QPSK)" "INFO" meteor_demod -B -o "${METEOR_OUTPUT}/${3}.qpsk" "${METEOR_OUTPUT}/${3}.wav" @@ -42,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 "${METEOR_OUTPUT}/${3}.wav" + rm "${RAMFS_AUDIO}/${3}.wav" fi log "Decoding in progress (QPSK to BMP)" "INFO" From f1424cc9475d8c52352ab05c85c4eb5cebf351f8 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sun, 4 Oct 2020 19:36:36 -0300 Subject: [PATCH 12/29] Enable image enhancement --- receive_meteor.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/receive_meteor.sh b/receive_meteor.sh index f9098bc..42ecd35 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -62,6 +62,7 @@ if [ -f "${METEOR_OUTPUT}/${3}.dec" ]; then log "Rectifying image to adjust aspect ratio" "INFO" 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" From 6f7ce04c0242413528ef5266abc61f0ac192c037 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sun, 4 Oct 2020 19:54:00 -0300 Subject: [PATCH 13/29] Turn upside down night passes --- receive_meteor.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/receive_meteor.sh b/receive_meteor.sh index 42ecd35..1201c84 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -55,6 +55,7 @@ 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" "${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" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122" -r 65 -g 65 -b 64 -d From ab361f90f274c1663affe05fa031a2621d52cc6f Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Wed, 7 Oct 2020 21:03:49 -0300 Subject: [PATCH 14/29] Fix audio path --- common.sh | 4 ++-- receive.sh | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common.sh b/common.sh index b24f3dd..85af1c6 100755 --- a/common.sh +++ b/common.sh @@ -45,8 +45,8 @@ if [ ! -d "${METEOR_OUTPUT}/audio/" ]; then mkdir -m 775 -p "${METEOR_OUTPUT}/audio/" fi -if [ ! -d "${NOAA_AUDIO}/audio/" ]; then - mkdir -m 775 -p "${NOAA_AUDIO}/audio/" +if [ ! -d "${RAMFS_AUDIO}/audio/" ]; then + mkdir -m 775 -p "${RAMFS_AUDIO}/audio/" fi if [ ! -d "${NOAA_OUTPUT}/image/" ]; then diff --git a/receive.sh b/receive.sh index 084e581..11dcdb1 100755 --- a/receive.sh +++ b/receive.sh @@ -26,7 +26,7 @@ fi # $7 = Satellite max elevation log "Starting rtl_fm record" "INFO" -timeout "${6}" /usr/local/bin/rtl_fm ${BIAS_TEE} -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 +timeout "${6}" /usr/local/bin/rtl_fm ${BIAS_TEE} -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 - "${RAMFS_AUDIO}/audio/${3}.wav" rate 11025 if [ ! -d "{NOAA_OUTPUT}/image/${FOLDER_DATE}" ]; then mkdir -m 775 -p "${NOAA_OUTPUT}/image/${FOLDER_DATE}" @@ -42,7 +42,7 @@ 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" "${NOAA_AUDIO}/audio/${3}.wav" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg" + /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 @@ -56,8 +56,8 @@ fi if [ "$DELETE_AUDIO" = true ]; then log "Deleting audio files" "INFO" - rm "${NOAA_AUDIO}/audio/${3}.wav" + rm "${RAMFS_AUDIO}/audio/${3}.wav" else log "Moving audio files out of the SD card" "INFO" - mv "${NOAA_AUDIO}/audio/${3}.wav" "${NOAA_OUTPUT}/audio/${3}.wav" + mv "${RAMFS_AUDIO}/audio/${3}.wav" "${NOAA_OUTPUT}/audio/${3}.wav" fi From d21bcba550813cb140238c6356e122781e3400ac Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Fri, 9 Oct 2020 10:39:04 -0300 Subject: [PATCH 15/29] update template --- templates/noaa.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/noaa.conf b/templates/noaa.conf index f408711..fd188d1 100644 --- a/templates/noaa.conf +++ b/templates/noaa.conf @@ -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,4 +9,4 @@ LOG_LEVEL=DEBUG LAT=change_latitude LON=change_longitude BIAS_TEE="enable_bias_tee" -DELETE_AUDIO=true \ No newline at end of file +DELETE_AUDIO=true From af1772fb2ac8db499e60c1fac338e42b913e24e6 Mon Sep 17 00:00:00 2001 From: mihajlo2003petkovic Date: Wed, 14 Oct 2020 22:41:30 +0200 Subject: [PATCH 16/29] Invert nighttime Meteor M2 images. I've added piece of code to invert Meteor M2 images from nighttime pases (APID68 from IR sensor) so that clouds appear white and not black, text overlay (satellite name, timestamp and elevation) on Meteor M2 images like NOAA have, and deleting all intermediate images. --- receive_meteor.sh | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/receive_meteor.sh b/receive_meteor.sh index 1201c84..8276199 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -54,23 +54,29 @@ 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" "${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" + 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 "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.png" else log "I got a successful ${3}.dec file. Creating false color image" "INFO" - medet_arm "${METEOR_OUTPUT}/${3}.dec" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122" -r 65 -g 65 -b 64 -d + 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" fi - log "Rectifying image to adjust aspect ratio" "INFO" - 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" - + 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} Elevation: $7°" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified-text.png" 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.jpg" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg" + python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7°" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified-text.png" 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 From f3e950d7d14627e96ed008c9a0015bfd22593d60 Mon Sep 17 00:00:00 2001 From: mihajlo2003petkovic Date: Wed, 14 Oct 2020 22:42:11 +0200 Subject: [PATCH 17/29] Update receive_meteor.sh --- receive_meteor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receive_meteor.sh b/receive_meteor.sh index 8276199..ebbca7a 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -66,7 +66,7 @@ if [ -f "${METEOR_OUTPUT}/${3}.dec" ]; then convert "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.png" -undercolor black -fill yellow -pointsize 18 -annotate +20+20 "${1} ${START_DATE} Elevation: $7°" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified-text.png" if [ -n "$CONSUMER_KEY" ]; then log "Posting to Twitter" "INFO" - python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7°" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified-text.png" + python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7°" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified-text.png" fi rm "${METEOR_OUTPUT}/${3}.bmp" rm "${METEOR_OUTPUT}/${3}-122.bmp" From 123bd1b920ef78a393227aa6889157846e4e26e2 Mon Sep 17 00:00:00 2001 From: mihajlo2003petkovic Date: Wed, 14 Oct 2020 22:48:33 +0200 Subject: [PATCH 18/29] Added elevation on overlay and changed JPG to PNG I've added elevation on text overlay, changed all images from JPG to PNG in order to preserve whole resolution and added code to remove map image for overlay. --- receive.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/receive.sh b/receive.sh index 11dcdb1..2259f1a 100755 --- a/receive.sh +++ b/receive.sh @@ -42,18 +42,20 @@ 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.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" + /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" 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.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" + 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" else - 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" + 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" 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" From 06fd3cb3f1cfefdeaaad2e35e99e9741b0b83b89 Mon Sep 17 00:00:00 2001 From: mihajlo2003petkovic Date: Wed, 14 Oct 2020 22:52:12 +0200 Subject: [PATCH 19/29] Update receive_meteor.sh --- receive_meteor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receive_meteor.sh b/receive_meteor.sh index ebbca7a..cd77450 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -66,7 +66,7 @@ if [ -f "${METEOR_OUTPUT}/${3}.dec" ]; then convert "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.png" -undercolor black -fill yellow -pointsize 18 -annotate +20+20 "${1} ${START_DATE} Elevation: $7°" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified-text.png" if [ -n "$CONSUMER_KEY" ]; then log "Posting to Twitter" "INFO" - python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$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.png" fi rm "${METEOR_OUTPUT}/${3}.bmp" rm "${METEOR_OUTPUT}/${3}-122.bmp" From 4f568b3141f75e23ffd4d66727345ca7f1598a67 Mon Sep 17 00:00:00 2001 From: mihajlo2003petkovic Date: Wed, 14 Oct 2020 22:56:14 +0200 Subject: [PATCH 20/29] Bugs fixed. I've experienced issue when I put in +2 timezone, the script calculates sun elevation for -2 timezone so i changed plus to minus in time.localtime function. Also added support for Daylight saving time. --- sun.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sun.py b/sun.py index 3454b29..cdd87e8 100755 --- a/sun.py +++ b/sun.py @@ -2,8 +2,8 @@ import ephem import time import sys -timezone = change_tz -date = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(sys.argv[1])+(timezone*60*60))) +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))) obs=ephem.Observer() obs.lat='change_latitude' From 537101b95ad8fa6b4e6c7a2db0d73f8eaa120dfc Mon Sep 17 00:00:00 2001 From: mihajlo2003petkovic Date: Wed, 14 Oct 2020 23:00:33 +0200 Subject: [PATCH 21/29] Changed JPG to PNG and satellite height I've changed the last line which saves the image from JPG format to PNG in order to be compatible with receive_meteor.sh script. I've also changed satellite height to 830 km since according to https://www.n2yo.com/satellite/?s=40069 perigee is 826.8 km, and apogee is 833.6 km as of 14 October 2020. --- rectify.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rectify.py b/rectify.py index c20ba43..5239c92 100755 --- a/rectify.py +++ b/rectify.py @@ -8,7 +8,7 @@ from math import atan,sin,cos,sqrt,tan,acos,ceil from PIL import Image EARTH_RADIUS = 6371.0 -SAT_HEIGHT = 822.5 +SAT_HEIGHT = 830.0 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 + ".jpg", "JPEG", quality=90) + rectified_img.save(out_fname + ".png", "PNG") From c0f52875cbbc6c7845e38aecb7222f9e76209ee3 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Thu, 15 Oct 2020 22:46:14 -0300 Subject: [PATCH 22/29] Fix path on delete wav audio --- receive_meteor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receive_meteor.sh b/receive_meteor.sh index 1201c84..a558cb1 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -42,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}/${3}.wav" + rm "${RAMFS_AUDIO}/audio/${3}.wav" fi log "Decoding in progress (QPSK to BMP)" "INFO" From b0d4afd73cfcbb3a67409c5a83877f078e396955 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Fri, 16 Oct 2020 11:30:12 -0300 Subject: [PATCH 23/29] toggle image flip for meteor night passes --- install.sh | 2 +- receive_meteor.sh | 15 +++++++++++---- templates/noaa.conf | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 5bbf2c0..3ca64cd 100755 --- a/install.sh +++ b/install.sh @@ -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/$(echo "$timezone * -1" | bc)/g" "sun.py" +sed -i -e "s/change_latitude/${lat}/g;s/change_longitude/${lon}/g;s/change_tz/${timezone}/g" "sun.py" # Running WXTOIMG to have the user accept the licensing agreement wxtoimg diff --git a/receive_meteor.sh b/receive_meteor.sh index b654017..42396e8 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -9,7 +9,14 @@ 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}" + 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="" fi ## pass start timestamp and sun elevation @@ -55,7 +62,7 @@ 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 "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.png" + convert "${METEOR_OUTPUT}/${3}-122.bmp" -channel RGB -negate $FLIP "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.png" 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 @@ -63,10 +70,10 @@ if [ -f "${METEOR_OUTPUT}/${3}.dec" ]; then 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} Elevation: $7°" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified-text.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" 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.jpg" "$7°" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.png" + 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" fi rm "${METEOR_OUTPUT}/${3}.bmp" rm "${METEOR_OUTPUT}/${3}-122.bmp" diff --git a/templates/noaa.conf b/templates/noaa.conf index fd188d1..1a34fb0 100644 --- a/templates/noaa.conf +++ b/templates/noaa.conf @@ -9,4 +9,5 @@ LOG_LEVEL=DEBUG LAT=change_latitude LON=change_longitude BIAS_TEE="enable_bias_tee" -DELETE_AUDIO=true +DELETE_AUDIO="true" +FLIP_METEOR_IMG="true" From bfa0064ff93713bd41b8245a81e2372227290fde Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Fri, 16 Oct 2020 16:56:09 -0300 Subject: [PATCH 24/29] Revert "update template" This reverts commit d21bcba550813cb140238c6356e122781e3400ac. --- templates/noaa.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/noaa.conf b/templates/noaa.conf index 1a34fb0..4dcd7a9 100644 --- a/templates/noaa.conf +++ b/templates/noaa.conf @@ -1,7 +1,7 @@ NOAA_HOME=/home/pi/raspberry-noaa NOAA_OUTPUT=/var/www/wx METEOR_OUTPUT=/var/www/wx/meteor -RAMFS_AUDIO=/var/ramfs +NOAA_AUDIO=/var/ramfs SAT_MIN_ELEV=30 METEOR_MIN_ELEV=30 SUN_MIN_ELEV=10 From 8405d56e1f16e2de836625990b7ca4d26ef474a3 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Fri, 16 Oct 2020 17:00:45 -0300 Subject: [PATCH 25/29] Reverting to d21bcba --- install.sh | 2 +- receive.sh | 10 ++++------ receive_meteor.sh | 37 ++++++++++++------------------------- rectify.py | 4 ++-- sun.py | 4 ++-- templates/noaa.conf | 5 ++--- 6 files changed, 23 insertions(+), 39 deletions(-) diff --git a/install.sh b/install.sh index 3ca64cd..5bbf2c0 100755 --- a/install.sh +++ b/install.sh @@ -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 diff --git a/receive.sh b/receive.sh index 2259f1a..11dcdb1 100755 --- a/receive.sh +++ b/receive.sh @@ -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" diff --git a/receive_meteor.sh b/receive_meteor.sh index 42396e8..1201c84 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -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 diff --git a/rectify.py b/rectify.py index 5239c92..c20ba43 100755 --- a/rectify.py +++ b/rectify.py @@ -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) diff --git a/sun.py b/sun.py index cdd87e8..3454b29 100755 --- a/sun.py +++ b/sun.py @@ -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' diff --git a/templates/noaa.conf b/templates/noaa.conf index 4dcd7a9..fd188d1 100644 --- a/templates/noaa.conf +++ b/templates/noaa.conf @@ -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 From b21aec49473780585ab2a92f8515164ccd214f98 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Fri, 16 Oct 2020 18:21:53 -0300 Subject: [PATCH 26/29] receive_meteor: fix audio file path on ramfs --- receive_meteor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receive_meteor.sh b/receive_meteor.sh index 1201c84..a558cb1 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -42,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}/${3}.wav" + rm "${RAMFS_AUDIO}/audio/${3}.wav" fi log "Decoding in progress (QPSK to BMP)" "INFO" From 3f850b2d0bcd313a5d1ef6240978d45bf39a0ef0 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Fri, 16 Oct 2020 18:30:02 -0300 Subject: [PATCH 27/29] add missing rm's --- common.sh | 5 ----- receive.sh | 5 ++++- receive_meteor.sh | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/common.sh b/common.sh index 85af1c6..a255f3b 100755 --- a/common.sh +++ b/common.sh @@ -36,11 +36,6 @@ if [ ! -d "${NOAA_OUTPUT}/audio/" ]; then mkdir -m 775 -p "${NOAA_OUTPUT}/audio/" fi - -if [ ! -d "${METEOR_OUTPUT}" ]; then - mkdir -m 775 -p "${METEOR_OUTPUT}" -fi - if [ ! -d "${METEOR_OUTPUT}/audio/" ]; then mkdir -m 775 -p "${METEOR_OUTPUT}/audio/" fi diff --git a/receive.sh b/receive.sh index 11dcdb1..d4837af 100755 --- a/receive.sh +++ b/receive.sh @@ -26,7 +26,7 @@ fi # $7 = Satellite max elevation log "Starting rtl_fm record" "INFO" -timeout "${6}" /usr/local/bin/rtl_fm ${BIAS_TEE} -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 - "${RAMFS_AUDIO}/audio/${3}.wav" rate 11025 +timeout "${6}" /usr/local/bin/rtl_fm ${BIAS_TEE} -f "${2}"M -s 60k -g 50 -E wav -E deemp -F 9 - | /usr/bin/sox -t raw -e signed -c 1 -b 16 -r 60000 - "${RAMFS_AUDIO}/audio/${3}.wav" rate 11025 if [ ! -d "{NOAA_OUTPUT}/image/${FOLDER_DATE}" ]; then mkdir -m 775 -p "${NOAA_OUTPUT}/image/${FOLDER_DATE}" @@ -45,6 +45,9 @@ for i in $ENHANCEMENTS; do /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 + +rm "${NOAA_HOME}/map/${3}-map.png" + if [ -n "$CONSUMER_KEY" ]; then log "Posting to Twitter" "INFO" if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then diff --git a/receive_meteor.sh b/receive_meteor.sh index a558cb1..93f8748 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -31,7 +31,7 @@ fi # $7 = Satellite max elevation log "Starting rtl_fm record" "INFO" -timeout "${6}" /usr/local/bin/rtl_fm ${BIAS_TEE} -M raw -f "${2}"M -s 288k -g 48 -p 1 | sox -t raw -r 288k -c 2 -b 16 -e s - -t wav "${RAMFS_AUDIO}/audio/${3}.wav" rate 96k +timeout "${6}" /usr/local/bin/rtl_fm ${BIAS_TEE} -M raw -f "${2}"M -s 288k -g 48 | sox -t raw -r 288k -c 2 -b 16 -e s - -t wav "${RAMFS_AUDIO}/audio/${3}.wav" rate 96k log "Normalization in progress" "INFO" sox "${RAMFS_AUDIO}/audio/${3}.wav" "${METEOR_OUTPUT}/${3}.wav" gain -n From 630ad41a9912faf11d6b5125847a7c38a814994d Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sun, 18 Oct 2020 18:53:04 -0300 Subject: [PATCH 28/29] receive_meteor: toggle image flip for night passes --- receive_meteor.sh | 11 +++++++++-- templates/noaa.conf | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/receive_meteor.sh b/receive_meteor.sh index 93f8748..e02c970 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -12,6 +12,13 @@ if [ "$SYSTEM_MEMORY" -lt 2000 ]; then 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="" +fi + ## pass start timestamp and sun elevation PASS_START=$(expr "$5" + 90) SUN_ELEV=$(python3 "$NOAA_HOME"/sun.py "$PASS_START") @@ -55,7 +62,7 @@ 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" "${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" + /usr/bin/convert -negate $FLIP "${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" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122" -r 65 -g 65 -b 64 -d @@ -63,7 +70,7 @@ if [ -f "${METEOR_OUTPUT}/${3}.dec" ]; then log "Rectifying image to adjust aspect ratio" "INFO" 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" + convert "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg" -channel rgb -normalize -channel rgb -normalize -undercolor black -fill yellow -pointsize 60 -annotate +20+60 "${1} ${START_DATE} Elev: $7°" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg" rm "${METEOR_OUTPUT}/${3}.bmp" rm "${METEOR_OUTPUT}/${3}-122.bmp" diff --git a/templates/noaa.conf b/templates/noaa.conf index fd188d1..1a34fb0 100644 --- a/templates/noaa.conf +++ b/templates/noaa.conf @@ -9,4 +9,5 @@ LOG_LEVEL=DEBUG LAT=change_latitude LON=change_longitude BIAS_TEE="enable_bias_tee" -DELETE_AUDIO=true +DELETE_AUDIO="true" +FLIP_METEOR_IMG="true" From cb22eeccdd97a1759a488508f62429e388909987 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sun, 18 Oct 2020 18:53:20 -0300 Subject: [PATCH 29/29] receive: add elevation to image annotation --- receive.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/receive.sh b/receive.sh index d4837af..72527bb 100755 --- a/receive.sh +++ b/receive.sh @@ -43,7 +43,7 @@ log "Bulding pass map" "INFO" 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.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" + /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} Elev: $7°" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg" done rm "${NOAA_HOME}/map/${3}-map.png"