25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

receive_meteor.sh 2.1 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/bash
  2. ## import common lib
  3. . ~/.noaa.conf
  4. . "${NOAA_HOME}"/common.sh
  5. ## pass start timestamp and sun elevation
  6. PASS_START=$(expr "$5" + 90)
  7. SUN_ELEV=$(python3 sun.py "$PASS_START")
  8. if [ "${SUN_ELEV}" -lt "${SUN_MIN_ELEV}" ]; then
  9. log "Sun elev is too low. Meteor IR radiometers are not working" "INFO"
  10. exit 0
  11. fi
  12. if pgrep "rtl_fm" > /dev/null
  13. then
  14. log "There is an already running rtl_fm instance but I dont care for now, I prefer this pass" "INFO"
  15. pkill -9 -f rtl_fm
  16. fi
  17. # $1 = Satellite Name
  18. # $2 = Frequency
  19. # $3 = FileName base
  20. # $4 = TLE File
  21. # $5 = EPOC start time
  22. # $6 = Time to capture
  23. # $7 = Satellite max elevation
  24. log "Starting rtl_fm record" "INFO"
  25. 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 "${METEOR_OUTPUT}/audio/${3}.wav" rate 96k
  26. log "Normalization in progress" "INFO"
  27. sox "${METEOR_OUTPUT}/audio/${3}.wav" "${METEOR_OUTPUT}/${3}.wav" gain -n
  28. rm "${METEOR_OUTPUT}/audio/${3}.wav"
  29. log "Demodulation in progress (QPSK)" "INFO"
  30. meteor_demod -B -o "${METEOR_OUTPUT}/${3}.qpsk" "${METEOR_OUTPUT}/${3}.wav"
  31. rm "${METEOR_OUTPUT}/${3}.wav"
  32. log "Decoding in progress (QPSK to BMP)" "INFO"
  33. medet_arm "${METEOR_OUTPUT}/${3}.qpsk" "${METEOR_OUTPUT}/${3}" -cd
  34. rm "${METEOR_OUTPUT}/${3}.qpsk"
  35. if [ -f "${METEOR_OUTPUT}/${3}.dec" ]; then
  36. log "I got a successful ${3}.dec file. Creating false color image" "INFO"
  37. medet_arm "${METEOR_OUTPUT}/${3}.dec" "${METEOR_OUTPUT}/${3}-122" -r 65 -g 65 -b 64 -d
  38. convert "${METEOR_OUTPUT}/${3}-122.bmp" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg"
  39. log "Rectifying image to adjust aspect ratio" "INFO"
  40. python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg"
  41. rm "${METEOR_OUTPUT}/${3}-122.bmp"
  42. rm "${METEOR_OUTPUT}/${3}.bmp"
  43. log "Posting to Twitter" "INFO"
  44. 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"
  45. else
  46. log "Decoding failed, either a bad pass/low SNR or a software problem" "ERROR"
  47. fi