Our next animation simulates what an imaginary satellite might see as it passes in a great circle from New York to Miami at an altitude of 160 km. We use the general perspective view projection with grdimage and use project to create a great circle path between the two cities, sampled every 5 km. The main part of the script will make the DVD-quality frames from different view points, draw the path on the ground, and add frame numbers to each frame. As this animation generates 355 frames we can use 3rd party tools to turn the image sequence into a MPEG-4 movie. Note: At the moment, grdview cannot use general perspective view projection to allow “fly-through” animations like Fledermaus; we expect to add this functionality in a future version.
#!/bin/bash
# GMT ANIMATION 04
#
# Purpose: Make DVD-res Quicktime movie of NY to Miami flight
# GMT progs: gmt gmtset, gmt gmtmath, gmt psbasemap, gmt pstext, gmt psxy, gmt ps2raster
# Unix progs: awk, mkdir, rm, mv, echo, qt_export, cat
# Note: Run with any argument to build movie; otherwise 1st frame is plotted only.
#
# 1. Initialization
# 1a) Assign movie parameters
REGION=-Rg
altitude=160.0
tilt=55
azimuth=210
twist=0
Width=36.0
Height=34.0
px=7.2
py=4.8
dpi=100
name=anim_04
ps=.ps
# Set up flight path
gmt project -C-73.8333/40.75 -E-80.133/25.75 -G5 -Q > $$.path.d
frame=0
mkdir -p frames
gmt grdgradient USEast_Coast.nc -A90 -Nt1 -G$.nc
gmt makecpt -Cglobe -Z > $$.cpt
while read lon lat dist; do
file=`gmt_set_framename `
ID=`echo | $AWK '{printf "%04d\n", $1}'`
gmt grdimage -JG////////7i+ \
-P -Y0.1i -X0.1i USEast_Coast.nc -I$.nc -C$$.cpt \
--PS_MEDIA=ixi -K > $$.ps
gmt psxy -R -J -O -K -W1p $$.path.d >> $$.ps
gmt pstext -R0//0/ -Jx1i -F+f14p,Helvetica-Bold+jTL -O >> $$.ps <<< "0 4.6 "
if [ $# -eq 0 ]; then
mv $$.ps
gmt_cleanup .gmt
gmt_abort ": First frame plotted to .ps"
fi
gmt ps2raster $$.ps -Tt -E
mv $$.tif frames/.tif
echo "Frame completed"
frame=`gmt_set_framenext `
done < $$.path.d
if [ $# -eq 0 ]; then
echo "anim_04.sh: Made frames at 480x720 pixels placed in subdirectory frames"
# qt_export $$/anim_0_123456.tiff --video=h263,24,100, _movie.m4v
fi
# 4. Clean up temporary files
gmt_cleanup .gmt