Skip to content

Instantly share code, notes, and snippets.

@wesalvaro
Last active August 29, 2016 06:28
Show Gist options
  • Save wesalvaro/ad1de0332e6c06f29760874bb60e9ea9 to your computer and use it in GitHub Desktop.
Save wesalvaro/ad1de0332e6c06f29760874bb60e9ea9 to your computer and use it in GitHub Desktop.
Displays radar images from the JMA.
#/bin/sh
mkdir -p /tmp/weather
if [ -n "$1" ]; then
echo "Deleting old images."
rm -rf /tmp/weather/*
fi
cd /tmp/weather
SECS=`date "+%s"`
NUM_FRAMES="50"
while [ $NUM_FRAMES -gt 0 ]; do
# http://www.jma.go.jp/jp/radnowc/imgs/radar/000/201608291335-00.png
DATE=`date --date="@$((SECS / 300 * 300 - $NUM_FRAMES * 300))" "+%Y%m%d%H%M"`
echo http://www.jma.go.jp/jp/radnowc/imgs/radar/000/$DATE-00.png | \
xargs wget --no-clobber --quiet
NUM_FRAMES=$[$NUM_FRAMES-1]
done
# sudo apt-get install imagemagick
convert -delay 20 -loop 0 *.png animation.gif
# https://www.iterm2.com/documentation-images.html
imgcat animation.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment