Provided by: gmt_4.5.11-1build1_amd64

**NAME**

sphtriangulate - Perform optimal Delaunay triangulation or Voronoi construction of spherical data

**SYNOPSIS**

sphtriangulateinfiles[-A] [-C] [-D] [-H[i][nrec] ] [-Lunit] [-Nnfile] [-Qd|v] [-T] [-V] [-:[i|o] ] [-b[i|o][s|S|d|D[ncol]|c[var1/...]] ] [-m[i|o][flag] ]

**DESCRIPTION**

sphtriangulatereads one or more ASCII [or binary] files (or standard input) containing lon, lat and performs a spherical Delaunay triangulation, i.e., it find how the points should be connected to give the most equilateral triangulation possible on the sphere. Optionally, you may choose-Qvwhich will do further processing to obtain the Voronoi polygons. Normally, either set of polygons will be written as fillable multi-segment output; use-Tto write unique arcs instead. As an option, compute the area of each triangle or polygon. The algorithm used is STRIPACK.infilesData files with the point coordinates in ASCII (or binary; see-b). If no files are given the standard input is read.

**OPTIONS**

-ACompute the area of the spherical triangles (-Qd) or polygons (-Qv) and write the areas (in chosen units; see-L) in the multisegment output headers [no areas calculated].-CFor large data set you can save some memory (at the expense of more processing) by only storing one form of location coordinates (geographic or Cartesian 3-D vectors) at any given time, translating from one form to the other when necessary [Default keeps both arrays in memory].-DUsed with-mto skip the last (repeated) input vertex at the end of a closed segment if it equals the first point in the segment. Requires-m[Default uses all points].-HInput file(s) has header record(s). If used, the default number of header records isN_HEADER_RECS. Use-Hiif only 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.-LSpecify the unit used for distance and area calculations. Choose amonge(m),k(km),m(mile),n(nautical mile), ord(spherical degree). A spherical approximation is used unlessELLIPSOIDis set to an actual ellipsoid. When degree is selected the areas are given in steradians.-NWrite the information pertaining to each polygon (for Delaunay: the three node number and the triangle area; for Voronoi the unique node lon, lat and polygon area) to a separate file [Default puts this information in the segment headers of the output file]. Required if binary output is needed.-QSelect between BD(d)elaunay or BD(v)oronoi mode [Delaunay].-TWrite the unique arcs of the construction [Default writes fillable triangles or polygons]. When used with-Awe store arc length in the segment header in chosen unit (see-L).-VSelects verbose mode, which will send progress reports to stderr [Default runs "silently"].-:Toggles between (longitude,latitude) and (latitude,longitude) input and/or output. [Default is (longitude,latitude)]. Appendito select input only oroto select output only. [Default affects both].-biSelects binary input. Appendsfor single precision [Default isd(double)]. UppercaseSorDwill force byte-swapping. Optionally, appendncol, the number of columns in your binary input file if it exceeds the columns needed by the program. Or appendcif the input file is netCDF. Optionally, appendvar1/var2/...to specify the variables to be read. [Default is 2 input columns].-boSelects binary output. Appendsfor single precision [Default isd(double)]. UppercaseSorDwill force byte-swapping. Optionally, appendncol, the number of desired columns in your binary output file. [Default is same as input].-mMultiple segment file(s). Segments are separated by a special record. For ASCII files the first character must beflag[Default is '>']. For binary files all fields must be NaN and-bmust set the number of output columns explicitly. By default the-msetting applies to both input and output. Use-miand-moto give separate settings to input and output.

**ASCII** **FORMAT** **PRECISION**

The ASCII output formats of numerical data are controlled by parameters in your .gmtdefaults4 file. Longitude and latitude are formatted according toOUTPUT_DEGREE_FORMAT, whereas other values are formatted according toD_FORMAT. Be aware that the format in effect can lead to loss of precision in the 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 theD_FORMATsetting.

**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 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.

**EXAMPLES**

To triangulate the points in the file testdata.txt, and make a Voronoi diagram viapsxy, usesphtriangulatetestdata.txt-Qv| psxy-Rg-JG30/30/6i-M-L-P-W1p-B0g30 | gv - To compute the optimal Delaunay triangulation network based on the multiple segment file globalnodes.d and save the area of each triangle in the header record, trysphtriangulateglobalnodes.d-M-Qd-A> global_tri.d

**SEE** **ALSO**

GMT(1),triangulate(1)sphinterpolate(1)sphdistance(1)

**REFERENCES**

Renka, R, J., 1997, Algorithm 772: STRIPACK: Delaunay Triangulation and Voronoi Diagram on the Surface of a Sphere,AMCTrans.Math.Software,23(3), 416-434.