GOES-17 receiver and gif animator

I shared a gif on reddit demonstrating the results of my GOES-17 project, phase 1. Some people asked for more information about my setup, so here we go.

Hardware Setup

Image Processing

Additional to the steps using the goes tools from the guide to get images from the receiver in the first place, I put together a small script that runs via cron to send images to a cloud server.

#!/bin/bash

COUNT=48
WIDTH=640
USER=REMOTE_HOST_USERNAME
HOST=REMOTE_IP_HERE

# sort the GOES-17 fullcolor images by date and get the latest file
a=$(find /home/pi/goes17/fd/fc/ -type f -exec stat --format '%Y :%y %n %s' "{}" \; | grep jpg | sort -nr | cut -d: -f2- | head -n 1| awk '{print $4}')
# get the last recorded latest filename
b=$(cat /home/pi/goes17/fd/fc/latest.filename.txt)
echo "latest $a vs $b"
# if the last recorded is different from the newest received
if [[ "$a" != "$b" ]]
then
		# record the newest received to the latest filename record and upload
        echo $a > /home/pi/goes17/fd/fc/latest.filename.txt
        echo "uploading..."
        scp $a $USER@$HOST:/var/www/goes/_latest.jpg
        ssh $USER@$HOST cp /var/www/goes/_latest.jpg /var/www/goes/latest.jpg

		# sort the files by date from newest to oldest. Get the last 48 images.
		# We expect to get one every 30 minutes, so this would ideally be 24 hours worth, but sometimes we
		# lose an image. So check the timestamps and get fewer than 48 if some time slots were missed
        anim=$(find /home/pi/goes17/fd/fc/ -type f -exec stat --format '%Y :%y %n %s' "{}" \; | grep jpg | sort -nr | cut -d: -f2- | head -n $COUNT | awk '{print $4}' | tac | perl -lne 'print;/(\d{8})T(\d{4})/; if (!$a) { $d1 = $1; $a = $2; } else { $d2 = $1; $b = $2; exit if $d2 > $d1 && $b >= $a ; }' | xargs)

        # make the local working directory just in case. only necessary the first time but let's be sure.
        mkdir /tmp/goes_anim

        # remove old temp files
        rm /tmp/goes_anim/*

        # copy new animation source files
        cp $anim /tmp/goes_anim/

        # use ImageMagick to resize the animation source files
        echo "resizing"
        cd /tmp/goes_anim && mogrify -resize $WIDTH *.jpg

        # remove the old animation source files on the remote host
        ssh $USER@$HOST rm /var/www/goes/anim/*
        
        # copy new source animation files to remote
        scp /tmp/goes_anim/* $USER@$HOST:/var/www/goes/anim/

        # convert remote sources to gif using ImageMagick
        ssh $USER@$HOST 'convert -delay 10 -loop 0 /var/www/goes/anim/*.jpg /var/www/goes/24hr.gif' &
fi

FIN

The results are awesome!