## Friday, February 1, 2013

### ## More on SST movies

This follows an earlier post which has .swf movies derived from the HiRes NOAA SST page. This has the WebGL rotatable globe with a shaded 1/4° plot and lots of daily data, courtesy of NOAA/NCDC and partners.

I've made some improvements, mainly to aid the showing and making of animations. Although the ordinary videos are easy to start up, I'm hoping to make the WebGL version equally accessible. The resolution is much better, especially with zooming, and, well, it's just fun to be able to rotate the globe while the animation is in progress.

So I've added a Pause button and a Step button. I've also systematised the buttons so each has pretty much a toggle function, and turns red when it's on. That helps, because the logic of how they all interact is now complicated, though I hope intuitive.

The mode of movie operation is still that you set up a sequence with the Seq button, prescribing step in days and total frames. This was slow at hi-res; it's better now, but too fast at low res. The Pause button will stop this if you change your mind. There's a counter for the frames.

Then Cycle with set interval in Secs (can be fraction) will show a proper movie in loop mode. Again Pause will pause it, and while paused, Step will go one frame at a time.

I'd recommend that you toggle off any buttons that you don't need.

There's an interesting new button that I've called Manual. It's to help with making flash movies. Like other buttons, it turns red when clicked, and in that state, allows control by keystrokes. j sets it to the start of a movie sequence and k steps by one. You can use it in this mode if you like. Note that it works on a focus system, so if you click elsewhere, focus is lost and the button goes pale and doesn't receive keystrokes any more.

But the real purpose is to allow another process to take over and synchronise. I mentioned in my last post that I found a nifty program, NirCmd, that will set up a loop that takes screenshots at prescribed intervals. It will also generate keystrokes, so I can ensure that each screenshot is of consecutive frames.

You'll notice a new timestamp top left. You can move this anywhere in the plot with a Shift-click.

Here is the complete DOS batch file that I use:
 nircmd loop 54 3000 execmd ..\scor ~$loopcount$ convert *.png -crop 780x4000+30+80 -resize 75%% "w%%02d.jpg" ffmpeg -y -sameq -r 2 -i "w%%02d.jpg" -r 2 -t 50 %dr%.swf 
The first is the NirCmd line to run the loop (scor.bat). The second is ImageMagick to convert the resulting png's to cropped jpg's and the third makes the movie. All freely available utilities. The batch file scor.bat is just:
 if %1==1 nircmd sendkeypress j set /A a=%1+100 nircmd savescreenshot C:\mine\blog\experiments\screencap\try\scr%a%.png nircmd sendkeypress k 
The arg %1 is the loop counter; the first line forces the WebGL to the first frame, second just ensures that the output will be in alphabet order, then the screen shot, then the signal to step a frame.

I've added an animation of 2012 at 4-day steps. There will be more.