triangulate(1) GMT triangulate(1)

## NAME

triangulate - Do optimal (Delaunay) triangulation and gridding of Cartesian table data [method]

## SYNOPSIS

triangulate[table] [-Cslpfile] [-Dx|y] [-Eempty] [-Ggrd-file] [-Iincrement] [-Jparameters] [-M] [-N] [-Q[n] ] [-Rregion] [-S] [-V[level] ] [-Z] [-bbinary ] [-dnodata ] [-eregexp ] [-fflags ] [-hheaders ] [-iflags ] [-r] [-:[i|o] ]Note:No space is allowed between the option flag and the associated arguments.

## DESCRIPTION

triangulatereads one or more ASCII [or binary] files (or standard input) containing x,y[,z] and performs Delaunay triangulation, i.e., it find how the points should be connected to give the most equilateral triangulation possible. If a map projection (give-Rand-J) is chosen then it is applied before the triangulation is calculated. By default, the output is triplets of point id numbers that make up each triangle and is written to standard output. The id numbers refer to the points position (line number, starting at 0 for the first line) in the input file. As an option, you may choose to create a multiple segment file that can be piped through psxy to draw the triangulation network. If-G-Iare set a grid will be calculated based on the surface defined by the planar triangles. The actual algorithm used in the triangulations is either that of Watson [1982] [Default] or Shewchuk [1996] (if installed; typetriangulate-to see which method is selected). This choice is made during the GMT installation. Furthermore, if the Shewchuk algorithm is installed then you can also perform the calcula- tion of Voronoi polygons and optionally grid your data via the natural nearest neighbor algorithm.

## REQUIRED ARGUMENTS

None.

## OPTIONAL ARGUMENTS

tableOne or more ASCII (or binary, see-bi[ncols][type]) data table file(s) holding a number of data columns. If no tables are given then we read from standard input.-CslpfileReadaslopegrid(inradians)andcomputethepropagateduncer-taintyinthebathymetry using the CURVE algorithm [Zambo et al, 20xx]. Requires the-Goption to specify the output grid. Note that theslpgridsets the domain for the output grid so-R,-I, [-r] are not required. Cannot be used in con- junction with-D,-F,-M,-N,-Q,-Sand-T.-Dx|yTake either thex- ory-derivatives of surface represented by the planar facets (only used when-Gis set).-EemptySet the value assigned to empty nodes when-Gis set [NaN].-GgrdfileUse triangulation to grid the data onto an even grid (specified with-R-I). Append the name of the output grid file. The inter- polation is performed in the original coordinates, so if your triangles are close to the poles you are better off projecting all data to a local coordinate system before usingtriangulate(this is true of all gridding routines) or instead selectsph-triangulate. For natural nearest neighbor gridding you must add-Qn.-Ixinc[unit][+e|n][/yinc[unit][+e|n]]x_inc[and optionallyy_inc] is the grid spacing. Optionally, append a suffix modifier.Geographical(degrees)coordinates: Appendmto indicate arc minutes orsto indicate arc seconds. If one of the unitse,f,k,M,noruis appended instead, the increment is assumed to be given in meter, foot, km, Mile, nau- tical mile or US survey foot, respectively, and will be con- verted to the equivalent degrees longitude at the middle lati- tude of the region (the conversion depends on PROJ_ELLIPSOID). Ify_incis given but set to 0 it will be reset equal tox_inc; otherwise it will be converted to degrees latitude.Allcoordi-nates: If+eis appended then the corresponding maxx(east) ory(north) may be slightly adjusted to fit exactly the given increment [by default the increment may be adjusted slightly to fit the given domain]. Finally, instead of giving an increment you may specify thenumberofnodesdesired by appending+nto the supplied integer argument; the increment is then recalcu- lated from the number of nodes and the domain. The resulting increment value depends on whether you have selected a grid- line-registered or pixel-registered grid; see App-file-formats for details. Note: if-Rgrdfileis used then the grid spacing has already been initialized; use-Ito override the values.-Jparameters(morea|) Select map projection.-MOutput triangulation network as multiple line segments separated by a segment header record.-NUsed in conjunction with-Gto also write the triplets of the ids of all the Delaunay vertices [Default only writes the grid].-Q[n] Output the edges of the Voronoi cells instead [Default is Delau- nay triangle edges]. Requires-Rand is only available if linked with the Shewchuk [1996] library. Note that-Zis ignored on output. Optionally, appendnfor combining the edges into closed Voronoi polygons.-Rxmin/xmax/ymin/ymax[+r][+uunit] (morea|) Specify the region of interest.-SOutput triangles as polygon segments separated by a segment header record. Requires Delaunay triangulation.-TOutput edges or polygons even if gridding has been selected with the-Goption [Default will not output the triangulation or Voronoi polygons is gridding is selected].-V[level] (morea|) Select verbosity level [c].-ZControls whether we read (x,y) or (x,y,z) data and if z should be output when-Mor-Sare used [Read (x,y) only].-bi[ncols][t] (morea|) Select native binary input. [Default is 2 input columns].-bo[ncols][type] (morea|) Select native binary output. [Default is same as input]. Node ids are stored as double triplets.-d[i|o]nodata(morea|) Replace input columns that equalnodatawith NaN and do the reverse on output.-e[~]^<i>apattern^<i>a|-e[~]/regexp/[i] (morea|) Only accept data records that match the given pattern.-f[i|o]colinfo(morea|) Specify data types of input and/or output columns.-h[i|o][n][+c][+d][+rremark][+rtitle] (morea|) Skip or produce header record(s).-icols[+l][+sscale][+ooffset][,^<i>a|] (morea|) Select input columns and transformations (0 is first column).-r(morea|) Set pixel node registration [gridline]. (Only valid with-G).-:[i|o] (morea|) Swap 1st and 2nd column on input and/or output.-^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 explana- tion 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.

## 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 FOR- MAT_DATE_OUT and FORMAT_CLOCK_OUT, whereas general floating point val- ues are formatted according to FORMAT_FLOAT_OUT. Be aware that the for- mat 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 (-boif available) or specify more decimals using the FORMAT_FLOAT_OUT set- ting.

## GRID VALUES PRECISION

Regardless of the precision of the input data, GMT programs that create grid files will internally hold the grids in 4-byte floating point arrays. This is done to conserve memory and furthermore most if not all real data can be stored using 4-byte floating point values. Data with higher precision (i.e., double precision values) will lose that preci- sion once GMT operates on the grid or writes out new grids. To limit loss of precision when processing data you should always consider nor- malizing the data prior to processing.

## EXAMPLES

To triangulate the points in the file samples.xyz, store the triangle information in a binary file, and make a grid for the given area and spacing, use gmt triangulate samples.xyz -bo -R0/30/0/30 -I2 -Gsurf.nc > samples.ijk To draw the optimal Delaunay triangulation network based on the same file using a 15-cm-wide Mercator map, use gmt triangulate samples.xyz -M -R-100/-90/30/34 -JM15c | gmt psxy \ -R-100/-90/30/34 -JM15c -W0.5p -B1 > network.ps To instead plot the Voronoi cell outlines, try gmt triangulate samples.xyz -M -Q -R-100/-90/30/34 -JM15c | \ gmt psxy -R-100/-90/30/34 -JM15c -W0.5p -B1 > cells.ps To combine the Voronoi outlines into polygons and paint them according to their ID, try gmt triangulate samples.xyz -M -Qn -R-100/-90/30/34 -JM15c | \ gmt psxy -R-100/-90/30/34 -JM15c -W0.5p+cf -L -B1 -Ccolors.cpt -L > polygons.ps To grid the data using the natural nearest neighbor algorithm, try gmt triangulate samples.xyz -Gnnn.nc -Qn -R-100/-90/30/34 -I0.5

## NOTES

The uncertainty propagation for bathymetric grids requires both hori- zontal and vertical uncertainties and these are weighted given the local slope. See the references for more details.

## SEE ALSO

gmt(1),greenspline(1),nearneighbor(1),pscontour(1),sphdistance(1),sphinterpolate(1),sphtriangulate(1),surface(1)

## REFERENCES

Watson, D. F., 1982, Acord: Automatic contouring of raw data,Comp.&Geosci.,8, 97-101. Shewchuk, J. R., 1996, Triangle: Engineering a 2D Quality Mesh Genera- tor and Delaunay Triangulator, First Workshop on Applied Computational Geometry (Philadelphia, PA), 124-133, ACM, May 1996.Shewchuk^<i>asHomepage

## COPYRIGHT

2017, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe 5.4.2 Jun 24, 2017 triangulate(1)

gmt5 5.4.2 - Generated Thu Jun 29 16:45:40 CDT 2017