GMT Installation

Course instructor: Hu Jyr-Ching (胡植慶) Teaching Assistant: Chun-Ying Chiu (邱俊穎)

國立臺灣大學地質科學系 Department of Geosciences, National Taiwan University Department of Geosciences, National Taiwan University Installation of GMT and software • GMT 4.5.6 • Ghostscript and Gsview (Postscript graphics viewer) • Crimson Editor or UltraEditor (Text Editor: Column mode support) • CorelDraw 13 or Illustrator (import the ps file and modify it) Ghostscript and Gsview

Download AFPL Ghostscript 902 and GSview 4.9

gs902w32.exe: gsv49w32.exe 32-bit Windows

gs902w64.exe gsv49w64.exe 64-bit Windows

http://pages.cs.wisc.edu/~ghost/ Crimson Editor (freeware)

Column mode support

http://www.crimsoneditor.com V3.72 Release (May. 14, 2008) Download and Install GMT4.5.6

• For Windows: Executing 3 setup programs (Choose either the 32-bit or 64-bit GMT installer) 1. GMT_install32.exe: The 32-bit GMT distribution. 2. GMT_install64.exe: The 64-bit GMT distribution. 3. GMT_pdf_install.exe: GMT PDF documentation. 4. GShHS_highfull_install.exe: High and Full resolution GSHHS coastlines. Then a folder is automatically created: C:\programs\GMT GMT Files and Data: download via FTP • In the c:/programs/GMT, 4 subdirectories are: 1. bin (gmt programs, executable) 2. include 3. lib 4. share (rivers, borders, shorelines, patterns, color palette table, etc) GMT examples and documents

1. 30 examples of GMT cookbook are in c:/programs/GMT/share/doc/gmt/examples

2. Cookbook and tutorial are in c:/programs/GMT/share/doc/gmt/pdf

Print out GMT_Tutorial.pdf and GMT_Docs.pdf Install GNU gawk and netcdf

• Unzip gawk316.zip • Copy gawk.exe to C:/programs/GMT/bin/ **Copy C:/programs/GMT/bin/netcdf.dll to C:/windows/system32 .gmtdefaults4 (SI version) gmtdefaults –Ds > .gmtdefaults4 # # GMT-SYSTEM 4.5.6 Defaults file # #------Plot Media Parameters ------PAGE_COLOR = white (255/255/255) PAGE_ORIENTATION = landscape PAPER_MEDIA = a4 #------Basemap Annotation Parameters ------ANNOT_MIN_ANGLE = 20 ANNOT_MIN_SPACING = 0 ANNOT_FONT_PRIMARY= Helvetica ANNOT_FONT_SIZE_PRIMARY = 14p ANNOT_OFFSET_PRIMARY = 0.2c ANNOT_FONT_SECONDARY = Helvetica ANNOT_FONT_SIZE_SECONDARY = 16p ANNOT_OFFSET_SECONDARY = 0.2c …….. PLOT_DEGREE_FORMAT = ddd:mm:ss ………. .gmtdefaults4

#------Basemap Layout Parameters ------BASEMAP_AXES = WESN BASEMAP_FRAME_RGB = black (0/0/0) BASEMAP_TYPE = fancy FRAME_PEN = 1.25p FRAME_WIDTH = 0.2c GRID_CROSS_SIZE_PRIMARY = 0c GRID_PEN_PRIMARY = 0.25p ….. #------Color System Parameters ------COLOR_BACKGROUND = black (0/0/0) COLOR_FOREGROUND = white (255/255/255) COLOR_NAN = 128/128/128 COLOR_IMAGE = adobe COLOR_MODEL = rgb …….. .gmtdefaults4

#------PostScript Parameters ------CHAR_ENCODING = ISOLatin1+ DOTS_PR_INCH = 300 N_COPIES = 1 PS_COLOR = rgb ….. #------I/O Format Parameters ------….. GRIDFILE_SHORTHAND = FALSE GRID_FORMAT = nf INPUT_CLOCK_FORMAT = hh:mm:ss INPUT_DATE_FORMAT = yyyy-mm-dd IO_HEADER = FALSE N_HEADER_RECS = 1 OUTPUT_CLOCK_FORMAT = hh:mm:ss OUTPUT_DATE_FORMAT = yyyy-mm-dd OUTPUT_DEGREE_FORMAT = D ……. .gmtdefaults4

#------Projection Parameters ------ELLIPSOID = WGS-84 MAP_SCALE_FACTOR = default MEASURE_UNIT = cm #------Calendar/Time Parameters ------TIME_FORMAT_PRIMARY = full TIME_EPOCH = 2000-01-01T12:00:00 TIME_IS_INTERVAL = OFF TIME_INTERVAL_FRACTION = 0.5 TIME_LANGUAGE = us (cn2) TIME_UNIT = d ….. #------Miscellaneous Parameters ------HISTORY = TRUE INTERPOLANT = akima LINE_STEP = 0.025c VECTOR_SHAPE = 0 VERBOSE = FALSE ------0.075i ------Letter Basemap Annotation Parameters Plot Media Parameters GMT-SYSTEM 4.5.6file Defaults gmtdefaults –Du > .gmtdefaults4 gmtdefaults4 (US version) gmtdefaults4 (US . ANNOT_MIN_ANGLEANNOT_MIN_SPACINGANNOT_FONT_PRIMARYANNOT_FONT_SIZE_PRIMARY 20 = 0 = ANNOT_OFFSET_PRIMARY = Helvetica ANNOT_FONT_SECONDARY = = Helvetica 14p = ANNOT_FONT_SIZE_SECONDARY………. = 16p PAGE_COLORPAGE_ORIENTATION landscape = PAPER_MEDIA 255/255/255 = = #------# # # #------GMT Environment

GMT_SHAREDIR = C:\programs\GMT\share Path = C:\programs\GMT\bin Make GMT defaults .gmtdefaults4 1. Open DOS prompt 2. cd \programs\gmt 3. gmtdefaults –Ds > .gmtdefaults4 gmtdefaults − To list current GMT defaults gmtdefaults −D[u|s] | −L

-D: Print the system GMT defaults to standard output. Append u for US defaults or s for SI defaults

SI: Le Système International d‘Unités - International System of Units GMT Defaults

1. .gmtdefaults4: 100+ parameters can be adjusted individually to modify the appearance of plots or affect the manipulation of data. 2. When a program is run, it initializes all parameters to the GMT defaults, then tries to open the file in the current directory. 3. You may create your own .gmtdefaults4 files by running gmtdefaults and then modify those parameters you want to change.

2. Install GMT in Unix/Linux/OSX

1. For OSX, First install 2. Automated install [Recommended]. 3. Obtain and install GMT by interacting with the INSTALL FORM. Follow instructions there to obtain the Bourne shell install-script and a customized install parameter file. 4. You have obtained and saved install_gmt.sh, the GMT install script. (a) Obtain and install GMT by interacting with the INSTALL FORM. (b) Save the parameters of INSTALL Form as a file GMTparam.txt Install GMT in Unix/Linux/OSX

5. Put install_gmt.sh GMTparam.txt in the same directory 6. Open terminal in OSX chmod +x install_gmt.sh ./install_gmt.sh GMTparam.txt 7. Complete installation: For sh or users: export NETCDFHOME=/Applications/programs/netcdf- 3.6.3 export PATH=/Applications/programs/GMT4.5.6/bin:$PATH GMT Environment in OSX 1. Go to /etc and open paths 2. Add the following line and save it

/Applications/programs/GMT4.5.6/bin

3. go to ~/ and create a new file .bash_login Add the following two lines in .bash_login and save it export NETCDFHOME=/Applications/programs/netcdf-3.6.3 export PATH=/Applications/programs/GMT4.5.6/bin:$PATH

4. Change the security privileges and working group (admin) Go to /Applications/programs/ sudo chmod - xxxx GMT4.5.6 sudo chgrp -R admin GMT4.5.6 Xcode (Xcode 4)

1. Xcode is a suite of tools, developed by Apple, for developing software for Mac OS X and iOS. 2. The Xcode suite includes a modified version of free software GNU Collection (GCC, apple-darwin9- gcc-4.2.1 as well as apple-darwin9-gcc-4.0.1, with the former being the default), and supports C, C++, Objective- C, Objective-C++, Java, AppleScript, Python and Ruby source code with a variety of programming models, including but not limited to Cocoa, Carbon, and Java. Third parties have added support for GNU Pascal, , Ada, C#, Perl, Haskell, and D. The Xcode suite uses the GNU Debugger as the back-end for its debugger. Install_gmt.sh #!/bin/sh # $Id: install_gmt.sh,v 1.169 2011/03/08 19:20:16 guru Exp $ # # Automatic installation of GMT # Suitable for the Bourne shell (or compatible) # # Paul Wessel # 10-Mar-2011 #------# GLOBAL VARIABLES NETCDF_VERSION=3.6.3 VERSION=4.5.6 GSHHS=2.1.1 GMT_FTP_TEST=0 ………………………………. Test GMT example 01 1. Go to programs/GMT/share/doc/gmt/examples/ex01 2. Using Crimson Editor to open job01.bat 3. Add pause in the last line of job01.bat 4. Double click job01.bat 5. Double click programs/GMT/share/doc/gmt/examples/ex01 /example_01.ps

Batch file of job01.bat echo GMT EXAMPLE 01 set master=y if exist job01.bat set master=n if %master%==y cd ex01 gmtset GRID_CROSS_SIZE_PRIMARY 0 ANNOT_FONT_SIZE_PRIMARY 10 psbasemap -R0/6.5/0/9 -Jx1i -B0 -P -K -U"Example 1 in Cookbook" > ..\example_01.ps pscoast -Rg -JH0/6i -X0.25i -Y0.5i -O -K -Bg30 -Dc -Glightgray >> ..\example_01.ps grdcontour osu91a1f_16.nc -J -C10 -A50+s7 -Gd4i -L-1000/-1 -Wcthinnest,- - Wathin,- -O -K -T0.1i/0.02i >> ..\example_01.ps Test GMT example 01

1. Open MacOSX terminal 2. Cd ~/examples/ex01 3. ./job01.csh 4. Double click ~/example_01.ps

Shellscript file of job01.csh # GMT progs: gmtset, grdcontour, psbasemap, pscoast # Unix progs: rm gmtset GRID_CROSS_SIZE_PRIMARY 0 ANNOT_FONT_SIZE_PRIMARY 10 psbasemap -R0/6.5/0/9 -Jx1i -B0 -P -K -U"Example 1 in Cookbook" >! ../example_01.ps pscoast -Rg -JH0/6i -X0.25i -Y0.5i -O -K -Bg30 -Dc -Glightgray >> ../example_01.ps grdcontour osu91a1f_16.nc -J -C10 -A50+s7 -Gd4i -L-1000/-1 -Wcthinnest,- - Wathin,- -O -K \ -T0.1i/0.02i >> ../example_01.ps Install Geoware: 102 GB Datasets

1. Seismology 2. Volcanism 3. Plate Tectonics 4. Potential Fields 5. Surface Relief 6. Coastlines 7. Miscellaneous 8. Shuttle Radar Topography Mission (SRTM, 67 GB) Install Geoware: 102 GB Datasets