1TRIANGULATE(1)               Generic Mapping Tools              TRIANGULATE(1)
2
3
4

NAME

6       triangulate  -  Perform  optimal Delaunay triangulation and gridding of
7       Cartesian data [method]
8

SYNOPSIS

10       triangulate infiles [ -Dx|y ] [ -Eempty ]  [  -F  ]  [  -Ggrdfile  ]  [
11       -H[i][nrec]  ] [ -Ixinc[unit][=|+][/yinc[unit][=|+]] ] [ -Jparameters ]
12       [ -Q ] [ -Rwest/east/south/north[r] ] [ -V ] [  -Z  ]  [  -:[i|o]  ]  [
13       -b[i|o][s|S|d|D[ncol]|c[var1/...]] ] [ -f[i|o]colinfo ] [ -m[i|o][flag]
14       ]
15

DESCRIPTION

17       triangulate reads one or more ASCII  [or  binary]  files  (or  standard
18       input) containing x,y[,z] and performs Delaunay triangulation, i.e., it
19       find how the points should be connected to give  the  most  equilateral
20       triangulation possible.  If a map projection (give -R and -J) is chosen
21       then it is applied before the triangulation is calculated.  By default,
22       the  output  is triplets of point id numbers that make up each triangle
23       and is written to standard output.  The id numbers refer to the  points
24       position  (line  number, starting at 0 for the first line) in the input
25       file.  As an option, you may choose to create a multiple  segment  file
26       that  can  be piped through psxy to draw the triangulation network.  If
27       -G -I are set a grid will be calculated based on the surface defined by
28       the  planar triangles.  The actual algorithm used in the triangulations
29       is either that of  Watson  [1982]  [Default]  or  Shewchuk  [1996]  (if
30       installed;  type  triangulate - to see which method is selected).  This
31       choice is made during the GMT installation.
32
33       infiles
34              Data files with the point coordinates in ASCII (or  binary;  see
35              -b).  If no files are given the standard input is read.
36

OPTIONS

38       -D     Take  either  the  x- or y-derivatives of surface represented by
39              the planar facets (only used when -G is set).
40
41       -E     Set the value assigned to empty nodes when -G is set [NaN].
42
43       -F     Force pixel node registration  [Default  is  gridline  registra‐
44              tion].  (Node registrations are defined in GMT Cookbook Appendix
45              B on grid file formats.)  Only valid with -G).
46
47       -G     Use triangulation to grid the data onto an even grid  (specified
48              with  -R  -I).   Append  the  name of the output grid file.  The
49              interpolation is performed in the original  coordinates,  so  if
50              your  triangles  are  close to the poles you are better off pro‐
51              jecting all data to a local coordinate system before using  tri‐
52              angulate (this is true of all gridding routines).
53
54       -H     Input file(s) has header record(s).  If used, the default number
55              of header records is N_HEADER_RECS.  Use -Hi if only input  data
56              should  have  header  records  [Default  will  write  out header
57              records if the input data have  them].  Blank  lines  and  lines
58              starting with # are always skipped.
59
60       -I     x_inc  [and  optionally  y_inc] sets the grid  size for optional
61              grid output (see -G).  Append m to  indicate  minutes  or  c  to
62              indicate seconds.
63
64       -J     Selects  the  map  projection. Scale is UNIT/degree, 1:xxxxx, or
65              width in UNIT (upper case modifier).  UNIT is cm,  inch,  or  m,
66              depending on the MEASURE_UNIT setting in .gmtdefaults4, but this
67              can be overridden on the command line by appending c, i, or m to
68              the  scale/width  value.   When  central  meridian  is optional,
69              default is center of longitude  range  on  -R  option.   Default
70              standard  parallel  is  the equator.  For map height, max dimen‐
71              sion, or min dimension, append h, +, or - to the width,  respec‐
72              tively.
73              More details can be found in the psbasemap man pages.
74
75              CYLINDRICAL PROJECTIONS:
76
77              -Jclon0/lat0/scale (Cassini)
78              -Jcyl_stere/[lon0/[lat0/]]scale (Cylindrical Stereographic)
79              -Jj[lon0/]scale (Miller)
80              -Jm[lon0/[lat0/]]scale (Mercator)
81              -Jmlon0/lat0/scale (Mercator - Give meridian and standard paral‐
82              lel)
83              -Jo[a]lon0/lat0/azimuth/scale  (Oblique  Mercator  -  point  and
84              azimuth)
85              -Jo[b]lon0/lat0/lon1/lat1/scale (Oblique Mercator - two points)
86              -Joclon0/lat0/lonp/latp/scale  (Oblique  Mercator  -  point  and
87              pole)
88              -Jq[lon0/[lat0/]]scale (Cylindrical Equidistant)
89              -Jtlon0/[lat0/]scale (TM - Transverse Mercator)
90              -Juzone/scale (UTM - Universal Transverse Mercator)
91              -Jy[lon0/[lat0/]]scale (Cylindrical Equal-Area)
92
93              CONIC PROJECTIONS:
94
95              -Jblon0/lat0/lat1/lat2/scale (Albers)
96              -Jdlon0/lat0/lat1/lat2/scale (Conic Equidistant)
97              -Jllon0/lat0/lat1/lat2/scale (Lambert Conic Conformal)
98              -Jpoly/[lon0/[lat0/]]scale ((American) Polyconic)
99
100              AZIMUTHAL PROJECTIONS:
101
102              -Jalon0/lat0[/horizon]/scale (Lambert Azimuthal Equal-Area)
103              -Jelon0/lat0[/horizon]/scale (Azimuthal Equidistant)
104              -Jflon0/lat0[/horizon]/scale (Gnomonic)
105              -Jglon0/lat0[/horizon]/scale (Orthographic)
106              -Jglon0/lat0/altitude/azimuth/tilt/twist/Width/Height/scale
107              (General Perspective).
108              -Jslon0/lat0[/horizon]/scale (General Stereographic)
109
110              MISCELLANEOUS PROJECTIONS:
111
112              -Jh[lon0/]scale (Hammer)
113              -Ji[lon0/]scale (Sinusoidal)
114              -Jkf[lon0/]scale (Eckert IV)
115              -Jk[s][lon0/]scale (Eckert VI)
116              -Jn[lon0/]scale (Robinson)
117              -Jr[lon0/]scale (Winkel Tripel)
118              -Jv[lon0/]scale (Van der Grinten)
119              -Jw[lon0/]scale (Mollweide)
120
121              NON-GEOGRAPHICAL PROJECTIONS:
122
123              -Jp[a]scale[/origin][r|z] (Polar coordinates (theta,r))
124              -Jxx-scale[d|l|ppow|t|T][/y-scale[d|l|ppow|t|T]]  (Linear,  log,
125              and power scaling)
126
127       -Q     Output the edges of the Voronoi cells instead [Default is Delau‐
128              nay triangle edges].  Requires both -m and -R and is only avail‐
129              able if linked with the Shewchuk [1996] library.
130
131       -R     xmin, xmax, ymin, and ymax specify the Region of interest.   For
132              geographic  regions,  these  limits  correspond  to  west, east,
133              south, and north and you may specify them in decimal degrees  or
134              in  [+-]dd:mm[:ss.xxx][W|E|S|N]  format.  Append r if lower left
135              and upper right map coordinates are given  instead  of  w/e/s/n.
136              The  two  shorthands  -Rg and -Rd stand for global domain (0/360
137              and -180/+180 in longitude respectively, with -90/+90  in  lati‐
138              tude).  Alternatively, specify the name of an existing grid file
139              and the -R settings (and grid spacing, if applicable) are copied
140              from  the  grid.   For  calendar time coordinates you may either
141              give (a) relative time (relative to the selected TIME_EPOCH  and
142              in  the  selected TIME_UNIT; append t to -JX|x), or (b) absolute
143              time of the form [date]T[clock] (append T to -JX|x).   At  least
144              one of date and clock must be present; the T is always required.
145              The date string must be of the form [-]yyyy[-mm[-dd]] (Gregorian
146              calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock
147              string must be of the form hh:mm:ss[.xxx].  The  use  of  delim‐
148              iters  and their type and positions must be exactly as indicated
149              (however, input, output and plot formats are  customizable;  see
150              gmtdefaults).
151
152       -V     Selects verbose mode, which will send progress reports to stderr
153              [Default runs "silently"].
154
155       -Z     Controls whether binary data file has two or three columns  [2].
156              Ignored if -b is not set.
157
158       -:     Toggles  between  (longitude,latitude)  and (latitude,longitude)
159              input and/or output.  [Default is (longitude,latitude)].  Append
160              i  to  select  input  only or o to select output only.  [Default
161              affects both].
162
163       -bi    Selects binary input.  Append s for single precision [Default is
164              d  (double)].   Uppercase  S  or  D  will  force  byte-swapping.
165              Optionally, append ncol, the number of columns  in  your  binary
166              input  file if it exceeds the columns needed by the program.  Or
167              append c  if  the  input  file  is  netCDF.  Optionally,  append
168              var1/var2/...  to specify the variables to be read.  [Default is
169              2 input columns].
170
171       -bo    Selects binary output.  Append s for single  precision  [Default
172              is  d  (double)].   Uppercase  S  or D will force byte-swapping.
173              Optionally, append ncol, the number of desired columns  in  your
174              binary  output  file.  [Default is same as input].  Node ids are
175              stored as binary 4-byte integer triplets.  -bo is ignored if  -m
176              is selected.
177
178       -f     Special  formatting of input and/or output columns (time or geo‐
179              graphical data).  Specify i or o to  make  this  apply  only  to
180              input  or  output  [Default  applies to both].  Give one or more
181              columns (or column ranges) separated by commas.  Append T (abso‐
182              lute  calendar time), t (relative time in chosen TIME_UNIT since
183              TIME_EPOCH), x (longitude), y (latitude), or f (floating  point)
184              to  each  column or column range item.  Shorthand -f[i|o]g means
185              -f[i|o]0x,1y (geographic coordinates).
186
187       -m     Output triangulation network as multiple line segments separated
188              by  a  record  whose  first character is flag [>].  To plot, use
189              psxy with the -m option (see Examples).
190

ASCII FORMAT PRECISION

192       The ASCII output formats of numerical data are controlled by parameters
193       in  your  .gmtdefaults4  file.   Longitude  and  latitude are formatted
194       according to OUTPUT_DEGREE_FORMAT, whereas other values  are  formatted
195       according  to D_FORMAT.  Be aware that the format in effect can lead to
196       loss of precision in the output, which can  lead  to  various  problems
197       downstream.   If  you find the output is not written with enough preci‐
198       sion, consider switching to binary output (-bo if available) or specify
199       more decimals using the D_FORMAT setting.
200

GRID VALUES PRECISION

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

EXAMPLES

212       To triangulate the points in the file samples.xyz, store  the  triangle
213       information  in  a  binary file, and make a grid for the given area and
214       spacing, use
215
216       triangulate samples.xyz -bo -R0/30/0/30 -I2 -Gsurf.grd > samples.ijk
217
218       To draw the optimal Delaunay triangulation network based  on  the  same
219       file using a 15-cm-wide Mercator map, use
220
221       triangulate   samples.xyz   -m   -R-100/-90/30/34   -JM15c  |  psxy  -m
222       OPR(R)-100/-90/30/34 -JM15c -W0.5p -B1 > network.ps
223
224       To instead plot the Voronoi cell outlines, try
225       triangulate  samples.xyz  -m  -Q  -R-100/-90/30/34  -JM15c  |  psxy  -m
226       OPR(R)-100/-90/30/34 -JM15c -W0.5p -B1 > cells.ps
227

SEE ALSO

229       GMT(1), pscontour(1)
230

REFERENCES

232       Watson,  D.  F., 1982, Acord: Automatic contouring of raw data, Comp. &
233       Geosci., 8, 97-101.
234       Shewchuk, J. R., 1996, Triangle: Engineering a 2D Quality Mesh  Genera‐
235       tor  and Delaunay Triangulator, First Workshop on Applied Computational
236       Geometry (Philadelphia, PA), 124-133, ACM, May 1996.
237       www.cs.cmu.edu/~quake/triangle.html
238
239
240
241GMT 4.5.6                         10 Mar 2011                   TRIANGULATE(1)
Impressum