Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > os > by-pkgid > 4b194777eaf705e440bb2ce282d32772 > files > 578

GMT-doc-4.5.3-3.fc14.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--Converted with LaTeX2HTML 2002-2-1 (1.71)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>8. Creating GMT Animations</TITLE>
<META NAME="description" CONTENT="8. Creating GMT Animations">
<META NAME="keywords" CONTENT="GMT_Docs">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<LINK REL="STYLESHEET" HREF="GMT_Docs.css">

<LINK REL="next" HREF="node157.html">
<LINK REL="previous" HREF="node121.html">
<LINK REL="up" HREF="GMT_Docs.html">
<LINK REL="next" HREF="node153.html">
</HEAD>

<BODY  bgcolor="#ffffff">
<!--Navigation Panel-->
<A NAME="tex2html4782"
  HREF="node153.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4776"
  HREF="GMT_Docs.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4770"
  HREF="node151.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4778"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4780"
  HREF="node256.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4783"
  HREF="node153.html">8.1 Animation of the</A>
<B> Up:</B> <A NAME="tex2html4777"
  HREF="GMT_Docs.html">GMT - Technical Reference</A>
<B> Previous:</B> <A NAME="tex2html4771"
  HREF="node151.html">7.30 Trigonometric functions plotted</A>
 &nbsp; <B>  <A NAME="tex2html4779"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4781"
  HREF="node256.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION001600000000000000000"></A>
<A NAME="ch:8"></A>
<BR>
8. Creating GMT Animations
</H1>

<P>
Unlike the previous chapter, in this chapter we will explore
what is involved in creating animations (i.e., movies).  Of course,
an animation is nothing more than a series of individual images
played back in an orderly fashion.  Here, these images will have
been created with <A NAME="tex2html1509"
  HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A>.  To ensure a smooth transition from frame
to frame we will be following some general guidelines when writing
our scripts.  Since there is no ``movie'' mode in <A NAME="tex2html1510"
  HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A> we must take
care of all the book-keeping in our script.  Thus, animations may
require a bit of planning and may use more advanced scripting than the
previous static examples.  Note: This is a new chapter introduced with the
4.4.0 version and should be considered work in progress.

<P>
Most, if not all, animation scripts must deal with several specific
phases of movie making:

<OL>
<LI>Define parameters that determine the dimension of the final movie.
</LI>
<LI>Pre-calculate all variables, data tables, grids, or background
	map layers that are <I>independent</I> of your time variable.
</LI>
<LI>Have a frame-number loop where each frame is created as a <I>PostScript</I> plot,
	then rasterized to a TIFF file of chosen dimension.
</LI>
<LI>Convert the individual frames to a single movie of suitable format.
</LI>
<LI>Clean up temporary files and eventually the individual frames.
</LI>
</OL>

<P>
We will discuss these phases in more detail before showing our first example.

<P>
<DL>
<DT><STRONG>1.</STRONG></DT>
<DD>There are several coordinates that you need to consider when planning
your movie.  The first is the coordinates of your data, i.e., the <I>user
coordinates</I>.  As with all <A NAME="tex2html1511"
  HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A> plots you will transform those to the
second set of <I>plot coordinates</I> 
in inches (or cm) by applying a suitable region and map projection.  As
before, you normally do this with a particular paper size in mind.  When
printed you get a high-resolution plot in monochrome or color.
However, movies are not device-independent and you must finally consider
the third set of <I>pixel coordinates</I> which specifies the resolution of the final movie.
We control the frame size by selecting a suitable <I>dpi</I> setting that
will scale your physical dimensions to the desired frame size in pixels.
If you decide up front on a particular resolution (e.g., 480 by 320 pixels)
then you should specify a paper size and <I>dpi</I> so that their product yields the desired pixel dimensions.
For instance, here it might make sense to plan your plotting on a 4.8 by 3.2 inch ``paper''
and use 100 <I>dpi</I> to convert it to pixels, but you are free to use any combination
that multiplies to the desired dimensions.  After deciding on frame size you need
to consider how many frames your movie should have.  This depends on lots of things
such as how patient you are, how many frames per second you need and the time
range of your animation.  We recommend you use variables to specify the items that
go into computing the number of frames so that you can easily test your script
with a few frames before changing settings and running the full Hollywood production overnight.
</DD>
<DT><STRONG>2.</STRONG></DT>
<DD>Depending on what you want to display, there are usually many elements that
do not change between frames.  Examples include a coastline base map for background,
an overlay of text legends, perhaps some variables that hold information that will
be used during the movie, and possibly subsets of larger data sets.  Since movie-making
can take a long time if you are ambitious, it is best to compute or plot all the
elements that can be done outside your main frame-loop rather than waste time
doing the same thing over and over again.  You are then ready for the main loop.
</DD>
<DT><STRONG>3.</STRONG></DT>
<DD>Initialize a frame counter to 0 and have a loop that continues until
your frame counter equals the desired number of frames.  You must use your frame
counter to create a unique file name for each frame image so that the series of
images can be lexically arranged.  We recommend using the <A NAME="tex2html1512"
  HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A> shell function
<I>gmt_set_framename</I><A NAME="27703"></A> to format the frame counter
with an adequate number of leading zeros; see our examples for details.  The
bulk of your main loop involves create the single <I>PostScript</I> plot for this particular
frame (time).  This can be trivial or a serious scripting exercise depending on
what you want to show.  We will give a few examples with increasing complexity.
Once the <I>PostScript</I> plot is created you need to rasterize it; we recommend you use
<A NAME="tex2html1513"
  HREF="../man/ps2raster.html"><I><B>ps2raster</B></I></A><A NAME="27709"></A> to generate a TIFF image at the agreed-upon resolution.
We also recommend that you place all frame images in a sub-directory. You may increment
your frame counter using <I>gmt_set_framenext</I><A NAME="27713"></A>.
</DD>
<DT><STRONG>4.</STRONG></DT>
<DD>Once you have all your frames you are ready to combine them into an animation.
There are two general approaches. (a) If your image sequence is not too long then
you can convert the images into a single animated GIF file.  This file can be
included in PowerPoint presentations or placed on a web page and will play back
as a movie by pausing the specified amount between frames, optionally repeating
the entire sequence one or more times. (b) For more elaborate projects
you will need to convert the frames into a proper movie format such as Quicktime,
AVI, MPEG-2, MPEG-4, etc., etc.  There are both free and commercial tools that
can help with this conversion and they tend to be platform-specific.  Most movie
tools such as iMovie or MovieMaker can ingest still images and let you specify
the frame duration.  Under OS X we prefer to use Quicktime.<A NAME="tex2html1508"
  HREF="footnode.html#foot27655"><SUP>8.1</SUP></A>  Free
tools exist to call the Quicktime library functions from the command line as we
prefer to do in our scripts.  You will find yourself experimenting with compression
settings and movie formats so that the final movie has the resolution and portability
you require.
</DD>
<DT><STRONG>5.</STRONG></DT>
<DD>Finally, when all is done you should delete any temporary files created.
However, since creating the frames may take a lot of time it is best to not automatically
delete the frame sub directory.  That way you can
redo the frames-to-movie conversion with different settings until you are satisfied.
</DD>
</DL>

<P>
<BR><HR>
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>

<UL>
<LI><A NAME="tex2html4784"
  HREF="node153.html">8.1 Animation of the sine function</A>
<LI><A NAME="tex2html4785"
  HREF="node154.html">8.2 Examining DEMs using variable illumination</A>
<LI><A NAME="tex2html4786"
  HREF="node155.html">8.3 Orbiting a static map</A>
<LI><A NAME="tex2html4787"
  HREF="node156.html">8.4 Flying over topography</A>
</UL>
<!--End of Table of Child-Links-->
<HR>
<!--Navigation Panel-->
<A NAME="tex2html4782"
  HREF="node153.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4776"
  HREF="GMT_Docs.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4770"
  HREF="node151.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4778"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4780"
  HREF="node256.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4783"
  HREF="node153.html">8.1 Animation of the</A>
<B> Up:</B> <A NAME="tex2html4777"
  HREF="GMT_Docs.html">GMT - Technical Reference</A>
<B> Previous:</B> <A NAME="tex2html4771"
  HREF="node151.html">7.30 Trigonometric functions plotted</A>
 &nbsp; <B>  <A NAME="tex2html4779"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4781"
  HREF="node256.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>
Paul Wessel
2010-07-14
</ADDRESS>
</BODY>
</HTML>