Thursday, January 21, 2016

All of 2015's Weather in under 2 minutes

While poking around weather.gov I came across this archive of US weather maps and thought what any reasonable person would think: I wonder what a movie showing all 365 days of weather would look like? To answer that question, I did the following:

Step 1. Grab the raw images. This was too easy:

$ cat > grab
#!/bin/bash

# http://www.wpc.ncep.noaa.gov/archives/noaa/2015/noaad1_2015011812.gif

for m in `seq 1 12`; do
  for d in `seq 1 30`; do
    for h in 00 12 ; do
      url=`printf "http://www.wpc.ncep.noaa.gov/archives/noaa/2015/noaad1_2015%02d%02d%02d.gif" $m $d $h`
      wget -O `printf "map_%02d%02d%02d.gif" $m $d $h` $url
    done
  done
done
^d
$ chmod a+rx grab
$ ./grab

Step 2. Convert and crop the files so that they just contained maps. Again, we're talking child's play:

$ mkdir jpegs
$ for f in *.gif ; 
   do convert -crop 510x366+0+0 $f jpegs/`basename $f .gif`.jpg;
  done

Step 3. Convert the images into a mp4 video. So simple:

$ ffmpeg -framerate 7 -pattern_type glob -i 'jpegs/*.jpg' -c:v libx264 -pix_fmt yuv420p out.mp4

Step 4. Upload the file to YouTube and watch the Likes roll in. Uploading the file was easy enough and adding audio definitely helped make the video at least somewhat watchable.

So what does one year of weather maps strung together into a movie look like? Well, here you go:

I've got to say, the results are Feh at best. The characters are weak, the plot is predictable and the special effects way over the top. In all seriousness, it was an interesting exercise, but unless you're a weather geek, I doubt you'll find this particularly riveting.

2 comments:

  1. very cool, I'll have to try out that ffmpeg command with my goes imagery utility (https://github.com/ckcin/desktopweather)

    ReplyDelete
  2. Thanks Nick. ffmpeg is definitely the way to go for creating .mp4 files. If you want an animated gif, you can get away with using 'convert' that comes with ImageMagick.

    ReplyDelete