TRIANGULATE(1gmt) | GMT | TRIANGULATE(1gmt) |
triangulate - Do optimal (Delaunay) triangulation and gridding of Cartesian table data [method]
triangulate [ table ] [ -Cslpfile ] [ -Dx|y ] [ -Eempty ] [ -Ggrdfile ] [ -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.
triangulate reads 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 -R and -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 -I are 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; type triangulate - 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 calculation of Voronoi polygons and optionally grid your data via the natural nearest neighbor algorithm.
None.
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.
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 precision once GMT operates on the grid or writes out new grids. To limit loss of precision when processing data you should always consider normalizing the data prior to processing.
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
The uncertainty propagation for bathymetric grids requires both horizontal and vertical uncertainties and these are weighted given the local slope. See the references for more details.
gmt, greenspline, nearneighbor, pscontour, sphdistance, sphinterpolate, sphtriangulate, surface
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 Generator and Delaunay Triangulator, First Workshop on Applied Computational Geometry (Philadelphia, PA), 124-133, ACM, May 1996.
Shewchuk's Homepage
2019, P. Wessel, W. H. F. Smith, R. Scharroo, J. Luis, and F. Wobbe
May 21, 2019 | 5.4.5 |