| 1 | #!/usr/bin/env bash |
| 2 | # GMT ANIMATION 02 |
| 3 | # |
| 4 | # Purpose: Make simple MP4 of an illuminated DEM grid of the US Rockies |
| 5 | # GMT modules math, makecpt, grdcut, grdimage, inset, plot, text, movie |
| 6 | # Unix progs: cat |
| 7 | # |
| 8 | # The finished movie is available in our YouTube channel as well: |
| 9 | # https://youtu.be/WQ6JrtEu_Fk |
| 10 | # The movie took 1 minute 45 seconds to render on a 24-core MacPro 2013. |
| 11 | |
| 12 | # 1. Create files needed in the loop |
| 13 | cat << 'EOF' > pre.sh |
| 14 | gmt begin |
| 15 | gmt math -T0/360/1 T -o0 = angles.txt |
| 16 | gmt makecpt -Coleron -T500/4500 -H > main.cpt |
| 17 | gmt grdcut @earth_relief_15s -R-114/-103/35/40 -Gtopo.nc |
| 18 | gmt end |
| 19 | EOF |
| 20 | # 2. Set up the main frame script |
| 21 | cat << 'EOF' > main.sh |
| 22 | gmt begin |
| 23 | width=$(gmt math -Q ${MOVIE_WIDTH} 1.5c SUB =) |
| 24 | gmt grdimage topo.nc -I+a${MOVIE_COL0}+nt2 -JM${width} -Cmain.cpt \ |
| 25 | -BWSne -B1 -X1c -Y0.53c --FONT_ANNOT_PRIMARY=9p |
| 26 | gmt inset begin -DjBR+w2.1c/2.4c+o0.2c -F+gwhite+s+p |
| 27 | echo 0.5 0.5 | gmt plot -R0/1/0/1 -JX? -Sc2c -Gwhite -Wthinner -Y-0.15 |
| 28 | echo 0.5 0.5 ${MOVIE_COL0} | gmt plot -Sk@azimuth/1.0c -W1.75p -Gred |
| 29 | echo Light Source | gmt text -F+cTC+f9 -Y0.1 |
| 30 | gmt end |
| 31 | EOF |
| 32 | # 3. Run the movie |
| 33 | gmt movie main.sh -Chd -Nanim02 -Tangles.txt -Vi -Sbpre.sh -Zs -Fmp4 |