Making movies with visit

From CSDMS

How to Create an MPEG movie from a netCDF Grid Stack Using VisIt 1.12.2

Note: These instructions tell you how to use the version of VisIt that is installed on our computing cluster called "beach". There is a package called "ffmpeg" that we have installed on "beach" and VisIt uses this package to create better-quality MPEG movies when it is available.

Preparing to Run VisIt

Step 1

Open a terminal window on your desktop computer and use "ssh" to log onto "beach". To do this, at the terminal prompt, type "ssh -X beach" or "ssh -Y beach". The -X and -Y flags to ssh enable X11 forwarding (use "man ssh" for more info). The X11 forwarding allows the GUI to appear on your desktop computer's monitor.

Step 2

Check that "visit" is in your path by typing "which visit". If it is, you can just type "visit" at your Unix prompt to launch it. Otherwise, launch visit by typing: "/usr/local/visit/bin/visit".

Note: If you want to add "visit" to your path so that you can just type "visit" in the future, then you'll need to add some lines to so-called "dot files" in your home directory. These are hidden files that start with ".". To get "ls" to show them, type: "ls -a". First, find out which Unix shell you're using by typing: "echo $SHELL". If you're using the bash shell, add the following lines at the bottom of the file called ".bash_profile":

echo "Setting environment modules..." source /usr/local/modules/init/bash module load visit/1.12.2 If you're using the tcsh shell, add these lines to the file called ".cshrc":

echo "Setting environment modules..." source /usr/local/modules/init/tcsh module load visit/1.12.2 After adding these lines, make sure you're in your home directory and type: % source .bash_profile (or source .cshrc) at the Unix prompt in order for the changes to take effect. They will automatically take effect for all future logins.

Running VisIt

Step 1

Once VisIt starts up, choose "Select File..." from the File menu and then use the file selection dialog to find a netCDF file that contains a grid stack. These instructions assume that you created this netCDF file with one of the CSDMS components. Note that netCDF filenames usually end with ".nc". VisIt is able to see our type of netCDF file as a "time-varying database" and this is critical in order for the grid stack to be played as an animation or saved as a movie. Click "Select" in the dialog box and then click "OK".

Step 2

If you now click in the box labeled "Selected files", you should be able to select the netCDF file. If VisIt recognizes it as a time-varying database (DB), then an icon that looks like a little green cylinder with the letters "DB" on it should appear to the left of the filename. In addition, you should see the labels "cycle 0000", "cycle 0001", etc. just below the filename. These represent the various grids or "frames" in the grid stack. The grids in the stack are usually indexed by time and represent some variable that varies in both space and time across your model domain. If the green cylinder does not appear next to your file of interest, you will need to select the netCDF file and then click "Open" below the file list.

Step 3

Somewhere in the GUI, often about halfway down, you should find a horizontal menu bar that has the following entries: Plots, Operators, PlotAtts, OpAtts, Variables. When you click on any of these you'll see a drop-down menu. Choose Pseudocolor from the Plots menu and then choose from the menu of variable names that appear. These names were extracted by VisIt from your netCDF file and this shows that VisIt recognizes them as grids that can be used to make a pseudocolor plot (sometimes called a "density plot").

Step 4

Click on the Draw button, which is usually somewhere above the Plots menu. This will display the first frame in your grid stack as a pseudocolor image. At this point you can click on the Play button, which looks like a black triangle pointing to the right, to see an animation of your grid stack. Several other animation controls can be found close by, and can also be found along the top edge of the window that is showing the animation.

Step 5

If you want to change the color table or some other option that is used to create the pseudocolor plot, then find the PlotAtts drop-down menu mentioned above and choose Pseudocolor from the menu. You can experiment with changing the settings in this dialog.

Step 6

You're now ready to save your animation as an MPEG movie. VisIt has a wizard to help you create movies which you get to by choosing "Save Movie..." from the File menu. In the first panel you can just keep the default: "New simple movie". In the next panel you have a few choices on the left. After that you need to click on the right arrow button in the middle. Notice that this approach lets you create multiple movies with different options at the same time. In the next panel you can use the defaults and the one after that lets you set the "Output directory" and "Base filename". The next wizard panel gives you the option to receive an e-mail notification when the movie is finished. The last panel lets you set how many processors VisIt should use to create your movie. This is one of the cool things about VisIt, that it can take advantage of multiple processors to render graphics, even if the data sets are huge (i.e. terrabyte scale).

Step 7

Click on the Finish button in the last wizard panel and VisIt will start working on your movie. A thermometer-style progress dialog will keep you informed of its progress. When VisIt is finished, you should find an MPEG file in the Output directory that you specified.

Step 8

If you would like to convert your MPEG movie to some other format, such as AVI, we have installed a suite of command line utilities for video and audio conversion on "beach" called "transcode". These tools can be found in the directory: /usr/local/transcode/bin. For more information on these utilities, including tutorials and user groups, please see the transcode wiki at: http://www.transcoding.org.

Step 9

Finally, you may wish to copy this movie file to your local computer for later use. One simple way to do this is to return to the terminal window. You can open a new window (which should access your local computer) and simply use the "scp" (secure copy) command to copy the movie file from where it was saved on beach to the directory of your choice on your local computer. For instance: "scp beach:/home/beach/faculty/masonmc/movie.mpeg /Users/masonmc". The first file path is the original location of the movie, while the second indicates the destination directory on the local computer. After typing in this command, you will be prompted for your password on beach, and then the transfer will occur. Another option for copying files is to use a graphical SFTP (SSH File Transfer Protocol) program like Fugu or CyberDuck to access your files on beach.

Additional Notes

VisIt has other ways of creating movies which give you more control. One of these is called "Keyframing", located in the Controls menu. Some spatial fields will look nicer in your Pseudocolor plots if you apply some kind of function to them first. For example, if the values vary over several orders of magnitude (and are positive) you may want to take the logarithm first to make better use of the color table. Power-laws with powers less than one have a similar effect. VisIt has a cool way to let you do this kind of thing. Choose Expressions from the Controls menu. This dialog lets you enter mathematical expressions that use the names of your grid stack variables (which VisIt read from your netCDF file). For example, if you have a variable with the name "H", then you could define an expression like "log(1 + H)". In this dialog you enter both the expression itself, and the label that you want VisIt to use when it offers this expression to you in future lists of variables that are available to be plotted. You may need to play with this dialog a bit to see how it works, or resize it to see all of the options. Once you've defined an expression like this, you can go back through the steps outlined above for making an MPEG movie and simply select the new expression where you previously selected a variable to use in the Pseudocolor plot.

The Operators and OpAtts menus have the same relationship to each other as the Plots and PlotAtts menus do. You can apply operators to plots to create a wide variety of effects. Experimentation will eventually work, but you may want to read the VisIt User's Guide to learn about the many options.