GMT(1) | GMT | GMT(1) |
gmt - The Generic Mapping Tools data processing and display software package
GMT is a collection of freely available command-line tools under the GNU LGPL that allows you to manipulate x,y and x,y,z data sets (filtering, trend fitting, gridding, projecting, etc.) and produce 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.
gmt is the main program that can start any of the modules:
For information on any module, load the module documentation in your browser via gmt docs, e.g.:
gmt docs grdimage
If no module is given then several other options are available:
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.
Run gmt --help to print the list of all core and supplementals modules within GMT, and a very short description of their purpose. Detailed information about each program can be found in the separate manual pages.
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 from the GMT infrastructure and extend GMT in specific ways.
-B[p|s]parameters -Jparameters -Jz|Zparameters -Rwest/east/south/north[/zmin/zmax][+r][+uunit] -U[stamp] -V[level] -X[a|c|f|r][xshift] -Y[a|c|f|r][yshift] -aflags -bbinary -crow,col|index -dnodata[+ccol] -eregexp -fflags -ggaps -hheaders -iflags -jflags -lflags -nflags -oflags -pflags -qflags -rreg -sflags -ttransp -x[[-]n] -:[i|o]
These are all the common GMT options that remain the same for all GMT modules. No space between the option flag and the associated arguments.
Syntax
Description
This is potentially the most complicated option in GMT, but most examples of its usage are actually quite simple. We distinguish between two sets of information: Frame settings and Axes settings. These are set separately by their own -B invocations; hence multiple -B specifications may be specified. The Frame settings cover things such as which axes should be plotted, canvas fill, plot title (and subtitle), and what type of gridlines be drawn, whereas the Axes settings deal with annotation, tick, and gridline intervals, axes labels, and annotation units.
The Frame settings are specified by
The frame setting is optional but can be invoked once to override the defaults. The following modifiers can be appended to -B to control the Frame settings:
Note: Both +ttitle and +ssubtitle may be set over multiple lines by breaking them up using the markers @^ or <break>. To include LaTeX code as part of a single-line title or subtitle, enclose the expression with @[ markers (or alternatively <math> … </math>) (requires latex and dvips to be installed). See the Using LaTeX Expressions in GMT chapter for more details.
The Axes settings are specified by
but you may also split this into two separate invocations for clarity, i.e.,
-B[p|s][x|y|z][+aangle|n|p][+e[l|u]][+f][+l|Llabel][+pprefix][+s|Sseclabel][+uunit] -B[p|s][x|y|z]intervals
The following modifiers can be appended to -B to control the Axes settings:
NOTE: To include LaTeX code as part of a label, enclose the expression with @[ markers (or alternatively <math> … </math>). (requires latex and dvips to be installed). See the Using LaTeX Expressions in GMT chapter for more details.
NOTE: If any labels, prefixes, or units contain spaces or special characters you will need to enclose them in quotes.
NOTE: Text items such as title, subtitle, label and seclabel are seen by GMT as part of a long string containing everything passed to -B. Therefore, they cannot contain substrings that look like other modifiers. If you need to embed such sequences (e.g., +t“Solving a+b=c”) you need to replace those + symbols with their octal equivalent \053, (e.g., +t“Solving a\053b=c”).
NOTE: 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).
Intervals specification The intervals specification is a concatenated string made up of substrings of the form
The choice of a|f|g sets the axis item of interest, which are detailed in the Table interval types. Optionally, append phase to shift the annotations by that amount (positive or negative with the sign being required). Optionally, append unit to specify the units of stride, where unit is one of the 18 supported unit codes. For custom annotations and intervals, intervals can be given as cintfile, where intfile contains any number of records with coord type [label]. See the section Custom axes for more details.
Flag | Description |
a | Annotation and major tick spacing |
f | Minor tick spacing |
g | Grid line spacing |
NOTE: The appearance of certain time annotations (month-, week-, and day-names) may be affected by the GMT_LANGUAGE, FORMAT_TIME_PRIMARY_MAP, and FORMAT_TIME_SECONDARY_MAP settings.
Automatic intervals: GMT will auto-select the spacing between the annotations and major ticks, minor ticks, and grid lines if stride is not provided after a|f|g. This can be useful for automated plots where the region may not always be the same, making it difficult to determine the appropriate stride in advance. For example, -Bafg will select all three spacings automatically for both axes. In case of longitude–latitude plots, this will keep the spacing the same on both axes. You can also use -Bxafg -Byafg to auto-select them separately. Note that given the myriad ways of specifying time-axis annotations, the automatic selections may need to be overridden with manual settings to achieve exactly what you need. When stride is omitted after g, the grid line are spaced the same as the minor ticks; unless g is used in consort with a, in which case the grid lines are spaced the same as the annotations.
Stride units: The unit flag can take on one of 18 codes which are listed in Table Units. Almost all of these units are time-axis specific. However, the d, m, and s units will be interpreted as arc degrees, minutes, and arc seconds respectively when a map projection is in effect.
Flag | Unit | Description |
Y | year | Plot using all 4 digits |
y | year | Plot using last 2 digits |
O | month | Format annotation using FORMAT_DATE_MAP |
o | month | Plot as 2-digit integer (1–12) |
U | ISO week | Format annotation using FORMAT_DATE_MAP |
u | ISO week | Plot as 2-digit integer (1–53) |
r | Gregorian week | 7-day stride from start of week (see TIME_WEEK_START) |
K | ISO weekday | Plot name of weekday in selected language |
k | weekday | Plot number of day in the week (1–7) (see TIME_WEEK_START) |
D | date | Format annotation using FORMAT_DATE_MAP |
d | day | Plot day of month (1–31) or day of year (1–366) (see FORMAT_DATE_MAP) |
R | day | Same as d; annotations aligned with week (see TIME_WEEK_START) |
H | hour | Format annotation using FORMAT_CLOCK_MAP |
h | hour | Plot as 2-digit integer (0–24) |
M | minute | Format annotation using FORMAT_CLOCK_MAP |
m | minute | Plot as 2-digit integer (0–60) |
S | seconds | Format annotation using FORMAT_CLOCK_MAP |
s | seconds | Plot as 2-digit integer (0–60) |
NOTE: If your axis is in radians you can use multiples or fractions of pi to set such annotation intervals. The format is [s]pi[f], for an optional integer scale s and optional integer fraction f. When GMT parses one of these forms we alert the labeling machinery to look for certain combinations of pi, limited to npi, 3/2 pi (3pi2), and fractions 3/4 (3pi4), 2/3 (2pi3), 1/2 (1pi2), 1/3 (1pi3), and 1/4 (1pi4) in the interval given to the -B axes settings. When an annotated value is within roundoff-error of these combinations we typeset the label using the Greek letter \pi and required multiples or fractions.
Syntax
Description
Select map projection. The first character of parameters 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). The measurement unit (called UNIT below) 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 the 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 map projections is user-definable. 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 and append the required parameters (The E or C after projection names stands for Equal-Area and Conformal, respectively):
Give scale along oblique equator (with -Ja|b|c; 1:xxxx or plot-units/degree) or width (with -JA|B|C; in plot-units). Use upper-case A|B|C to remove enforcement of a northern hemisphere pole. Append +v to let the oblique Equator align with the y-axis [x-axis]. Note: If the region (-R) is given without the +r modifier then the arguments are considered oblique degrees relative to the projection center and not longitude/latitude bounds.
CONIC PROJECTIONS:
AZIMUTHAL PROJECTIONS:
Except for polar aspects, -Rw/e/s/n will be reset to -Rg. Use -Rxlleft/ylleft/xuright/yuright+r for smaller regions.
MISCELLANEOUS PROJECTIONS:
NON-GEOGRAPHICAL PROJECTIONS:
Give scale (with -Jp; in plot-units/r-unit) or width (with -JP; in plot-units). The following modifiers are supported by -Jp|P:
Give x-scale (with -Jx; as 1:xxxx or plot-units/x-unit) and/or y-scale (1:xxxx or plot-units/y-unit); or specify width and/or height (with -JX; in plot-units). 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:
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.
The usage of PROJ 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 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 projections, the situations is, however, rather more limited for mapping purposes. Here, only the subset of the PROJ projections that can be mapped into the GMT projections syntax is available to use. Another aspect that is not present in PROJ, 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.
Syntax
Description
The -R option defines the map region or data domain of interest. It may be specified in one of several ways (options 1 and 3 are shown in panels a) and b) respectively of the Figure Map region):
Syntax
Description
The -U option draws the GMT system time stamp on the plot. The following modifiers are supported:
The GMT parameters MAP_LOGO, MAP_LOGO_POS, FONT_LOGO 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).
Syntax
Description
The -V option controls the verbosity mode, which determines which messages are sent to standard error. Choose among 7 levels of verbosity; each level adds more messages:
This option can also be set by specifying the default GMT_VERBOSE as quiet, error, warning, timing, compat, information, or debug, in order of increased verbosity [default is warning].
Syntax
Description
The -X and -Y options shift the plot origin relative to the current origin by (xshift,yshift). Optionally, append the length unit (c, i, or p). Default is (MAP_ORIGIN_X, MAP_ORIGIN_Y) for new plots, which ensures that boundary annotations fit on the page. Subsequent overlays will be co-registered with the previous plot unless the origin is shifted using these options. The following modifiers are supported [default is r]:
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. In modern mode, -X and -Y can also access the previous plot bounding box dimensions w and h and construct offsets that involve them. Thus, xshift can in general be [[±][f]w[/d]±]xoff, where optional signs, factor f and divisor d can be used to compute an offset that may be adjusted further by ±off. Similarly, yshift can in general be [[±][f]h[/d]±]yoff. 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. Note: the previous plot bounding box refers to the last object plotted, which may be an image, logo, legend, colorbar, etc.
Syntax
Description
GMT relies on external tools to translate geospatial files such as shapefiles into a format we can read. The tool ogr2ogr in the GDAL package can do such translations and preserve the aspatial metadata via a new OGR/GMT format specification (See the cookbook chapter The GMT Vector Data Format for OGR Compatibility). For this to be useful we need a mechanism to associate certain metadata values with required input and output columns expected by GMT programs. The -a option allows you to supply 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 as data input for column col. The given aspatial field thus replaces any other value already set. Note: col = 0 is the first data column. Note: If no aspatial attributes are needed then the -a option is not needed – GMT will still process and read such data files.
If you need to populate GMT data columns with (constant) values specified by aspatial attributes, use -a and append any number of comma-separated col=name associations. For example, -a2=depth will read the spatial x,y columns from the file and add a third (z) column based on the value of the aspatial field called depth. You can also associate aspatial fields with other settings such as labels, fill colors, pens, and values (for looking-up colors) by letting the col value be one of D (for distance), G (for fill), I (for ID), L (for label), T (for text), W (for pen), or Z (for value). This works analogously to how standard multi-segment files can pass such options via its segment headers (See the cookbook chapter GMT File Formats). Note: If the leading col= is omitted, the column value is automatically incremented starting at 2.
GMT table-writing tools can also output the OGR/GMT format directly. Specify if certain GMT data columns with constant values should be stored as aspatial metadata using col=name[:type], where you can optionally specify what data type it should be from the options double, float, integer, char, string, logical, byte, or datetime [default is double]. As for input, you can also use the special col entries of D (for distance), G (for fill), I (for ID), L (for label), T (for text), W (for pen), or Z (for value) to have values stored as options in segment headers be used as the source for the named aspatial field. The type will be set automatically for these special col entries. Finally, for output you must append +ggeometry, where geometry can be any of [M]POINT|LINE|POLY; where M represents the multi-versions of these three geometries. Use upper-case +G to signal that you want to split any line or polygon features that straddle the Dateline.
Syntax
Description
Select native binary record format for primary table input. The record is one or more groups with format [ncols][type][w], where ncols is the number of consecutive data columns of given type and type must be one of:
Force byte-swapping of a group by appending w at the end of the group. For records with mixed types, append additional comma-separated groups (no space between groups). The following modifiers are supported:
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. When using native binary data the user must be aware of the fact that GMT has no way of determining the actual number of columns in the file. Native binary files may have a header section, where the -h option can be used to skip the first n bytes. If the input file is netCDF, no -b is needed; simply append ?var1/var2/… to the filename to specify the variables to be read (see GMT File Formats and Modifiers for COARDS-compliant netCDF files for more information). Here is an example that writes a binary file and reads it back with the first column 4 byte float, the second column 8 byte int, and the third column 8 byte double.
echo 1.5 2 2.5 | gmt convert -bo1f,1l,1d > test.bin gmt convert test.bin -bi1f,1l,1d
Syntax
Description
Select native binary format for table output. The record must be one or more groups with format [ncols][type][w], where ncols is the number of consecutive data columns of given type and type must be one of c, u, h, H, i, I, l, L, f, or d [Default] (see -bi types for descriptions). Force byte-swapping of a group by appending w at the end of the group. For a mixed-type output record, append additional comma-separated groups (no space between groups) The following modifiers are supported:
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.
Syntax
Description
The -c option can be used to either advance the focus of plotting to the next panel in the sequence (either by row or by column as set by subplot’s -A option) or to specify directly the row,col or 1-D index of the desired panel, when using subplot to assemble multiple individual panels in a matrix layout. The -c option is only allowed when in subplot mode. If no -c option is given for the first subplot then we default to row=col=index=0, i.e., the upper left panel. Note: row, col, and index all start at 0.
Syntax
Description
The -d option allows user-coded missing data values to be translated to official NaN values in GMT. Within GMT, any missing values are represented by the IEEE NaN value. However, user data may occasionally denote missing data with an unlikely value (e.g., -99999). Since GMT cannot guess this special missing data value, you can use the -d option to have such values replaced with NaNs. Similarly, the -d option can replace all NaNs with the chosed nodata value should the GMT output need to conform to such a requirement.
For input only, use -dinodata to examine all input columns after the first two. If any item equals nodata, the value is interpreted as a missing data item and is substituted with the value NaN.
For output only, use -donodata to examine all output columns. If any item equals NaN, the NaN value is substituted with the chosen missing data value nodata.
Use the +c modifier to override the starting column used for the examinations [2 for input, 0 for output].
Syntax
Description
The -e option offers a built-in pattern scanner that will only pass records that match the given pattern or regular expressions, whereas modules that read ASCII tables will normally process all the data records that are read. The test can also be inverted to only pass data records that do not match the pattern, by using -e~. The test is not applied to header or segment headers. Should your pattern happen to start with ~ you will need to escape this character with a backslash [Default accepts all data records]. For matching data records against extended regular expressions, please enclose the expression in slashes. Append i for case-insensitive matching. To supply 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.
Syntax
Description
The -f option specifies what kind of data each input or output column contains when map projections are not required. Optionally, append i or o to make this apply only to input or output, respectively [Default applies to both]. Append a text string with information about each column (or range of columns) separated by commas. Each group starts with the column number (0 is the first column) followed by either x (longitude), y (latitude), T (absolute calendar time), t (relative time in chosen TIME_UNIT since TIME_EPOCH), d (dimension) or s (trailing text). If several consecutive columns have the same format you may specify a range of columns rather than a single column. Column ranges must be given in the format start[:inc]:stop, where inc defaults to 1 if not specified. For example, if our input file has geographic coordinates (latitude, longitude) with absolute calendar coordinates in the columns 3 and 4, we would specify fi0y,1x,3:4T. All other columns are assumed to have the default (floating point) format and need not be set individually. Note: You can also indicate that all items from the given column and to the end of the record should be considered trailing text by giving the code s (for string). Only the last group may set s. Note: Types T and s can only be used with ASCII data sets.
Three shorthand options for common selections are available. The shorthand -f[i|o]g means -f[i|o]0x,1y (i.e., geographic coordinates), while -f[i|o]c means -f[i|o]0:1f (i.e., Cartesian coordinates). A special use of -f is to select -fp[unit], which requires -J -R and lets you use projected map coordinates (e.g., UTM meters) as data input. Such coordinates are automatically inverted to longitude, latitude during the data import. Optionally, append a length unit (see table distance units) [default is meter]. For more information, see Sections Input data formats and Output data formats.
Syntax
Description
The -g option is used to detect gaps based on one or more criteria. Repeat the option to specify multiple criteria. A criterion is specified using one of the x|y|z|d|X|Y|D directives. The upper-case directives specify that the criterion should be applied to the projected coordinates for modules that map data to map coordinates.
A unit u may be appended to the specified gap:
Append modifier +a to specify that all the criteria must be met [default imposes breaks if any one criterion is met].
One of the following modifiers can be appended:
Default imposes breaks based on the absolute value of the difference between the current and previous value. Note: For x|y|z with time data the unit is instead controlled by TIME_UNIT. Note: GMT has other mechanisms that can determine line segmentation, including segments defined by multiple segment header records (see the cookbook chapter GMT File Formats) or segments defined by NaN values when IO_NAN_RECORDS is set to pass [default skips NaN values].
Syntax
Description
Specify that the primary input file(s) has n header record(s). The default number of header records is set by IO_N_HEADER_RECS [default is 0]. Use -hi if only the primary input data should have header records [Default will write out header records if the input data have them]. For output you may control the writing of header records using -h[o] and the optional modifiers:
Note: Blank lines and lines starting with # are always skipped. To use another leading character for indicating header records, set IO_HEADER_MARKER. With -h in effect the first n records are taken verbatim as headers and not skipped even if any is starting with #. Note: If used with native binary data (using -b) we interpret n to instead mean the number of bytes to skip on input or pad on output.
Syntax
Description
The -i option allows you to specify which input file physical data columns to use and in what order. Specify 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 (i.e., column 0)]. Columns can be repeated. The chosen data columns will be used as given and columns not listed will be skipped. Optionally, append one of the following modifiers to any column or column range to transform the input columns:
Note: The order of these optional transformations are (1) take log10, (2) scale or divide, and (3) add offset. To read from a given column until the end of the record, leave off stop when specifying the column range. Normally, any trailing text will be read but when -i is used to specify specific input columns you must explicitly append the “column” t to retain the trailing text internally. To only ingest a single word from the trailing text, append the word number (first word is 0). If your trailing text columns start with a valid number and you want to ensure the content from column col to the end of the record will be considered trailing text, use -fcols. Finally, -in will simply read the numerical input and skip any trailing text. Note: Using -i assumes there are as many numerical columns as implied in -i, so if you have a mix of numerical and text columns we will forge ahead and read those text columns (most likely returned as NaNs) and return your selection as numerical values. The default (no -i provided) will examine the record and stop conversions when the record switches to trailing text.
Syntax
Description
GMT has different ways to compute distances on planetary bodies:
Note: All spherical distance calculations depend 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).
Syntax
-l[label][+Dpen][+Ggap][+Hheader][+L[code/]text][+Ncols][+Ssize[/height]][+V[pen]][+ffont][+gfill][+jjustify][+ooff][+ppen][+sscale][+wwidth]
Description
The -l option is used to automatically build the specfile that is read by the legend module to create map or plot legends. This allows detailed and complicated legends that mix a variety of items, such as symbols, free text, colorbars, scales, images, and more. Yet, a simple legend will suffice for the vast majority of plots displaying symbols or lines. Optionally, append a text label to describe the entry. The following modifiers are supported to allow further changes to the legend that is built by legend (upper-case modifiers reflect legend codes described in legend, which provides more details and customization):
Note: Default pen is given by MAP_DEFAULT_PEN. Note: +H, +g, +j, +o, +p, +w, and +s will only take effect if appended to the very first -l option for a plot. The +N modifier, if appended to the first -l option, affects the legend width (unless set via +w); otherwise it just subdivides the available width among the specified columns. If legend is not called explicitly we will call it implicitly when finishing the plot via end. Note: If auto-coloring is used for pens or fills and -l is set then label may contain a C-format for integers (e.g., %3.3d) or just # and we will use the sequence number with the format to build the label entries. Alternatively, give a list of comma-separated labels, or give no label if your segment headers contain label settings. Note: Due to this mechanism, if your single label actually contains commas, you must replace these with the octal code for a comma (\054).
Syntax
Description
The -n option controls parameters used for 2-D grids resampling [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]. Append one of the following to select the type of spline used:
The following modifiers are supported:
Syntax
Description
The -o option allows you to specify which output file physical data columns to use and in what order. Specify individual columns or column ranges in the format start[:inc]:stop, where inc defaults to 1 if not specified, separated by commas [Default writes all columns in order, starting with the first column (i.e., column 0)]. Columns can be repeated. The chosen data columns will be used as given and columns not listed will be skipped. To write from a given column until the end of the record, leave off stop when specifying the column range.
Normally, any trailing text in the internal records will be included in the output, but when -o is used to specify specific columns you must explicitly append the extra “column” t to include the trailing text on output. To only select 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, while -ot will only output the trailing text (or selected word). Note: If -i is also used then columns given to -o correspond to the order after the -i selection has taken place and not the columns in the original record.
Syntax
Description
All plotting programs that normally produce a flat, two-dimensional illustration can be told to view this flat illustration from a particular vantage point, resulting in a perspective view. You can select perspective view with the -p option by setting the azimuth (azim) of the viewpoint [Default is 180]. The following modifiers are supported:
For frames used for animation, we fix the center of your data domain. Specify another center using one of the following modifiers:
When -p is used without any further arguments, the values from the last use of -p in a previous GMT command will be used (in modern mode this also supplies the previous -Jz or -JZ if doing a 3-D region). 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.
Syntax
Description
The -q option is used to select specific data rows to be read (using -q or -qi) or written (using -qo) [Default is all rows]. Specify individual rows or row ranges in the format start[:inc]:stop, where inc defaults to 1 if not specified, separated by commas [Default reads and writes all rows in order, starting with the first row (i.e., row 0)]. To read (or write) from a given row until the end of the data, leave off stop. To select all the rows not specified by the given ranges, prepend the selected rows with a leading ~. Append one of the following modifiers to control how the rows are counted [Default is +a]:
Alternatively, use +ccol to indicate that the arguments instead are min/max data limits for the values in column col. With +ccol, only rows whose data for the given column col are within the range(s) given by the min/max limits are read (with -qi) or written (with -qo). Note: Because arguments may contain colons or be negative, you must specify min/max instead of start[:inc]:stop. If min or max is not given we default to -infinity and + infinity, respectively (e.g., -qo50/+c2 will only write records whose z-values (in 3rd column) is ≥ 50 while -qo/50+c2 will only write records whose z-values is ≤ 50).
Note: Header records do not increase the row counters; only data records do.
Syntax
Description
All 2-D grids in GMT have their nodes organized in one of two ways, known as gridline and pixel registration. The GMT default is gridline registration (-rg); programs that allow for the creation of grids can use the -r option (or -rp) to select pixel registration instead.
Most observed data tend to be in gridline registration while processed data sometime may be distributed in pixel registration. While you may convert between the two registrations this conversion looses the Nyquist frequency and dampens the other high frequencies. It is best to avoid any registration conversion if you can help it. Planning ahead may be important. (Node registrations are defined in Section Grid registration: The -r option of the GMT Technical Reference and Cookbook.)
Syntax
Description
The -s option can be used to suppress output for records whose z-value equals NaN [default outputs all records]. Optionally, supply a comma-separated list of all columns or column ranges to consider for this NaN test [default only considers the third data column (i.e., cols = 2)]. Column ranges must be given in the format start[:inc]:stop, where inc defaults to 1 if not specified. The following modifiers are supported:
Syntax
Description
The -t option allows you to change the transparency level for the current overlay by appending the transp percentage in the 0-100 range [default is 0 (i.e., opaque)]. Normally, transp applies to both fill and stroke, but you can limit the transparency to one of them by appending +f or +s for fill or stroke, respectively. Alternatively, append /transp2 to set separate transparencies for fills and strokes.
Transparency may also be controlled on a feature by feature basis when setting color or fill (see the cookbook section Specifying area fill attributes). Note: The modules plot, plot3d, and text can all change transparency on a record-by-record basis if -t is given without argument and the input file supplies variable transparencies as the last numerical column value(s). Note: The transparency is only visible when PDF or raster format output is selected because the PostScript language does not support transparency. Only the PNG format selection adds a transparency layer in the image (for further processing).
Syntax
Description
The -w option converts the input x-coordinate to a cyclical coordinate, or a different input column if selected via the +c modifier. Temporal data (i.e., regular time series) can be analyzed for periods via standard spectral analysis, such as offered by spectrum1d and grdfft. However, it is often of interest to examine aspects of such periodicities in the time domain. To enable such analyses we need to convert our monotonically increasing time coordinates to periodic or cyclic coordinates so that data from many cycles can be stacked, binned, displayed in histograms, etc. The conversion from input x, y, or z coordinates to wrapped, periodic coordinates follows the simple equation
t' = (t - \tau) \;\mathrm{mod}\; T,
where t is the input coordinate, \tau is a phase-shift [Default is zero], and T is the desired period for the modulus operator, yielding cyclic coordinates t'. GMT offers many standard time cycles in prescribed units plus a custom cycle for other types of Cartesian coordinates. The table below shows the values for units, phase and period that are prescribed and only requires the user to specify the corresponding wrapping code (y|a|w|d|h|m|s|cperiod[/phase]):
Code | Purpose (unit) | Period | Phase | Range |
y | Yearly cycle (normalized) | 1 year | 0 | 0–1 |
a | Annual cycle (month) | 1 year | 0 | 0–12 |
w | Weekly cycle (day) | 1 week | 0 | 0–7 |
d | Daily cycle (hour) | 1 day | 0 | 0–24 |
h | Hourly cycle (minute) | 1 hour | 0 | 0–60 |
m | Minute cycle (second) | 1 minute | 0 | 0–60 |
s | Second cycle (second) | 1 second | 0 | 0–1 |
c | Custom cycle (normalized) | T | \tau | 0–1 |
Optionally, append +ccol to select the input column with the coordinates to be wrapped, [default col is 0, i.e., the first column]. If the custom cycle c is chosen then you must also supply the period and optionally any phase [default is 0] in the same units of your data (i.e., no units should be appended to -w).
Note: Coordinates for w in the range 0-1 correspond to the first day of the week [Monday] but can be changed via TIME_WEEK_START. Note: If a temporal cycle is indicated then we implicitly set -f to indicate absolute time (unless already set separately). See the cookbook section Examining data cycles: The -w option for examples.
Syntax
Description
The -x option limits the number of cores to be used in any OpenMP-enabled multi-threaded algorithms [default is 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, with the exception of movie and batch which handle their own parallel execution.
Syntax
Description The -: option swaps the 1st and 2nd column on input and 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 Input columns selection: The -i option. Note that command line arguments that may take geographic coordinates (e.g., -R) always expect longitude before latitude. Also, geographical grids are expected to have the longitude as first (minor) dimension.
The 35 available fonts (plus 4 optional Japanese fonts) are:
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.
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][+ddivisor][+ninvalid][+ooffset][+sscale], where ID is a two-letter identifier of the grid type and precision, and the scale (or divisor), 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, then 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. If reading an image as a grid you can select the band via +b. See grdconvert and Section Grid file format specifications of the GMT Technical Reference and Cookbook for more information regarding GDAL settings.
When reading a netCDF file that contains multiple grids, GMT will read, by default, the first 2-dimensional grid that it 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 COARDS-compliant netCDF files and Grid file format specifications of the GMT Technical Reference and Cookbook for more information, particularly on how to read slices of 3-, 4-, or 5-dimensional grids.
When writing a netCDF file, the grid is stored by default with the variable name “z”. To specify another variable name varname, append ?varname to the file name. 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.
These options are only used in classic mode and are listed here just for reference.
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/
docs
2022, The GMT Team
June 16, 2022 | 6.4 |