No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

83 líneas
3.3 KiB

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