The REPEAT command is quite flexible. It allows you to repeat a sequence of commands, not just a single command as in the basic example above. You can give the GO command as an argument to REPEAT. The following examples demonstrate these techniques.
Example 1
Note the method at the start of this chapter for making movies from a sequence of GIF files to make an animated gif.
Example 2
Here we give multiple arguments to REPEAT; note the semi-colon separation and the parentheses.
yes? REPEAT/L=1:9 (FILL SST; GO fland; FRAME/file=sst0_`l`.gif) yes? REPEAT/L=10:12 (FILL SST; GO fland; FRAME/file=sst_`l`.gif)
Example 3
In this example we use the REPEAT command to pan and zoom over a sea surface temperature field.
SET DATA coads_climatology SET REGION/L=1 SET REGION/X=120E:60W/Y=45S:45N SHADE sst; GO fland ! ZOOM REPEAT/K=1:5 (SET REGION/DX=+8:-8/DY=+8:-8; SHADE sst; GO fland; FRAME/file=frame_a`k`.gif) ! PAN REPEAT/K=1:5 (SET REGION/DX=+5; SHADE/LEV=(20,30,.5) sst; FRAME/file=frame_b`k`.gif)
Example 4
In this example the user calls setup_movie.jnl (text included below), title.jnl, which creates a title frame, then repeats main_movie.jnl (text included below) for each time step desired. Finally, the user adds a frame of credits at the end of the movie. Using GO scripts as arguments to REPEAT allows you to customize the plot with many commands to make the frames of the movie, as the text of main_movie.jnl below demonstrates.
yes? ! make the movie yes? GO setup_movie yes? GO title ! makes frame_0.gif with a title yes? REPEAT/L=1:12 GO main_movie `L` yes? GO credits ! makes frame_100.gif with credits ! Setup_movie.jnl SET WINDOW/SIZE=.45/ASPECT=0.7 SET DATA coads_climatology SET REGION/X=130E:75W/Y=8S:8N SET MODE CALENDAR:months GO bold PPL SHAKEY ,,.15,.2 PPL AXLEN 8.8,4.8 ! Main_movie.jnl ! Argument $1 is the time step FILL/SET_UP/LEVELS=(16,31,1) sst PPL LABS; PPL TITLE PPL FILL LABEL 210,9.5,0,0,.22 @TRCOADS MONTHLY CLIMATOLOGY (1946-1989) LABEL 210,-12,0,0,.22 @TRSEA SURFACE TEMPERATURE (DEG C) LABEL 130,11,-1,0,.22 @TR'LAB4' DEFINE SYMBOL fname = frame_$1 IF `L LT 10` THEN DEFINE SYMBOL fname = frame_0$1 FRAME/file=($fname).gif
5.4.1.1 Harmonizing the plots in an animation
Take care to use a common set of color levels for all of the images in an animation. The optional colorkey annotations can be used to show the actual data range in each frame. Control this with the KEYMARK alias. Issue the command:
KEYMARK,1
before making plots to turn this option on.
5.4.1.2 Making movies in batch mode
Ferret, like other Unix applications, can be run in "batch" mode by redirecting standard input and output. Thus
ferret -gif -script movie_commands.jnl
will make a movie running in background mode based on the commands in file movie_commands.jnl