pygmt.triangulate¶
-
pygmt.
triangulate
(x=None, y=None, z=None, data=None, **kwargs)[source]¶ Delaunay triangulation or Voronoi partitioning and gridding of Cartesian data.
Triangulate reads in x,y[,z] data 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 region and projection) is chosen then it is applied before the triangulation is calculated.
Must provide either data or x, y, and z.
Full option list at https://docs.generic-mapping-tools.org/latest/triangulate.html
Aliases:
G = outgrid
I = spacing
J = projection
R = region
V = verbose
r = registration
- Parameters
x/y/z (np.ndarray) – Arrays of x and y coordinates and values z of the data points.
data (str or np.ndarray) – Either a data file name or a 2d numpy array with the tabular data.
projection (str) – Select map projection.
region –
'xmin/xmax/ymin/ymax[+r][+uunit]'
. Specify the region of interest.spacing (str) –
'xinc[unit][+e|n][/yinc[unit][+e|n]]'
. x_inc [and optionally y_inc] is the grid spacing.outgrid (bool or str) – Use triangulation to grid the data onto an even grid (specified with region and spacing). Set to True, or pass in the name of the output grid file. The interpolation 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 using triangulate (this is true of all gridding routines) or instead select sphtriangulate.
verbose (str) –
Select verbosity level [Default is w], which modulates the messages written to stderr. Choose among 7 levels of verbosity:
q - Quiet, not even fatal error messages are produced
e - Error messages only
w - Warnings [Default]
t - Timings (report runtimes for time-intensive algorthms);
i - Informational messages (same as “verbose=True”)
c - Compatibility warnings
d - Debugging messages
registration (str) –
[g|p]
Force output grid to be gridline (g) or pixel (p) node registered. Default is gridline (g). Only valid with outgrid.
- Returns
ret (xarray.DataArray or None) – Return type depends on whether the outgrid parameter is set:
pandas.DataFrame if outgrid is None (default)
xarray.DataArray if outgrid is True
None if outgrid is a str (grid output will be stored in outgrid)