Scroll to navigation

GMT(1gmt) GMT GMT(1gmt)

NAME

gmt - The Generic Mapping Tools data processing and display software package

INTRODUCTION

GMT is a collection of public-domain Unix tools that allows you to manipulate x,y and x,y,z data sets (filtering, trend fitting, gridding, projecting, etc.) and produce PostScript illustrations ranging from simple x-y plots, via contour maps, to artificially illuminated surfaces and 3-D perspective views in black/white or full color. Linear, log10, and power scaling is supported in addition to over 30 common map projections. The processing and display routines within GMT are completely general and will handle any (x,y) or (x,y,z) data as input.

SYNOPSIS

gmt is the main program that can start any of the modules:

gmt module module-options

Starts a given GMT module with the module-options that pertain to that particular module. A few special commands are also available:

gmt clear items

Deletes current defaults, or the cache, data or sessions directories. Choose between defaults (deletes the current gmt.conf file used for the current modern session), cache (deletes the user's cache directory and all of its content), data (deletes the user's data download directory and all of its content), or all (does all of the above).

gmt begin [session-prefix] [format] [options]

Initializes a new GMT session under modern mode [Default is classic mode]. All work is performed in a temporary work directory. The optional session-prefix assigns a name to the session, and this may be used as figure name for single-figure sessions [gmtsession]. Likewise, the optional format can be used to override the default graphics format [PDF].

gmt figure [prefix] [format(s)] [options]

Specifies the desired name, output format(s) and any custom arguments that should be passed to psconvert when producing this figure. All subsequent plotting will be directed to this current figure until another gmt figure command is issued or the session ends. The prefix is used to build final figure names when extensions are automatically appended. The format setting is a comma-separated list of desired extensions (e.g., pdf,png).

gmt inset [arguments]

Allows users to place a map inset by temporarily changing where plotting takes place as well as the region and projection, then resets to previous stage.

gmt subplot [arguments]

Allows users to create a matrix of panels with automatic labeling and advancement.

gmt end [show]

Terminates a GMT modern mode session and automatically converts the registered illustration(s) to the specified formats, then eliminates the temporary work directory. The figures are placed in the current directory.

If no module is given then several other options are available:

List and description of GMT modules.
Write a GMT modern mode script template to stdout.
Show directory of executables and exit.
Show the citation for the latest GMT publication.
Show number of available cores.
Show data directory/ies and exit.
Show URL of the remote GMT data server.
Show the DOI of the current release.
List module names on stdout and exit.
Show the path of the shared GMT library.
Show plugin directory and exit.
Show share directory and exit.
Print version and exit.
=
Check if that module exist and if so the program will exit with status of 0; otherwise the status of exit will be non-zero.

COMMAND-LINE COMPLETION

GMT provides basic command-line completion (tab completion) for bash. The completion rules are either installed in /etc/bash_completion.d/gmt or <prefix>/share/tools/gmt_completion.bash. Depending on the distribution, you may still need to source the gmt completion file from ~/.bash_completion or ~/.bashrc. For more information see Section command-line-completion in the CookBook.

GMT OVERVIEW

The following is a summary of all the programs supplied with GMT and a very short description of their purpose. Detailed information about each program can be found in the separate manual pages.

blockmean
blockmedian
blockmode
filter1d
fitcircle
2kml
connect
convert
defaults
get
info
math
select
set
spatial
simplify
vector
which
grd2cpt
grd2kml
grd2xyz
grdblend
grdclip
grdcontour
grdconvert
grdcut
grdedit
grdfft
grdfill
grdfilter
grdgradient
grdhisteq
grdimage
grdinfo
grdlandmask
grdmask
grdmath
grdpaste
grdproject
grdsample
grdtrack
grdtrend
grdvector
grdview
grdvolume
greenspline
kml2gmt
makecpt
mapproject
nearneighbor
project
basemap
clip
coast
contour
events
psconvert
histogram
image
legend
mask
rose
colorbar
text
wiggle
plot
plot3d
sample1d
spectrum1d
splitxyz
surface
trend1d
trend2d
triangulate
xyz2grd
Supplement geodesy:
velo
earthtide
gpsgridder
Supplement gshhg:
gshhg
Supplement img:
img2grd
Supplement mgd77:
mgd77convert
mgd77header
mgd77info
mgd77list
mgd77magref
mgd77manage
mgd77path
mgd77sniffer
mgd77track
Supplement potential:
gravmag3d
flexure
gravfft
grdflexure
grdgravmag3d
grdredpol
grdseamount
talwani2d
talwani3d
Supplement segy:
segy
segyz
segy2grd
Supplement seis:
coupe
meca
polar
sac
Supplement sph:
sphdistance
sphinterpolate
sphtriangulate
Supplement spotter:
backtracker
pmodeler
grdpmodeler
grdrotater
grdspotter
hotspotter
originater
polespotter
rotconverter
rotsmoother
Supplement x2sys:
x2sys_binlist
x2sys_cross
x2sys_datalist
x2sys_get
x2sys_init
x2sys_list
x2sys_merge
x2sys_put
x2sys_report
x2sys_solve

CUSTOM MODULES

The gmt program can also load custom modules from shared libraries built as specified in the GMT API documentation. This way your modules can benefit form the GMT infrastructure and extend GMT in specific ways.

THE COMMON GMT OPTIONS


-B[p|s]parameters -Jparameters -Jz|Zparameters -K -O
-Rwest/east/south/north[/zmin/zmax][+r]
-U[stamp]
-V[level]
-X[a|c|f|r][xshift[u]]
-Y[a|c|f|r][yshift[u]] -aflags -bbinary -dnodata -eregexp -fflags -ggaps -hheaders -iflags -jflags -nflags -oflags -pflags -r -sflags -ttransp -x[[-]n] -:[i|o]

DESCRIPTION

These are all the common GMT options that remain the same for all GMT programs. No space between the option flag and the associated arguments.

Set map Frame and Axes parameters. The Frame parameters are specified by

-B[axes][+b][+gfill][+n][+olon/lat][+ttitle]

where axes selects which axes to plot. By default, all 4 map boundaries (or plot axes) are plotted (named W, E, S, N). To customize, append the codes for those you want (e.g., WSn). Upper case means plot and annotate while lower case just plots and ticks the specified axes. To just draw an axis without annotation and ticks you can use the l(eft), r(ight), b(ottom), t(opt) and (for 3-D) u(p) codes. If a 3-D basemap is selected with -p and -Jz, append Z, z, or u to control the appearance of the vertical axis. By default a single vertical axes will be plotted at the most suitable map corner. Override the default by appending any combination of corner ids 1234, where 1 represents the lower left corner and the order goes counter-clockwise. Append +b to draw the outline of the 3-D cube defined by -R; this modifier is also needed to display gridlines in the x-z, y-z planes. Note that for 3-D views the title, if given, will be suppressed. You can paint the interior of the canvas with +gfill. Append +n to have no frame and annotations at all [Default is controlled by the codes]. Optionally append +oplon/plat to draw oblique gridlines about specified pole [regular gridlines]. Ignored if gridlines are not requested (below) and disallowed for the oblique Mercator projection. To add a plot title (+ttitle). The Frame setting is optional but can be invoked once to override the above defaults.

The Axes parameters are specified by

-B[p|s][x|y|z]intervals[+aangle|n|p][+l|Llabel][+pprefix][+uunit]

but you may also split this into two separate invocations for clarity, i.e.,


  • -B[p|s][x|y|z][+aangle|n|p][+l|Llabel][+pprefix][+s|Sseclabel][+uunit]
  • -B[p|s][x|y|z]intervals

    The first optional flag following -B selects p (rimary) [Default] or s (econdary) axes information (mostly used for time axes annotations). The [x|y|z] flags specify which axes you are providing information for. If none are given then we default to xy. If you wish to give different annotation intervals or labels for the various axes then you must repeat the B option for each axis (If a 3-D basemap is selected with -p and -Jz, use -Bz to give settings for the vertical axis.). To add a label to an axis, just append +llabel (Cartesian projections only). Use +L to force a horizontal label for y-axes (useful for very short labels). For Cartesian axes you may specify an alternate via +s which is used for right or upper axis axis label (with any +l label used for left and bottom axes). If the axis annotation should have a leading text prefix (e.g., dollar sign for those plots of your net worth) you can append +pprefix. For geographic maps the addition of degree symbols, etc. is automatic (and controlled by the GMT default setting FORMAT_GEO_MAP). However, for other plots you can add specific units by adding +uunit. If any of these text strings contain spaces or special characters you will need to enclose them in quotes. Cartesian x-axes also allow for the optional +aangle, which will plot slanted annotations; angle is measured with respect to the horizontal and must be in the -90 <= angle <= 90 range only. Also, +an is a shorthand for normal (i.e., +a90) and +ap for parallel (i.e., +a0) annotations [Default]. For the y-axis, arbitrary angles are not allowed but +an and +ap specify annotations normal [Default] and parallel to the axis, respectively. Note that these defaults can be changed via MAP_ANNOT_ORTHO.

    The intervals specification is a concatenated string made up of substrings of the form

    [a|f|g]stride[+|-phase][u].

    The leading a is used to specify the annotation and major tick spacing [Default], f for minor tick spacing, and g for gridline spacing. stride is the desired stride interval. The optional phase shifts the annotation interval by that amount (positive or negative). The optional unit indicates the unit of the stride and can be any of the ones listed below:

  • Y (year, plot with 4 digits)
  • y (year, plot with 2 digits)
  • O (month, plot using FORMAT_DATE_MAP)
  • o (month, plot with 2 digits)
  • U (ISO week, plot using FORMAT_DATE_MAP)
  • u (ISO week, plot using 2 digits)
  • r (Gregorian week, 7-day stride from start of week TIME_WEEK_START)
  • K (ISO weekday, plot name of weekdays in selected language)
  • k (weekday, plot number of day in the week (1–7) (see TIME_WEEK_START))
  • D (date, plot using FORMAT_DATE_MAP)
  • d (day, plot day of month 0-31 or year 1-366, via FORMAT_DATE_MAP)
  • R (day, same as d, aligned with TIME_WEEK_START)
  • H (hour, plot using FORMAT_CLOCK_MAP)
  • h (hour, plot with 2 digits)
  • M (minute, plot using FORMAT_CLOCK_MAP)
  • m (minute, plot with 2 digits)
  • S (second, plot using FORMAT_CLOCK_MAP)
  • s (second, plot with 2 digits).

Note for geographic axes m and s instead mean arc minutes and arc seconds. All entities that are language-specific are under control by GMT_LANGUAGE. Alternatively, for linear maps, we can omit stride, thus setting xinfo, yinfo, or zinfo to a plots annotations at automatically determined intervals,

  • ag plots both annotations and grid lines with the same spacing,
  • afg adds suitable minor tick intervals,
  • g plots grid lines with the same interval as if -Bf was used.

For custom annotations and intervals, let intervals be given as cintfile, where intfile contains any number of records with coord type [label]. Here, type is one or more letters from a|i, f, and g. For a|i you must supply a label that will be plotted at the coord location. For non-geographical projections: Give negative scale (in -Jx) or axis length (in -JX) to change the direction of increasing coordinates (i.e., to make the y-axis positive down). For log10 axes: Annotations can be specified in one of three ways:

1.
stride can be 1, 2, 3, or -n. Annotations will then occur at 1, 1-2-5, or 1-2-3-4-...-9, respectively; for -n we annotate every n't magnitude. This option can also be used for the frame and grid intervals.
2.
An l is appended to the tickinfo string. Then, log10 of the tick value is plotted at every integer log10 value.
3.
A p is appended to the tickinfo string. Then, annotations appear as 10 raised to log10 of the tick value.

For power axes: Annotations can be specified in one of two ways:

1.
stride sets the regular annotation interval.
2.
A p is appended to the tickinfo string. Then, the annotation interval is expected to be in transformed units, but the annotation value will be plotted as untransformed units. E.g., if stride = 1 and power = 0.5 (i.e., sqrt), then equidistant annotations labeled 1-4-9... will appear.

Finally, if your axis is in radians you can use multiples or fractions of pi to set such annotation intervals. The format is [n]pi[m], for an optional integer n and optional m fractions 2, 3, or 4.

These GMT parameters can affect the appearance of the map boundary: MAP_ANNOT_MIN_ANGLE, MAP_ANNOT_MIN_SPACING, FONT_ANNOT_PRIMARY, FONT_ANNOT_SECONDARY, MAP_ANNOT_OFFSET_PRIMARY, MAP_ANNOT_OFFSET_SECONDARY, MAP_ANNOT_ORTHO, MAP_FRAME_AXES, MAP_DEFAULT_PEN, MAP_FRAME_TYPE, FORMAT_GEO_MAP, MAP_FRAME_PEN, MAP_FRAME_WIDTH, MAP_GRID_CROSS_SIZE_PRIMARY, MAP_GRID_PEN_PRIMARY, MAP_GRID_CROSS_SIZE_SECONDARY, MAP_GRID_PEN_SECONDARY, FONT_TITLE, FONT_LABEL, MAP_LINE_STEP, MAP_ANNOT_OBLIQUE, FORMAT_CLOCK_MAP, FORMAT_DATE_MAP, FORMAT_TIME_PRIMARY_MAP, FORMAT_TIME_SECONDARY_MAP, GMT_LANGUAGE, TIME_WEEK_START, MAP_TICK_LENGTH_PRIMARY, and MAP_TICK_PEN_PRIMARY; see the gmt.conf man page for details.


-Jparameters

Select map projection. The following character determines the projection. If the character is upper case then the argument(s) supplied as scale(s) is interpreted to be the map width (or axis lengths), else the scale argument(s) is the map scale (see its definition for each projection). UNIT is cm, inch, or point, depending on the PROJ_LENGTH_UNIT setting in gmt.conf, but this can be overridden on the command line by appending c, i, or p to the scale or width values. Append +dh, +du, or +dl to the given width if you instead want to set map height, the maximum (upper) dimension, or the minimum (lower) dimension, respectively [Default is +dw for width]. In case the central meridian is an optional parameter and it is being omitted, then the center of the longitude range given by the -R option is used. The default standard parallel is the equator. The ellipsoid used in the map projections is user-definable by editing the gmt.conf file in your home directory. 73 commonly used ellipsoids and spheroids are currently supported, and users may also specify their own custom ellipsoid parameters [Default is WGS-84]. Several GMT parameters can affect the projection: PROJ_ELLIPSOID, GMT_INTERPOLANT, PROJ_SCALE_FACTOR, and PROJ_LENGTH_UNIT; see the gmt.conf man page for details. Choose one of the following projections (The E or C after projection names stands for Equal-Area and Conformal, respectively):

CYLINDRICAL PROJECTIONS:


-Jclon0/lat0/scale or -JClon0/lat0/width (Cassini).
Give projection center lon0/lat0 and scale (1:xxxx or UNIT/degree).




-Jcyl_stere/[lon0/[lat0/]]scale or -JCyl_stere/[lon0/[lat0/]]width (Cylindrical Stereographic).
Give central meridian lon0 (optional), standard parallel lat0 (optional), and scale along parallel (1:xxxx or UNIT/degree). The standard parallel is typically one of these (but can be any value):
  • 66.159467 - Miller's modified Gall
  • 55 - Kamenetskiy's First
  • 45 - Gall's Stereographic
  • 30 - Bolshoi Sovietskii Atlas Mira or Kamenetskiy's Second
  • 0 - Braun's Cylindrical







-Jj[lon0/]scale or -JJ[lon0/]width (Miller Cylindrical Projection).
Give the central meridian lon0 (optional) and scale (1:xxxx or UNIT/degree).




-Jm[lon0/[lat0/]]scale or -JM[lon0/[lat0/]]width (Mercator [C])
Give central meridian lon0 (optional), standard parallel lat0 (optional), and scale along parallel (1:xxxx or UNIT/degree).




-Joparameters (Oblique Mercator [C]).
Typically used with -RLLx/LLy/URx/URyr or with projected coordinates. Specify one of:
Set projection center lon0/lat0, azimuth of oblique equator, and scale.
Set projection center lon0/lat0, another point on the oblique equator lon1/lat1, and scale.
Set projection center lon0/lat0, pole of oblique projection lonp/latp, and scale. Give scale along oblique equator (1:xxxx or UNIT/degree). Use upper-case A|B|C to remove enforcement of a northern hemisphere pole.





-Jq[lon0/[lat0/]]scale or -JQ[lon0/[lat0/]]width (Cylindrical Equidistant).
Give the central meridian lon0 (optional), standard parallel lat0 (optional), and scale (1:xxxx or UNIT/degree). The standard parallel is typically one of these (but can be any value):
  • 61.7 - Grafarend and Niermann, minimum linear distortion
  • 50.5 - Ronald Miller Equirectangular
  • 43.5 - Ronald Miller, minimum continental distortion
  • 42 - Grafarend and Niermann
  • 37.5 - Ronald Miller, minimum overall distortion
  • 0 - Plate Carree, Simple Cylindrical, Plain/Plane Chart







-Jtlon0/[lat0/]scale or -JTlon0/[lat0/]width (Transverse Mercator [C])
Give the central meridian lon0, central parallel lat0 (optional), and scale (1:xxxx or UNIT/degree).




-Juzone/scale or -JUzone/width (UTM - Universal Transverse Mercator [C]).
Give the UTM zone (A,B,1-60[C-X],Y,Z)) and scale (1:xxxx or UNIT/degree). Zones: If C-X not given, prepend - or + to enforce southern or northern hemisphere conventions [northern if south > 0].




-Jy[lon0/[lat0/]]scale or -JY[lon0/[lat0/]]width (Cylindrical Equal-Area [E]).
Give the central meridian lon0 (optional), standard parallel lat0 (optional), and scale (1:xxxx or UNIT/degree). The standard parallel is typically one of these (but can be any value):
  • 50 - Balthasart
  • 45 - Gall
  • 37.0666 - Caster
  • 37.4 - Trystan Edwards
  • 37.5 - Hobo-Dyer
  • 30 - Behrman
  • 0 - Lambert (default)





CONIC PROJECTIONS:



Give projection center lon0/lat0, two standard parallels lat1/lat2, and scale (1:xxxx or UNIT/degree).



Give projection center lon0/lat0, two standard parallels lat1/lat2, and scale (1:xxxx or UNIT/degree).



Give origin lon0/lat0, two standard parallels lat1/lat2, and scale along these (1:xxxx or UNIT/degree).



Give the central meridian lon0 (optional), reference parallel lat0 (optional, default = equator), and scale along central meridian (1:xxxx or UNIT/degree).

AZIMUTHAL PROJECTIONS:

Except for polar aspects, -Rw/e/s/n will be reset to -Rg. Use -R<...>r for smaller regions.



lon0/lat0 specifies the projection center. horizon specifies the max distance from projection center (in degrees, <= 180, default 90). Give scale as 1:xxxx or radius/lat, where radius is distance in UNIT from origin to the oblique latitude lat.



lon0/lat0 specifies the projection center. horizon specifies the max distance from projection center (in degrees, <= 180, default 180). Give scale as 1:xxxx or radius/lat, where radius is distance in UNIT from origin to the oblique latitude lat.



lon0/lat0 specifies the projection center. horizon specifies the max distance from projection center (in degrees, < 90, default 60). Give scale as 1:xxxx or radius/lat, where radius is distance in UNIT from origin to the oblique latitude lat.



lon0/lat0 specifies the projection center. horizon specifies the max distance from projection center (in degrees, <= 90, default 90). Give scale as 1:xxxx or radius/lat, where radius is distance in UNIT from origin to the oblique latitude lat.
lon0/lat0 specifies the projection center. altitude is the height (in km) of the viewpoint above local sea level. If altitude is less than 10, then it is the distance from the center of the earth to the viewpoint in earth radii. If altitude has a suffix r then it is the radius from the center of the earth in kilometers. azimuth is measured to the east of north of view. tilt is the upward tilt of the plane of projection. If tilt is negative, then the viewpoint is centered on the horizon. Further, specify the clockwise twist, Width, and Height of the viewpoint in degrees. Give scale as 1:xxxx or radius/lat, where radius is distance in UNIT from origin to the oblique latitude lat.



lon0/lat0 specifies the projection center. horizon specifies the max distance from projection center (in degrees, < 180, default 90). Give scale as 1:xxxx (true at pole) or lat0/1:xxxx (true at standard parallel lat) or radius/lat (radius in UNIT from origin to the oblique latitude lat). Note if 1:xxxx is used then to specify horizon you must also specify the lat as +-90 to avoid ambiguity.

MISCELLANEOUS PROJECTIONS:



Give the central meridian lon0 (optional) and scale along equator (1:xxxx or UNIT/degree).



Give the central meridian lon0 (optional) and scale along equator (1:xxxx or UNIT/degree).



Give the central meridian lon0 (optional) and scale along equator (1:xxxx or UNIT/degree).
Give the central meridian lon0 (optional) and scale along equator (1:xxxx or UNIT/degree).



Give the central meridian lon0 (optional) and scale along equator (1:xxxx or UNIT/degree).



Give the central meridian lon0 (optional) and scale along equator (1:xxxx or UNIT/degree).



Give the central meridian lon0 (optional) and scale along equator (1:xxxx or UNIT/degree).



Give the central meridian lon0 (optional) and scale along equator (1:xxxx or UNIT/degree).

NON-GEOGRAPHICAL PROJECTIONS:



-Jp[a]scale[/origin][r|z] or -JP[a]width[/origin][r|z] (Polar coordinates (theta,r))

Optionally insert a after -Jp [ or -JP] for azimuths CW from North instead of directions CCW from East [Default]. Optionally append /origin in degrees to indicate an angular offset [0]). Finally, append r if r is elevations in degrees (requires s >= 0 and n <= 90) or z if you want to annotate depth rather than radius [Default]. Give scale in UNIT/r-unit.



-Jxx-scale[/y-scale] or -JXwidth[/height] (Linear, log, and power scaling)

Give x-scale (1:xxxx or UNIT/x-unit) and/or y-scale (1:xxxx or UNIT/y-unit); or specify width and/or height in UNIT. y-scale=x-scale if not specified separately and using 1:xxxx implies that x-unit and y-unit are in meters. Use negative scale(s) to reverse the direction of an axis (e.g., to have y be positive down). Set height or width to 0 to have it recomputed based on the implied scale of the other axis. Optionally, append to x-scale, y-scale, width or height one of the following:

Data are geographical coordinates (in degrees).
Take log10 of values before scaling.
Raise values to power before scaling.
Input coordinates are time relative to TIME_EPOCH.
Input coordinates are absolute time.

For mixed axes with only one geographic axis you may need to set -f as well.





When -J is used without any further arguments, or just with the projection type, the arguments of the last used -J, or the last used -J with that projection type, will be used.

Set z-axis scaling; same syntax as -Jx.

Starting at GMT6 it is possible to use the PROJ.4 library to do coordinate and datum transforms. This is achieved via GDAL so it requires that GMT build is linked to that library. It is, however, beyond the scope of this manual to document the PROJ.4 syntax (that is the syntax of the proj and cs2cs programs) so users are referred to it http://proj4.org/apps/index.html for the details.

The usage of PROJ.4 follows very closely the syntax of proj and cs2cs. The projection parameters are encapsulated under the -J option. Because there are normally several parameters defining a referencing system separated by spaces (in PROJ.4 or GDAL) we can either use double quotes as in -J"+proj=merc +ellps=WGS84 +units=m" or just glue all parameters like in -J+proj=merc+ellps=WGS84+units=m.

Using EPSG codes is also possible (but need the setting of the GDAL_DATA environment variable to point to the GDAL's data sub-directory). For example -JEPSG:4326 sets the WGS-84 system.

For mapproject and grdproject we can go directly from the referencing system A to B without the intermediate step of converting to geographic coordinates. That is obtained (like in cs2cs) by using the +to keyword. Example: -JEPSG:4326+to+proj=aeqd+ellps=WGS84+units=m. A much awaited bonus is also that we now do not need to set -R to do point coordinate conversions.

While for point and grid conversions done by mapproject and grdproject we can use all PROJ.4 projections, the situations is, however, rather more limited for mapping purposes. Here, only the subset of the PROJ.4 projections that can be mapped into the GMT projections syntax is available to use. Another aspect that is not present in PROJ.4, because it's not a mapping library, is how to set the map scale or map dimension. We introduced the two extensions +width=size and +scale=1:xxxx that work exactly like the map width and scale in classical GMT. It is also allowed to provide the scale (but NOT the width) by appending the string "/1:xxx" to the end of the projection parameters.


xmin, xmax, ymin, and ymax specify the region of interest. For geographic regions, these limits correspond to west, east, south, and north and you may specify them in decimal degrees or in [±]dd:mm[:ss.xxx][W|E|S|N] format. Append +r if lower left and upper right map coordinates are given instead of west/east/south/north. The two shorthands -Rg and -Rd stand for global domain (0/360 and -180/+180 in longitude respectively, with -90/+90 in latitude). Set geographic regions by specifying ISO country codes from the Digital Chart of the World using -Rcode1,code2,...[+r|R[incs]] instead: Append one or more comma-separated countries using the 2-character ISO 3166-1 alpha-2 convention. To select a state of a country (if available), append .state, e.g, US.TX for Texas. To specify a whole continent, prepend = to any of the continent codes AF (Africa), AN (Antarctica), AS (Asia), EU (Europe), OC (Oceania), NA (North America), or SA (South America). Use +r to modify the bounding box coordinates from the polygon(s): Append inc, xinc/yinc, or winc/einc/sinc/ninc to adjust the region to be a multiple of these steps [no adjustment]. Alternatively, use +R to extend the region outward by adding these increments instead [no extension]. Alternatively for grid creation, give -Rcodex0/y0/nx/ny, where code is a 2-character combination of L, C, R (for left, center, or right) and T, M, B for top, middle, or bottom. e.g., BL for lower left. This indicates which point on a rectangular region the x0/y0 coordinate refers to, and the grid dimensions nx and ny with grid spacings via -I is used to create the corresponding region. Alternatively, specify the name of an existing grid file and the -R settings (and grid spacing, if applicable) are copied from the grid. When -R is used without any further arguments, the values from the last use of -R in a previous GMT command will be used. For calendar time coordinates you may either give (a) relative time (relative to the selected TIME_EPOCH and in the selected TIME_UNIT; append t to -JX|x), or (b) absolute time of the form [date]T[clock] (append T to -JX|x). At least one of date and clock must be present; the T is always required. The date string must be of the form [-]yyyy[-mm[-dd]] (Gregorian calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock string must be of the form hh:mm:ss[.xxx]. The use of delimiters and their type and positions must be exactly as indicated (however, input, output and plot formats are customizable; see gmt.conf). You can also use Cartesian projected coordinates compatible with the chosen projection. Append the length unit via the +u modifier, (e.g., -R-200/200/-300/300+uk for a 400 by 600 km rectangular area centered on the projection center (0, 0). These coordinates are internally converted to the corresponding geographic (longitude, latitude) coordinates for the lower left and upper right corners. This form is convenient when you want to specify a region directly in the projected units (e.g., UTM meters). For Cartesian data in radians you can also use [±][s]pi[f], for optional integer scales s and fractions f.

In case of perspective view p, a z-range (zmin, zmax) can be appended to indicate the third dimension. This needs to be done only when using the Jz option, not when using only the p option. In the latter case a perspective view of the plane is plotted, with no third dimension.

Draw the GMT Unix System time stamp on the plot. By appending +jjust and/or +odx/dy, the user may specify the justification of the stamp and where the stamp should fall on the page relative to lower left corner of the plot. For example, +jBL+o0/0 will align the lower left corner of the time stamp with the bottom left corner of the plot [BL]. Optionally, append a label, or give +c which will plot the command string. The GMT parameters MAP_LOGO, MAP_LOGO_POS, and FORMAT_TIME_STAMP can affect the appearance; see the gmt.conf man page for details. The time string will be in the locale set by the environment variable TZ (generally local time).

Select verbose mode, which will send progress reports to stderr. Choose among 6 levels of verbosity; each level adds more messages: q - Complete silence, not even fatal error messages are produced. n - Normal verbosity: produce only fatal error messages. c - Produce also compatibility warnings (same as when -V is omitted). v - Produce also warnings and progress messages (same as -V only). l - Produce also detailed progress messages. d - Produce also debugging messages.

-X[a|c|f|r][xshift[u]]

Shift plot origin relative to the current origin by (xshift,yshift) and optionally append the length unit (c, i, or p). You can prepend a to shift the origin back to the original position after plotting, prepend c to center the plot on the center of the paper (optionally add shift), prepend f to shift the origin relative to the fixed lower left corner of the page, or prepend r [Default] to move the origin relative to its current location. For overlays the default (xshift,yshift) is (r0), otherwise it is (r1i). When -X or -Y are used without any further arguments, the values from the last use of that option in a previous GMT command will be used. Note that -X and -Y can also access the previous plot dimensions w and h and construct offsets that involves them. For instance, to move the origin up 2 cm beyond the height of the previous plot, use -Yh+2c. To move the origin half the width to the right, use -Xw/2.

Control how aspatial data are handled in GMT during input and output. Reading OGR/GMT-formatted files: To assign certain aspatial data items to GMT data columns, give one or more comma-separated associations col=name, where name is the name of an aspatial attribute field in a OGR/GMT file and whose value we wish to use as data input for column col. In addition, to assign an aspatial value to non-column data, you may specify col as D for distance, G for fill, I for ID, L for label, T for text, W for pen, and Z for value [e.g., used to look up color via a CPT]. If you skip the leading "col=" in the argument then we supply (and automatically increment) a column value starting at 2. Give just -a to select all aspatial items to be added to the input record. Writing OGR/GMT-formatted files: To write OGR/GMT-formatted files, give one or more comma-separated associations col=name[:type], with an optional data type from DOUBLE, FLOAT, INTEGER, CHAR, STRING, DATETIME, or LOGICAL [DOUBLE]. To extract information from GMT multisegment headers encoded in the -Ddistance, -Gfill, -IID, -Llabel, -Ttext, -Wpen, or -Zvalue settings, specify COL as D, G, I, L, T, W or Z, respectively; type will be set automatically. Finally, you must append +ggeometry, where geometry is either POINT, LINE, or POLY. Optionally, prepend M for multi-versions of these geometries. To force the clipping of features crossing the Dateline, use upper-case +G instead. See GMT Appendix Q for details of the OGR/GMT file format.

Select native binary format for primary input (secondary inputs are always ASCII). Here, ncols is the number of data columns of given type, which must be one of c (int8_t, aka char), u (uint8_t, aka unsigned char), h (int16_t, 2-byte signed int), H (uint16_t, 2-byte unsigned int), i (int32_t, 4-byte signed int), I ((capital i) uint32_t, 4-byte unsigned int), l ((lower case el) int64_t, 8-byte signed int), L (uint64_t, 8-byte unsigned int), f (4-byte single-precision float), and d (8-byte double-precision float). In addition, use x to skip ncols bytes anywhere in the record. For records with mixed types, simply append additional comma-separated combinations of ncols type (no space). Append w to any item to force byte-swapping. Alternatively, append +l|b to indicate that the entire data file should be read as little- or big-endian, respectively. The cumulative number of ncols may exceed the columns actually needed by the program. If ncols is not specified we assume that type applies to all columns and that ncols is implied by the expectation of the program. If the input file is netCDF, no -b is needed; simply append ?var1/var2/... to the filename to specify the variables to be read.

Select native binary output. Here, ncols is the actual number of data columns of type type, which must be one of c, u, h, H, i, I (capital i), l (lower case ell), L, f, and d (see -bi). For a mixed-type output record, append additional comma-separated combinations of ncols type (no space). Append w to any item to force byte-swapping or +l|b for byte-swapping of the entire record. If ncols is not specified we assume that type applies to all columns and that ncols is implied by the default output of the program. Note: NetCDF file output is not supported.

Used to advance to the selected subplot panel. Only allowed when in subplot mode. Available to all plot modules. If no arguments are given then we advance to the next panel in the selected order. If no -c is given and we just entered subplot mode then the first panel (top, left) is selected. Instead of row, col you may give the one-dimensional index which depends on the order you set via -A when the subplot was defined. Note: row, col, and index all start at 0.

Control how user-coded missing data values are translated to official NaN values in GMT. For input data we replace any value that equals nodata with NaN. For output data we replace any NaN with the chosen nodata value. Use -di or -do to only affect input or output.

Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.

Examine all output columns and if any item equals NAN we substitute it with the chosen missing data value nodata.

Only accept ASCII data records that contains the specified pattern. To reverse the search, i.e., to only accept data record that do not contain the specified pattern, use -e~. Should your pattern happen to start with ~ you need to escape this character with a backslash [Default accepts all data records]. For matching data records against extended regular expressions enclose the expression in slashes. Append i for case-insensitive matching. For a list of such patterns, give +ffile with one pattern per line. To give a single pattern starting with +f, escape it with a backslash.

Specify the data types of input and/or output columns (time or geographical data). Specify i or o to make this apply only to input or output [Default applies to both]. Give one or more columns (or column ranges) separated by commas, or use -f multiple times (column ranges must be given in the format start[:inc]:stop, where inc defaults to 1 if not specified). Append T (absolute calendar time), t (relative time in chosen TIME_UNIT since TIME_EPOCH), x (longitude), y (latitude), p[unit] (projected x,y map coordinates in given unit [meter]) or f (floating point) to each column or column range item. Shorthands -f[i|o]g means -f[i|o]0x,1y (geographic coordinates) and -f[i|o]c means -f[i|o]0-1f (Cartesian coordinates)

Examine the spacing between consecutive data points in order to impose breaks in the line. Append x|X or y|Y to define a gap when there is a large enough change in the x or y coordinates, respectively, or d|D for distance gaps; use upper case to calculate gaps from projected coordinates. For gap-testing on other columns use [col]z; if col is not prepended the it defaults to 2 (i.e., 3rd column). Append gap and optionally a unit u and modifiers +n or +p. Here, +n means previous minus current column value must exceed gap to be a gap and +p means current minus previous column value must exceed gap. Otherwise the absolute value of the difference must exceed gap. For geographic data (x|y|d), the unit u may be arc degree, minute, or second, or meter [Default], foot, kilometer, Mile, nautical mile, or survey foot. For projected data (X|Y|D), choose from inch, centimeter, or point [Default unit set by PROJ_LENGTH_UNIT]. Note: For x|y|z with time data the unit is instead controlled by TIME_UNIT. Repeat the option to specify multiple criteria, of which any can be met to produce a line break. Issue an additional -ga to indicate that all criteria must be met instead.

Primary input file(s) has header record(s). If used, the default number of header records is IO_N_HEADER_RECS [1]. Use -hi if only the primary input data should have header records [Default will write out header records if the input data have them]. Blank lines and lines starting with # are always skipped. For output you may request additional headers to be written via the option modifiers, and use +d to remove existing header records. Append +c to issue a header comment with column names to the output [none]. Append +r to add a remark comment to the output [none]. Append +t to add a title comment to the output [none]. These optional strings may contain n to indicate line-breaks). If used with native binary data we interpret n to instead mean the number of bytes to skip on input or pad on output.

Select specific data columns for primary input, in arbitrary order. Columns not listed will be skipped. Give individual columns (or column ranges in the format start[:inc]:stop, where inc defaults to 1 if not specified) separated by commas [Default reads all columns in order, starting with the first column (0)]. Columns may be repeated. To each column, optionally add any of the following: +l takes log10 of the input values first; +sscale, subsequently multiplies by a given scale factor [1]; +ooffset, finally adds a given offset [0]. Normally, any trailing text is read but when i is used you must explicitly add the column t to retain the text. To only ingest a single word from the trailing text, append the word number (first word is 0). Finally, -in will simply read the numerical input and skip any trailing text.

Determine how spherical distances are calculated in modules that support this. By default (-jg) we perform great circle distance calculations and parameters such as distance increments or radii will be compared against calculated great circle distances. To simplify and speed up calculations you can select Flat Earth mode (-jf) which gives an approximate and fast result. Alternatively, you can select ellipsoidal (-je) or geodesic mode for the highest precision (and slowest calculation time). All spherical distance calculations depends on the current ellipsoid (PROJ_ELLIPSOID), the definition of the mean radius (PROJ_MEAN_RADIUS), and the specification of latitude type (PROJ_AUX_LATITUDE). Geodesic distance calculations is also controlled by method (PROJ_GEODESIC).

Select grid interpolation mode by adding b for B-spline smoothing, c for bicubic interpolation, l for bilinear interpolation, or n for nearest-neighbor value (for example to plot categorical data). Optionally, append +a to switch off antialiasing (where supported). Append +bBC to override the boundary conditions used, adding g for geographic, p for periodic, or n for natural boundary conditions. For the latter two you may append x or y to specify just one direction, otherwise both are assumed. Append +c to clip the interpolated grid to input z-min/max [Default may exceed limits]. Append +tthreshold to control how close to nodes with NaNs the interpolation will go. A threshold of 1.0 requires all (4 or 16) nodes involved in interpolation to be non-NaN. 0.5 will interpolate about half way from a non-NaN value; 0.1 will go about 90% of the way, etc. [Default is bicubic interpolation with antialiasing and a threshold of 0.5, using geographic (if grid is known to be geographic) or natural boundary conditions].

Select specific data columns for primary output, in arbitrary order. Columns not listed will be skipped. Give columns (or column ranges in the format start[:inc]:stop, where inc defaults to 1 if not specified) separated by commas. Columns may be repeated. [Default writes all columns in order]. Normally, any trailing text in the internal records will be written but when -o is used you must explicitly add the column t. To only output a single word from the trailing text, append the word number (first word is 0). Finally, -on will simply write the numerical output only and skip any trailing text.

Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90]. When -p is used in consort with -Jz or -JZ, a third value can be appended which indicates at which z-level all 2D material, like the plot frame, is plotted (in perspective). [Default is at the bottom of the z-axis]. Use -px or -py to plot against the "wall" x = level or y = level (default is on the horizontal plane, which is the same as using -pz). For frames used for animation, note we fix the center of your data domain. Specify another center using a particular world coordinate point with +wlon0/lat0[/z0]) which will project to the center of your page size, or specify the coordinates of the projected 2-D view point with +vx0/y0. When -p is used without any further arguments, the values from the last use of -p in a previous GMT command will be used. Alternatively, you can perform a simple rotation about the z-axis by just giving the rotation angle. Optionally, use +v or +w to select another axis location than the plot origin.

Force gridline or pixel node registration [Just -r sets pixel registration]. If no -r is given then gridline registration is selected. (Node registrations are defined in Section grid-registration of the GMT Technical Reference and Cookbook.)

Suppress output for records whose z-value equals NaN [Default outputs all records]. Append +a to skip records where at least one field equal NaN, or append +r to reverse the suppression, i.e., only output the records whose z-value equals NaN. Alternatively, indicate a comma-separated list of all columns or column ranges to consider for this NaN test (Column ranges must be given in the format start[:inc]:stop, where inc defaults to 1 if not specified).

Set transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque]. Only visible when PDF or raster format output is selected.

Limit the number of cores to be used in any OpenMP-enabled multi-threaded algorithms. By default we try to use all available cores. Append n to only use n cores (if too large it will be truncated to the maximum cores available). Finally, give a negative n to select (all - n) cores (or at least 1 if n equals or exceeds all). The -x option is only available to GMT modules compiled with OpenMP support.

-:[i|o]
Swap 1st and 2nd column on input and/or output [Default is no swapping]. Append i to select input only or o to select output only. [Default affects both]. This option is typically used to handle (latitude, longitude) files; see also -icols[l][sscale][ooffset][,...].

-^ or just -
Print a short message about the syntax of the command, then exits (NOTE: on Windows just use -).
-+ or just +
Print an extensive usage (help) message, including the explanation of any module-specific option (but not the GMT common options), then exits.
-? or no arguments
Print a complete usage (help) message, including the explanation of all options, then exits.
Temporarily override a GMT default setting; repeatable. See /gmt.conf for parameters.

Specifying Color

The color of lines, areas and patterns can be specified by a valid color name, by a gray shade (in the range 0-255), by a decimal color code (r/g/b, each in range 0-255; h-s-v, ranges 0-360, 0-1, 0-1; or c/m/y/k, each in range 0-1), or by a hexadecimal color code (#rrggbb, as used in HTML). For transparency, append @transparency in the 0-100 percent range [0 or opaque] (Only visible when PDF or raster format output is selected.). See gmtcolors for more information and a full list of color names.

Specifying Fill

The attribute fill specifies the solid shade or solid color (see Specifying Color above) or the pattern used for filling polygons. Patterns are specified as ppattern, where pattern set the number of the built-in pattern (1-90) or the name of a raster image file. The optional +rdpi sets the resolution of the image [1200]. For 1-bit rasters: use upper case P for inverse video, or append +fcolor and/or +bcolor to specify fore- and background colors (use color = - for transparency). See GMT Cookbook & Technical Reference Appendix E for information on individual built-in patterns.

Specifying Fonts

The attributes of text fonts as defined by font is a comma delimited list of size, fonttype and fill, each of which is optional. size is the font size (usually in points) but c or i can be added to indicate other units. fonttype is the name (case sensitive!) of the font or its equivalent numerical ID (e.g., Helvetica-Bold or 1). fill specifies the gray shade, color or pattern of the text (see Specifying Fill above). Optionally, you may append =pen to the fill value in order to draw a text outline. If you want to avoid that the outline partially obscures the text, append append =~pen instead; in that case only half the linewidth is plotted on the outside of the font only. If an outline is requested, you may optionally skip the text fill by setting it to -, in which case the full pen width is always used. If any of the font attributes is omitted their default or previous setting will be retained.

The 35 available fonts (plus 4 optional Japanese fonts) are:

0.
Helvetica
1.
Helvetica-Bold
2.
Helvetica-Oblique
3.
Helvetica-BoldOblique
4.
Times-Roman
5.
Times-Bold
6.
Times-Italic
7.
Times-BoldItalic
8.
Courier
9.
Courier-Bold
10.
Courier-Oblique
11.
Courier-BoldOblique
12.
Symbol
13.
AvantGarde-Book
14.
AvantGarde-BookOblique
15.
AvantGarde-Demi
16.
AvantGarde-DemiOblique
17.
Bookman-Demi
18.
Bookman-DemiItalic
19.
Bookman-Light
20.
Bookman-LightItalic
21.
Helvetica-Narrow
22.
Helvetica-Narrow-Bold
23.
Helvetica-Narrow-Oblique
24.
Helvetica-Narrow-BoldOblique
25.
NewCenturySchlbk-Roman
26.
NewCenturySchlbk-Italic
27.
NewCenturySchlbk-Bold
28.
NewCenturySchlbk-BoldItalic
29.
Palatino-Roman
30.
Palatino-Italic
31.
Palatino-Bold
32.
Palatino-BoldItalic
33.
ZapfChancery-MediumItalic
34.
ZapfDingbats
35.
Ryumin-Light-EUC-H
36.
Ryumin-Light-EUC-V
37.
GothicBBB-Medium-EUC-H
38.
GothicBBB-Medium-EUC-V


Specifying Pens

The attributes of lines and symbol outlines as defined by pen is a comma-delimited list of width, color and style, each of which is optional. width can be indicated as a measure (in points (this is the default), centimeters, or inches) or as faint, default, thin[ner|nest], thick[er|est], fat[ter|test], or obese. color specifies a gray shade or color (see Specifying Color above). style can be any of 'solid', 'dashed' 'dotted', 'dashdot', or 'dotdash', or a custom combination of dashes '-' and dots '.'. If any of the attributes is omitted their default or previous setting will be retained. See GMT Cookbook & Technical Reference Specifying pen attributes for more information.

ASCII FORMAT PRECISION

The ASCII output formats of numerical data are controlled by parameters in your gmt.conf file. Longitude and latitude are formatted according to FORMAT_GEO_OUT, absolute time is under the control of FORMAT_DATE_OUT and FORMAT_CLOCK_OUT, whereas general floating point values are formatted according to FORMAT_FLOAT_OUT. Be aware that the format in effect can lead to loss of precision in ASCII output, which can lead to various problems downstream. If you find the output is not written with enough precision, consider switching to binary output (-bo if available) or specify more decimals using the FORMAT_FLOAT_OUT setting.

GRID FILE FORMATS

By default GMT writes out grids as single precision floats in a COARDS-complaint netCDF file format. However, GMT is able to produce and read grid files in many other commonly used grid file formats and also facilitates so called "packing" of grids, writing out floating point data as 1- or 2-byte integers. To specify the precision, scale and offset, the user should add the suffix [=id][+sscale][+ooffset][+ninvalid], where id is a two-letter identifier of the grid type and precision, and the scale, offset and invalid are the arguments of optional modifiers to be applied to all grid values, Here, invalid is the value used to indicate missing data. In case the id is not provided, as in +sscale than a id=nf is assumed. When reading grids, the format is generally automatically recognized from almost all of those formats that GMT and GDAL combined offer. If not, the same suffix can be added to input grid file names. See grdconvert and Section grid-file-format of the GMT Technical Reference and Cookbook for more information.

When reading a netCDF file that contains multiple grids, GMT will read, by default, the first 2-dimensional grid that can find in that file. To coax GMT into reading another multi-dimensional variable in the grid file, append ?varname to the file name, where varname is the name of the variable. Note that you may need to escape the special meaning of ? in your shell program by putting a backslash in front of it, or by placing the filename and suffix between quotes or double quotes. The ?varname suffix can also be used for output grids to specify a variable name different from the default: "z". See grdconvert and Sections modifiers-for-CF and grid-file-format of the GMT Technical Reference and Cookbook for more information, particularly on how to read splices of 3-, 4-, or 5-dimensional grids.

CLASSIC MODE OPTIONS

These options are only used in classic mode and are listed here just for reference.

More PostScript code will be appended later [Default terminates the plot system]. Required for all but the last plot command when building multi-layer plots.

Selects Overlay plot mode [Default initializes a new plot system]. Required for all but the first plot command when building multi-layer plots.

Select "Portrait" plot orientation [Default is "Landscape"; see gmt.conf or gmtset to change the PS_PAGE_ORIENTATION parameter, or supply --PS_PAGE_ORIENTATION=orientation on the command line].

SEE ALSO

Look up the individual man pages for more details and full syntax. Run gmt --help to list all GMT programs and to show all installation directories. For an explanation of the various GMT settings in this man page (like FORMAT_FLOAT_OUT), see the man page of the GMT configuration file gmt.conf. Information is also available on the GMT documentation site https://docs.generic-mapping-tools.org/

COPYRIGHT

2019, The GMT Team

September 7, 2019 6.0.0rc4