(4) Flying from NY to Miami at night
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 during the night. We use the general perspective view projection with grdimage and use project to create a great circle path between the two cities, sampled every 1 km. The main part of the script will make the HD-quality frames from different view points and add frame numbers to each frame. As this animation generates 1768 frames we use FFmpeg 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 hope to add this functionality in a future version.
#!/usr/bin/env bash
# GMT ANIMATION 04
#
# Purpose: Make custom full HD movie of NY to Miami night flight
# GMT modules: grdimage, project, movie
# Unix progs: cat
#
# Images: @earth_night from the GMT data server (evaluates to 30s resolution here)
# The finished movie is available in our YouTube channel as well:
# https://youtu.be/j75MbWb4WCE
# The movie took ~9 minute to render on a 24-core MacPro 2013.
# 1. Create files needed in the loop
cat << 'EOF' > pre.sh
# Set up flight path
gmt begin
gmt project -C-73.8333/40.75 -E-80.133/25.75 -G1 -Q > flight_path.txt
gmt end
EOF
# 2. Set up the main frame script
cat << 'EOF' > main.sh
gmt begin
gmt grdimage -JG${MOVIE_COL0}/${MOVIE_COL1}/${MOVIE_WIDTH}+du+z160+a210+t55+v36 \
-Rg @earth_night -Xc -Y-5c
gmt end
EOF
# 3. Run the movie
gmt movie main.sh -Chd -Nanim04 -Tflight_path.txt -Sbpre.sh -Zs -H2 -Lf+o0.25c+f14p,Helvetica-Bold,white -Gmidnightblue -V -Fmp4