Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

receive_meteor.sh 2.7 KiB

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