pygmt.triangulate¶
- pygmt.triangulate(table=None, x=None, y=None, z=None, *, outgrid=None, spacing=None, projection=None, region=None, verbose=None, registration=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 table 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.
table (str or numpy.ndarray or pandas.DataFrame or xarray.Dataset or geopandas.GeoDataFrame) – Pass in (x, y, z) or (longitude, latitude, elevation) values by providing a file name to an ASCII data table, a 2D
numpy.ndarray
, apandas.DataFrame
, anxarray.Dataset
made up of 1Dxarray.DataArray
data variables, or ageopandas.GeoDataFrame
containing 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.
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 algorithms);
i - Informational messages (same as
verbose=True
)c - Compatibility warnings
d - Debugging messages
registration (str) –
g|p. Force gridline (g) or pixel (p) node registration. [Default is g(ridline)].
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)